CLI: Added ::add

This commit is contained in:
Paul Beckingham 2016-04-02 14:09:10 -04:00
parent e695b0773b
commit 01bbc3d915
2 changed files with 15 additions and 0 deletions

View file

@ -92,6 +92,18 @@ void CLI::entity (const std::string& category, const std::string& name)
_entities.insert (std::pair <std::string, std::string> (category, name)); _entities.insert (std::pair <std::string, std::string> (category, name));
} }
////////////////////////////////////////////////////////////////////////////////
// Capture a single argument.
void CLI::add (const std::string& argument)
{
A2 arg (Lexer::trim (argument), Lexer::Type::word);
arg.tag ("ORIGINAL");
_original_args.push_back (arg);
// Adding a new argument invalidates prior analysis.
_args.clear ();
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Search for 'value' in _entities category, return canonicalized value. // Search for 'value' in _entities category, return canonicalized value.
bool CLI::canonicalize ( bool CLI::canonicalize (

View file

@ -55,10 +55,13 @@ class CLI
public: public:
CLI () = default; CLI () = default;
void entity (const std::string&, const std::string&); void entity (const std::string&, const std::string&);
void add (const std::string&);
bool canonicalize (std::string&, const std::string&, const std::string&) const; bool canonicalize (std::string&, const std::string&, const std::string&) const;
public: public:
std::multimap <std::string, std::string> _entities {}; std::multimap <std::string, std::string> _entities {};
std::vector <A2> _original_args {};
std::vector <A2> _args {};
}; };
#endif #endif