From 283a1aa8ef12467e88e742c7d783f77a56649543 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 25 Oct 2014 22:55:31 -0400 Subject: [PATCH] DOM - Converted DOM and unit test from Parser to CLI. --- src/DOM.cpp | 16 ++++------------ test/dom.t.cpp | 2 +- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/src/DOM.cpp b/src/DOM.cpp index 7afd874ea..97ef0dd3d 100644 --- a/src/DOM.cpp +++ b/src/DOM.cpp @@ -109,16 +109,8 @@ bool DOM::get (const std::string& name, Variant& value) } else if (name == "context.args") { - std::string commandLine = ""; - std::vector ::iterator i; - for (i = context.parser.tree ()->_branches.begin (); i != context.parser.tree ()->_branches.end (); ++i) - { - if (commandLine != "") - commandLine += " "; - - commandLine += (*i)->attribute ("raw"); - } - + std::string commandLine; + join (commandLine, " ", context.cli._original_args); value = Variant (commandLine); return true; } @@ -243,7 +235,7 @@ bool DOM::get (const std::string& name, const Task& task, Variant& value) if (elements.size () == 1) { std::string canonical; - if (task.size () && context.parser.canonicalize (canonical, "attribute", name)) + if (task.size () && context.cli.canonicalize (canonical, "attribute", name)) { Column* column = context.columns[canonical]; if (column) @@ -308,7 +300,7 @@ bool DOM::get (const std::string& name, const Task& task, Variant& value) } std::string canonical; - if (context.parser.canonicalize (canonical, "attribute", elements[1])) + if (context.cli.canonicalize (canonical, "attribute", elements[1])) { if (elements.size () == 2) { diff --git a/test/dom.t.cpp b/test/dom.t.cpp index fe5a85ee8..8bcebfd6b 100644 --- a/test/dom.t.cpp +++ b/test/dom.t.cpp @@ -47,7 +47,7 @@ int main (int argc, char** argv) { // Prime the pump. const char* fake_argv[] = {"task"}; - context.parser.initialize (1, fake_argv); + context.cli.initialize (1, fake_argv); context.program = "task"; context.config.set ("name", "value");