diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 94a31cf8..83d100ca 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -15,7 +15,6 @@ set (timew_SRCS CLI.cpp CLI.h Lexer.cpp Lexer.h Rules.cpp Rules.h Timeline.cpp Timeline.h - classifier.cpp init.cpp helper.cpp util.cpp) diff --git a/src/classifier.cpp b/src/classifier.cpp deleted file mode 100644 index 35c07133..00000000 --- a/src/classifier.cpp +++ /dev/null @@ -1,59 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Copyright 2015 - 2016, Paul Beckingham, Federico Hernandez. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// http://www.opensource.org/licenses/mit-license.php -// -//////////////////////////////////////////////////////////////////////////////// - -#include -#include - -//////////////////////////////////////////////////////////////////////////////// -std::vector getHints (const std::vector & args) -{ - std::vector hints; - for (auto& arg : args) - if (arg[0] == ':') - hints.push_back (arg); - - return hints; -} - -//////////////////////////////////////////////////////////////////////////////// -// enum class ArgType { binary, command, positional, hint }; -ArgType classifyArg (const std::string& arg) -{ - if (arg.find ("timew") == arg.length () - 5 || - arg.find ("ti") == arg.length () - 2) - return ArgType::binary; - - // TODO Commands are a problem. - - if (arg[0] == ':') - return ArgType::hint; - - // The positional args are really just the remainder after the others are - // excluded. - return ArgType::positional; -} - -//////////////////////////////////////////////////////////////////////////////// diff --git a/src/timew.h b/src/timew.h index 7aae9dec..c7e78ddb 100644 --- a/src/timew.h +++ b/src/timew.h @@ -42,12 +42,6 @@ void initializeDataAndRules (Database&, Rules&, Log&); void initializeExtensions (Rules&, Extensions&, Log&); int dispatchCommand (const std::vector &, CLI&, Database&, Rules&, Extensions&, Log&); -// classifier.cpp -std::vector getHints (const std::vector &); - -enum class ArgType { binary, command, positional, hint }; -ArgType classifyArg (const std::string&); - // helper.cpp Color tagColor (const Rules&, const std::string&); std::string intervalSummarize (const Rules&, const Interval&); diff --git a/test/.gitignore b/test/.gitignore index b442d729..c63c1f90 100644 --- a/test/.gitignore +++ b/test/.gitignore @@ -1,6 +1,5 @@ all.log *.pyc -classifier.t composite.t exclusion.t interval.t diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index ae9b9fba..60a2528e 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -11,7 +11,7 @@ include_directories (${CMAKE_SOURCE_DIR} include_directories (${CMAKE_INSTALL_PREFIX}/include) link_directories(${CMAKE_INSTALL_PREFIX}/lib) -set (test_SRCS classifier.t composite.t exclusion.t interval.t lexer.t rules.t util.t) +set (test_SRCS composite.t exclusion.t interval.t lexer.t rules.t util.t) add_custom_target (test ./run_all --verbose DEPENDS ${test_SRCS} diff --git a/test/classifier.t.cpp b/test/classifier.t.cpp deleted file mode 100644 index 7797e1ac..00000000 --- a/test/classifier.t.cpp +++ /dev/null @@ -1,46 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Copyright 2015 - 2016, Paul Beckingham, Federico Hernandez. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// http://www.opensource.org/licenses/mit-license.php -// -//////////////////////////////////////////////////////////////////////////////// - -#include -#include -#include - -//////////////////////////////////////////////////////////////////////////////// -int main (int, char**) -{ - UnitTest t (3); - - // std::vector getHints (const std::vector &); - auto result = getHints ({"foo", ":keyword1", ":keyword2"}); - t.ok (result.size () == 2, "getHints (foo :keyword1 :keyword2) --> 2"); - t.is (result[0], ":keyword1", "getHints (foo :keyword1 :keyword2) [0] --> :keyword1"); - t.is (result[1], ":keyword2", "getHints (foo :keyword1 :keyword2) [1] --> :keyword2"); - - return 0; -} - -//////////////////////////////////////////////////////////////////////////////// -