CLI2: Implemented A2::tag/hasTag

This commit is contained in:
Paul Beckingham 2015-06-13 15:09:20 -04:00
parent 657d5b8310
commit 59429e9af8
2 changed files with 10 additions and 5 deletions

View file

@ -48,6 +48,7 @@ static int safetyValveDefault = 10;
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
A2::A2 () A2::A2 ()
: _name ("") : _name ("")
, _lextype (Lexer::Type::word)
{ {
} }
*/ */
@ -73,6 +74,7 @@ A2::A2 (const std::string& name, const double raw)
_name = name; _name = name;
attribute ("raw", raw); attribute ("raw", raw);
} }
*/
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
A2::~A2 () A2::~A2 ()
@ -82,6 +84,7 @@ A2::~A2 ()
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
A2::A2 (const A2& other) A2::A2 (const A2& other)
: _name (other._name) : _name (other._name)
, _lextype (other._lextype)
, _tags (other._tags) , _tags (other._tags)
, _attributes (other._attributes) , _attributes (other._attributes)
{ {
@ -93,6 +96,7 @@ A2& A2::operator= (const A2& other)
if (this != &other) if (this != &other)
{ {
_name = other._name; _name = other._name;
_lextype = other._lextype;
_tags = other._tags; _tags = other._tags;
_attributes = other._attributes; _attributes = other._attributes;
} }
@ -116,6 +120,7 @@ void A2::tag (const std::string& tag)
_tags.push_back (tag); _tags.push_back (tag);
} }
/*
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void A2::unTag (const std::string& tag) void A2::unTag (const std::string& tag)
{ {
@ -194,7 +199,6 @@ const std::string A2::dump () const
if (atts.length ()) if (atts.length ())
output += " " + atts; output += " " + atts;
/*
// Dump tags. // Dump tags.
std::string tags; std::string tags;
for (auto& tag : _tags) for (auto& tag : _tags)
@ -215,7 +219,6 @@ const std::string A2::dump () const
if (tags.length ()) if (tags.length ())
output += ' ' + tags; output += ' ' + tags;
*/
return output; return output;
} }

View file

@ -38,16 +38,20 @@
class A2 class A2
{ {
public: public:
/*
A2 (); A2 ();
*/
A2 (const std::string&, const std::string&, Lexer::Type); A2 (const std::string&, const std::string&, Lexer::Type);
/* /*
A2 (const std::string&, const int); A2 (const std::string&, const int);
A2 (const std::string&, const double); A2 (const std::string&, const double);
*/
~A2 (); ~A2 ();
A2 (const A&); A2 (const A2&);
A2& operator= (const A2&); A2& operator= (const A2&);
bool hasTag (const std::string&) const; bool hasTag (const std::string&) const;
void tag (const std::string&); void tag (const std::string&);
/*
void unTag (const std::string&); void unTag (const std::string&);
void unTagAll (); void unTagAll ();
*/ */
@ -63,9 +67,7 @@ public:
public: public:
std::string _name; std::string _name;
Lexer::Type _lextype; Lexer::Type _lextype;
/*
std::vector <std::string> _tags; std::vector <std::string> _tags;
*/
std::map <std::string, std::string> _attributes; std::map <std::string, std::string> _attributes;
}; };