OpenAssetTools/src/Parser/Parsing/Simple/Matcher/SimpleMatcherFactory.cpp
2021-03-10 14:58:02 +01:00

48 lines
1.8 KiB
C++

#include "SimpleMatcherFactory.h"
#include "SimpleMatcherAnyCharacterBesides.h"
#include "SimpleMatcherCharacter.h"
#include "SimpleMatcherKeyword.h"
#include "SimpleMatcherValueType.h"
SimpleMatcherFactory::SimpleMatcherFactory(const IMatcherForLabelSupplier<SimpleParserValue>* labelSupplier)
: AbstractMatcherFactory(labelSupplier)
{
}
MatcherFactoryWrapper<SimpleParserValue> SimpleMatcherFactory::Type(SimpleParserValueType type) const
{
return MatcherFactoryWrapper<SimpleParserValue>(std::make_unique<SimpleMatcherValueType>(type));
}
MatcherFactoryWrapper<SimpleParserValue> SimpleMatcherFactory::Keyword(std::string value) const
{
return MatcherFactoryWrapper<SimpleParserValue>(std::make_unique<SimpleMatcherKeyword>(std::move(value)));
}
MatcherFactoryWrapper<SimpleParserValue> SimpleMatcherFactory::Identifier() const
{
return MatcherFactoryWrapper<SimpleParserValue>(std::make_unique<SimpleMatcherValueType>(SimpleParserValueType::IDENTIFIER));
}
MatcherFactoryWrapper<SimpleParserValue> SimpleMatcherFactory::Integer() const
{
return MatcherFactoryWrapper<SimpleParserValue>(std::make_unique<SimpleMatcherValueType>(SimpleParserValueType::INTEGER));
}
MatcherFactoryWrapper<SimpleParserValue> SimpleMatcherFactory::FloatingPoint() const
{
return MatcherFactoryWrapper<SimpleParserValue>(std::make_unique<SimpleMatcherValueType>(SimpleParserValueType::FLOATING_POINT));
}
MatcherFactoryWrapper<SimpleParserValue> SimpleMatcherFactory::Char(char c) const
{
return MatcherFactoryWrapper<SimpleParserValue>(std::make_unique<SimpleMatcherCharacter>(c));
}
MatcherFactoryWrapper<SimpleParserValue> SimpleMatcherFactory::AnyCharBesides(std::vector<char> chars) const
{
return MatcherFactoryWrapper<SimpleParserValue>(std::make_unique<SimpleMatcherAnyCharacterBesides>(std::move(chars)));
}