CLI: Added A2::dump

This commit is contained in:
Paul Beckingham 2016-04-02 15:18:19 -04:00
parent 01bbc3d915
commit 8913eaf96f
2 changed files with 21 additions and 0 deletions

View file

@ -79,6 +79,26 @@ const std::string A2::attribute (const std::string& name) const
return "";
}
////////////////////////////////////////////////////////////////////////////////
const std::string A2::dump () const
{
auto output = Lexer::typeToString (_lextype);
// Dump attributes.
std::string atts;
for (const auto& a : _attributes)
atts += a.first + "='\033[33m" + a.second + "\033[0m' ";
// Dump tags.
std::string tags;
for (const auto& tag : _tags)
{
tags += "\033[32m" + tag + "\033[0m ";
}
return output + " " + atts + tags;
}
////////////////////////////////////////////////////////////////////////////////
void CLI::entity (const std::string& category, const std::string& name)
{

View file

@ -42,6 +42,7 @@ public:
void unTag (const std::string&);
void attribute (const std::string&, const std::string&);
const std::string attribute (const std::string&) const;
const std::string dump () const;
public:
Lexer::Type _lextype {Lexer::Type::word};