diff --git a/src/Context.cpp b/src/Context.cpp index 72faccad8..c1195be8c 100644 --- a/src/Context.cpp +++ b/src/Context.cpp @@ -71,7 +71,6 @@ Context::Context () , data_dir ("~/.task") , config () , tdb2 () -, dom () , determine_color_use (true) , use_color (true) , run_gc (true) diff --git a/src/Context.h b/src/Context.h index af37dc80f..a3ea489be 100644 --- a/src/Context.h +++ b/src/Context.h @@ -33,7 +33,6 @@ #include #include #include -#include #include #include #include @@ -85,7 +84,6 @@ public: TDB2 tdb2; Hooks hooks; - DOM dom; bool determine_color_use; bool use_color; diff --git a/src/DOM.cpp b/src/DOM.cpp index b93075a4c..4d49cf352 100644 --- a/src/DOM.cpp +++ b/src/DOM.cpp @@ -52,7 +52,7 @@ extern Context context; // system.version // system.os // -bool DOM::get (const std::string& name, Variant& value) +bool getDOM (const std::string& name, Variant& value) { // Special case, blank refs cause problems. if (name == "") @@ -194,7 +194,7 @@ bool DOM::get (const std::string& name, Variant& value) // // This code emphasizes speed, hence 'id' and 'urgecny' being evaluated first // as special cases. -bool DOM::get (const std::string& name, const Task& task, Variant& value) +bool getDOM (const std::string& name, const Task& task, Variant& value) { // Special case, blank refs cause problems. if (name == "") @@ -331,7 +331,7 @@ bool DOM::get (const std::string& name, const Task& task, Variant& value) int count = 0; // Count off the 'a'th annotation. - for (auto& i : annos) + for (const auto& i : annos) { if (++count == a) { @@ -360,7 +360,7 @@ bool DOM::get (const std::string& name, const Task& task, Variant& value) int count = 0; // Count off the 'a'th annotation. - for (auto& i : annos) + for (const auto& i : annos) { if (++count == a) { @@ -388,7 +388,7 @@ bool DOM::get (const std::string& name, const Task& task, Variant& value) } // Delegate to the context-free version of DOM::get. - return this->get (name, value); + return getDOM (name, value); } //////////////////////////////////////////////////////////////////////////////// diff --git a/src/DOM.h b/src/DOM.h index cfd653d7d..ecbc6fe8d 100644 --- a/src/DOM.h +++ b/src/DOM.h @@ -30,16 +30,8 @@ #include #include #include -#include -class DOM -{ -public: - bool get (const std::string&, Variant&); - bool get (const std::string&, const Task&, Variant&); - -private: -}; +bool getDOM (const std::string&, Variant&); +bool getDOM (const std::string&, const Task&, Variant&); #endif -//////////////////////////////////////////////////////////////////////////////// diff --git a/src/Filter.cpp b/src/Filter.cpp index 2cb080a84..a6bcdddb9 100644 --- a/src/Filter.cpp +++ b/src/Filter.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -45,7 +46,7 @@ Task& contextTask = dummy; //////////////////////////////////////////////////////////////////////////////// bool domSource (const std::string& identifier, Variant& value) { - if (context.dom.get (identifier, contextTask, value)) + if (getDOM (identifier, contextTask, value)) { value.source (identifier); return true; diff --git a/src/Hooks.cpp b/src/Hooks.cpp index ed097a919..ff07f28a4 100644 --- a/src/Hooks.cpp +++ b/src/Hooks.cpp @@ -37,6 +37,8 @@ #include #include #include +#include +#include #include #include #include @@ -501,7 +503,7 @@ std::vector & Hooks::buildHookScriptArgs (std::vector args.push_back ("api:2"); // Command line Taskwarrior was called with. - context.dom.get ("context.args", v); + getDOM ("context.args", v); args.push_back ("args:" + std::string (v)); // Command to be executed. diff --git a/src/commands/CmdGet.cpp b/src/commands/CmdGet.cpp index db06cce06..83e374f33 100644 --- a/src/commands/CmdGet.cpp +++ b/src/commands/CmdGet.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -67,7 +68,7 @@ int CmdGet::execute (std::string& output) { Task t; Variant result; - if (context.dom.get (arg.attribute ("raw"), t, result)) + if (getDOM (arg.attribute ("raw"), t, result)) results.push_back ((std::string) result); else results.push_back ("");