mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
DOM: Added dtor that delegate to DOM::Node
This commit is contained in:
parent
b34a51710e
commit
2b71434cf8
2 changed files with 14 additions and 5 deletions
|
@ -483,6 +483,12 @@ bool getDOM (const std::string& name, const Task& task, Variant& value)
|
|||
//
|
||||
// This makes the DOM class a reusible object.
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
DOM::~DOM ()
|
||||
{
|
||||
delete _node;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void DOM::addSource (
|
||||
const std::string&,
|
||||
|
|
13
src/DOM.h
13
src/DOM.h
|
@ -38,6 +38,7 @@ bool getDOM (const std::string&, const Task&, Variant&);
|
|||
class DOM
|
||||
{
|
||||
public:
|
||||
~DOM ();
|
||||
void addSource (const std::string&, bool (*)(const std::string&, Variant&));
|
||||
bool valid (const std::string&) const;
|
||||
Variant get (const Task&, const std::string&) const;
|
||||
|
@ -47,13 +48,15 @@ public:
|
|||
std::string dump () const;
|
||||
|
||||
private:
|
||||
std::vector <std::string> decomposeReference (const std::string&) const;
|
||||
std::string dumpNode (const std::shared_ptr <DOM>, int) const;
|
||||
class Node
|
||||
{
|
||||
public:
|
||||
~Node ();
|
||||
};
|
||||
|
||||
private:
|
||||
std::string _name {"Unknown"};
|
||||
std::shared_ptr <bool (*)(const std::string&, Variant&)> _provider {nullptr};
|
||||
std::vector <std::shared_ptr <DOM>> _branches {};
|
||||
DOM::Node* _node {nullptr};
|
||||
};
|
||||
|
||||
#endif
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue