mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
CLI: A2 gains tags and attributes
This commit is contained in:
parent
cb6d7b0abe
commit
91b943a26c
2 changed files with 31 additions and 0 deletions
23
src/CLI.cpp
23
src/CLI.cpp
|
@ -26,11 +26,34 @@
|
|||
|
||||
#include <cmake.h>
|
||||
#include <CLI.h>
|
||||
#include <algorithm>
|
||||
#include <shared.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
A2::A2 (const std::string& raw, Lexer::Type lextype)
|
||||
{
|
||||
_lextype = lextype;
|
||||
attribute ("raw", raw);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool A2::hasTag (const std::string& tag) const
|
||||
{
|
||||
return std::find (_tags.begin (), _tags.end (), tag) != _tags.end ();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void A2::tag (const std::string& tag)
|
||||
{
|
||||
if (! hasTag (tag))
|
||||
_tags.push_back (tag);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Accessor for attributes.
|
||||
void A2::attribute (const std::string& name, const std::string& value)
|
||||
{
|
||||
_attributes[name] = value;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue