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
|
SAS
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::string toString(Type language);
|
|
||||||
static Language::Type fromString(const std::string &languageName);
|
static Language::Type fromString(const std::string &languageName);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -13,7 +13,6 @@ file(GLOB sas_sources "plasp/sas/*.cpp")
|
|||||||
file(GLOB sas_headers "../include/plasp/sas/*.h")
|
file(GLOB sas_headers "../include/plasp/sas/*.h")
|
||||||
|
|
||||||
set(includes
|
set(includes
|
||||||
${Boost_INCLUDE_DIRS}
|
|
||||||
${PROJECT_SOURCE_DIR}/include
|
${PROJECT_SOURCE_DIR}/include
|
||||||
${PROJECT_SOURCE_DIR}/lib/tokenize/include
|
${PROJECT_SOURCE_DIR}/lib/tokenize/include
|
||||||
${PROJECT_SOURCE_DIR}/lib/colorlog/include
|
${PROJECT_SOURCE_DIR}/lib/colorlog/include
|
||||||
@ -48,7 +47,6 @@ set(sources
|
|||||||
)
|
)
|
||||||
|
|
||||||
set(libraries
|
set(libraries
|
||||||
${Boost_LIBRARIES}
|
|
||||||
colorlog
|
colorlog
|
||||||
pddl
|
pddl
|
||||||
pthread
|
pthread
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#include <plasp/Language.h>
|
#include <plasp/Language.h>
|
||||||
|
|
||||||
#include <boost/assign.hpp>
|
#include <map>
|
||||||
#include <boost/bimap.hpp>
|
|
||||||
|
|
||||||
namespace plasp
|
namespace plasp
|
||||||
{
|
{
|
||||||
@ -12,38 +11,23 @@ namespace plasp
|
|||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
using LanguageNames = boost::bimap<Language::Type, std::string>;
|
static const std::map<std::string, Language::Type> languageNames =
|
||||||
|
{
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
{"auto", Language::Type::Automatic},
|
||||||
|
{"pddl", Language::Type::PDDL},
|
||||||
const LanguageNames languageNames = boost::assign::list_of<LanguageNames::relation>
|
{"sas", Language::Type::SAS},
|
||||||
(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;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
Language::Type Language::fromString(const std::string &languageName)
|
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 Language::Type::Unknown;
|
||||||
|
|
||||||
return match->second;
|
return matchingLanguageName->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -3,7 +3,6 @@ set(target tests)
|
|||||||
file(GLOB core_sources "*.cpp")
|
file(GLOB core_sources "*.cpp")
|
||||||
|
|
||||||
set(includes
|
set(includes
|
||||||
${Boost_INCLUDE_DIRS}
|
|
||||||
${PROJECT_SOURCE_DIR}/include
|
${PROJECT_SOURCE_DIR}/include
|
||||||
${PROJECT_SOURCE_DIR}/lib/catch/single_include
|
${PROJECT_SOURCE_DIR}/lib/catch/single_include
|
||||||
${PROJECT_SOURCE_DIR}/lib/tokenize/include
|
${PROJECT_SOURCE_DIR}/lib/tokenize/include
|
||||||
@ -14,7 +13,6 @@ set(includes
|
|||||||
|
|
||||||
set(libraries
|
set(libraries
|
||||||
stdc++fs
|
stdc++fs
|
||||||
${Boost_LIBRARIES}
|
|
||||||
plasp
|
plasp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user