classifier: Demoted from class to helper functions

This commit is contained in:
Paul Beckingham 2016-03-26 14:03:16 -04:00
parent a9734824de
commit e4d0a4ccf7
4 changed files with 15 additions and 41 deletions

View file

@ -5,8 +5,7 @@ include_directories (${CMAKE_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/src/libshared/src
${TIMEW_INCLUDE_DIRS})
set (timew_SRCS Classifier.cpp Classifier.h
Database.cpp Database.h
set (timew_SRCS Database.cpp Database.h
Datafile.cpp Datafile.h
Extensions.cpp Extensions.h
Grammar.cpp Grammar.h
@ -14,6 +13,7 @@ set (timew_SRCS Classifier.cpp Classifier.h
Lexer.cpp Lexer.h
LR0.cpp LR0.h
Rules.cpp Rules.h
classifier.cpp
init.cpp
util.cpp)

View file

@ -1,38 +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
//
////////////////////////////////////////////////////////////////////////////////
#ifndef INCLUDED_CLASSIFIER
#define INCLUDED_CLASSIFIER
class Classifier
{
public:
Classifier () = default;
private:
};
#endif

View file

@ -25,8 +25,17 @@
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
#include <Classifier.h>
#include <timew.h>
////////////////////////////////////////////////////////////////////////////////
std::vector <std::string> getKeywords (const std::vector <std::string>& args)
{
std::vector <std::string> keywords;
for (auto& arg : args)
if (arg[0] == ':')
keywords.push_back (arg);
return keywords;
}
////////////////////////////////////////////////////////////////////////////////

View file

@ -38,6 +38,9 @@ void initializeDataAndRules (Database&, Rules&, Log&);
void initializeExtensions (Rules&, Extensions&, Log&);
int dispatchCommand (const std::vector <std::string>&, Database&, Rules&, Extensions&, Log&);
// classifier.cpp
std::vector <std::string> getKeywords (const std::vector <std::string>&);
// utiŀ.cpp
std::string osName ();
std::string escape (const std::string&, int);