mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
CLI: A2::attribute accessor added
This commit is contained in:
parent
d799d553fc
commit
e695b0773b
2 changed files with 13 additions and 0 deletions
12
src/CLI.cpp
12
src/CLI.cpp
|
@ -67,6 +67,18 @@ void A2::attribute (const std::string& name, const std::string& value)
|
||||||
_attributes[name] = value;
|
_attributes[name] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Accessor for attributes.
|
||||||
|
const std::string A2::attribute (const std::string& name) const
|
||||||
|
{
|
||||||
|
// Prevent autovivification.
|
||||||
|
auto i = _attributes.find (name);
|
||||||
|
if (i != _attributes.end ())
|
||||||
|
return i->second;
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void CLI::entity (const std::string& category, const std::string& name)
|
void CLI::entity (const std::string& category, const std::string& name)
|
||||||
{
|
{
|
||||||
|
|
|
@ -41,6 +41,7 @@ public:
|
||||||
void tag (const std::string&);
|
void tag (const std::string&);
|
||||||
void unTag (const std::string&);
|
void unTag (const std::string&);
|
||||||
void attribute (const std::string&, const std::string&);
|
void attribute (const std::string&, const std::string&);
|
||||||
|
const std::string attribute (const std::string&) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Lexer::Type _lextype {Lexer::Type::word};
|
Lexer::Type _lextype {Lexer::Type::word};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue