DOM: Added dtor that delegate to DOM::Node

This commit is contained in:
Paul Beckingham 2017-04-29 23:56:03 -04:00
parent b34a51710e
commit 2b71434cf8
2 changed files with 14 additions and 5 deletions

View file

@ -483,6 +483,12 @@ bool getDOM (const std::string& name, const Task& task, Variant& value)
// //
// This makes the DOM class a reusible object. // This makes the DOM class a reusible object.
////////////////////////////////////////////////////////////////////////////////
DOM::~DOM ()
{
delete _node;
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void DOM::addSource ( void DOM::addSource (
const std::string&, const std::string&,

View file

@ -38,6 +38,7 @@ bool getDOM (const std::string&, const Task&, Variant&);
class DOM class DOM
{ {
public: public:
~DOM ();
void addSource (const std::string&, bool (*)(const std::string&, Variant&)); void addSource (const std::string&, bool (*)(const std::string&, Variant&));
bool valid (const std::string&) const; bool valid (const std::string&) const;
Variant get (const Task&, const std::string&) const; Variant get (const Task&, const std::string&) const;
@ -47,13 +48,15 @@ public:
std::string dump () const; std::string dump () const;
private: private:
std::vector <std::string> decomposeReference (const std::string&) const; class Node
std::string dumpNode (const std::shared_ptr <DOM>, int) const; {
public:
~Node ();
};
private: private:
std::string _name {"Unknown"}; DOM::Node* _node {nullptr};
std::shared_ptr <bool (*)(const std::string&, Variant&)> _provider {nullptr};
std::vector <std::shared_ptr <DOM>> _branches {};
}; };
#endif #endif
////////////////////////////////////////////////////////////////////////////////