From 72e3f76ed9146a209ef89d838a753b872f89f4f9 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 7 Jun 2009 17:27:08 -0400 Subject: [PATCH] Integration - tag parsing - Added +tag, -tag support to Context. - Unit tests still broken. - Task is still broken. --- src/Context.cpp | 27 +++++++++++++++++++-------- src/Context.h | 2 ++ 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/Context.cpp b/src/Context.cpp index 68590846a..d255c2a03 100644 --- a/src/Context.cpp +++ b/src/Context.cpp @@ -215,6 +215,7 @@ void Context::dispatch () return out; */ + throw std::string ("unimplemented Context::dispatch"); } //////////////////////////////////////////////////////////////////////////////// @@ -328,6 +329,8 @@ void Context::loadCorrectConfigFile () void Context::parse () { Att attribute; + tagAdditions.clear (); + tagRemovals.clear (); std::string descCandidate = ""; bool terminated = false; bool foundSequence = false; @@ -355,19 +358,27 @@ std::cout << "# parse sequence '" << *arg << "'" << std::endl; foundSequence = true; } -/* - // Tags begin with + or - and contain arbitrary text. - else if (validTag (arg)) + // Tags to include begin with '+'. + else if (arg->length () > 1 && + (*arg)[0] == '+') { +std::cout << "# parse tag addition '" << *arg << "'" << std::endl; if (foundSequence) foundSomethingAfterSequence = true; - if (arg[0] == '+') - task.addTag (arg->substr (1, std::string::npos)); - else if (arg[0] == '-') - task.addRemoveTag (arg->substr (1, std::string::npos)); + tagAdditions.push_back (arg->substr (1, std::string::npos)); + } + + // Tags to remove begin with '-'. + else if (arg->length () > 1 && + (*arg)[0] == '-') + { +std::cout << "# parse tag removal '" << *arg << "'" << std::endl; + if (foundSequence) + foundSomethingAfterSequence = true; + + tagRemovals.push_back (arg->substr (1, std::string::npos)); } -*/ else if (attribute.valid (*arg)) { diff --git a/src/Context.h b/src/Context.h index 5083d0633..8bfdf26e2 100644 --- a/src/Context.h +++ b/src/Context.h @@ -68,6 +68,8 @@ public: std::string program; std::vector args; Cmd cmd; + std::vector tagAdditions; + std::vector tagRemovals; private: std::vector messages;