Removed Boost dependency in language distinction.
As Boost isn’t used in the rest of this project anymore, this commit removes the unnecessary dependency to boost::bimap just for language detection, and replaces it with a simple std::map instead.
This commit is contained in:
parent
1631a70a0b
commit
72fc7493b2
@ -23,7 +23,6 @@ class Language
|
||||
SAS
|
||||
};
|
||||
|
||||
static std::string toString(Type language);
|
||||
static Language::Type fromString(const std::string &languageName);
|
||||
|
||||
public:
|
||||
|
@ -13,7 +13,6 @@ file(GLOB sas_sources "plasp/sas/*.cpp")
|
||||
file(GLOB sas_headers "../include/plasp/sas/*.h")
|
||||
|
||||
set(includes
|
||||
${Boost_INCLUDE_DIRS}
|
||||
${PROJECT_SOURCE_DIR}/include
|
||||
${PROJECT_SOURCE_DIR}/lib/tokenize/include
|
||||
${PROJECT_SOURCE_DIR}/lib/colorlog/include
|
||||
@ -48,7 +47,6 @@ set(sources
|
||||
)
|
||||
|
||||
set(libraries
|
||||
${Boost_LIBRARIES}
|
||||
colorlog
|
||||
pddl
|
||||
pthread
|
||||
|
@ -1,7 +1,6 @@
|
||||
#include <plasp/Language.h>
|
||||
|
||||
#include <boost/assign.hpp>
|
||||
#include <boost/bimap.hpp>
|
||||
#include <map>
|
||||
|
||||
namespace plasp
|
||||
{
|
||||
@ -12,38 +11,23 @@ namespace plasp
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
using LanguageNames = boost::bimap<Language::Type, std::string>;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
const LanguageNames languageNames = boost::assign::list_of<LanguageNames::relation>
|
||||
(Language::Type::Automatic, "auto")
|
||||
(Language::Type::PDDL, "pddl")
|
||||
(Language::Type::SAS, "sas")
|
||||
(Language::Type::Unknown, "unknown");
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
std::string Language::toString(Language::Type language)
|
||||
{
|
||||
const auto match = languageNames.left.find(language);
|
||||
|
||||
if (match == languageNames.left.end())
|
||||
return "unknown";
|
||||
|
||||
return match->second;
|
||||
}
|
||||
static const std::map<std::string, Language::Type> languageNames =
|
||||
{
|
||||
{"auto", Language::Type::Automatic},
|
||||
{"pddl", Language::Type::PDDL},
|
||||
{"sas", Language::Type::SAS},
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Language::Type Language::fromString(const std::string &languageName)
|
||||
{
|
||||
const auto match = languageNames.right.find(languageName);
|
||||
const auto matchingLanguageName = languageNames.find(languageName);
|
||||
|
||||
if (match == languageNames.right.end())
|
||||
if (matchingLanguageName == languageNames.cend())
|
||||
return Language::Type::Unknown;
|
||||
|
||||
return match->second;
|
||||
return matchingLanguageName->second;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -3,7 +3,6 @@ set(target tests)
|
||||
file(GLOB core_sources "*.cpp")
|
||||
|
||||
set(includes
|
||||
${Boost_INCLUDE_DIRS}
|
||||
${PROJECT_SOURCE_DIR}/include
|
||||
${PROJECT_SOURCE_DIR}/lib/catch/single_include
|
||||
${PROJECT_SOURCE_DIR}/lib/tokenize/include
|
||||
@ -14,7 +13,6 @@ set(includes
|
||||
|
||||
set(libraries
|
||||
stdc++fs
|
||||
${Boost_LIBRARIES}
|
||||
plasp
|
||||
)
|
||||
|
||||
|
Reference in New Issue
Block a user