mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-15 17:27:57 -05:00
Move MenuMatcherFactory to Matcher folder
This commit is contained in:
48
src/ObjLoading/Parsing/Menu/Matcher/MenuMatcherFactory.cpp
Normal file
48
src/ObjLoading/Parsing/Menu/Matcher/MenuMatcherFactory.cpp
Normal file
@ -0,0 +1,48 @@
|
||||
#include "MenuMatcherFactory.h"
|
||||
|
||||
using namespace menu;
|
||||
|
||||
MenuMatcherFactory::MenuMatcherFactory(const IMatcherForLabelSupplier<SimpleParserValue>* labelSupplier)
|
||||
: SimpleMatcherFactory(labelSupplier)
|
||||
{
|
||||
}
|
||||
|
||||
MatcherFactoryWrapper<SimpleParserValue> MenuMatcherFactory::Text() const
|
||||
{
|
||||
return MatcherFactoryWrapper<SimpleParserValue>(Or({String(), Identifier()}));
|
||||
}
|
||||
|
||||
MatcherFactoryWrapper<SimpleParserValue> MenuMatcherFactory::Numeric() const
|
||||
{
|
||||
return MatcherFactoryWrapper<SimpleParserValue>(Or({FloatingPoint(), Integer()}));
|
||||
}
|
||||
|
||||
int MenuMatcherFactory::TokenNumericIntValue(const SimpleParserValue& value)
|
||||
{
|
||||
if(value.m_type == SimpleParserValueType::FLOATING_POINT)
|
||||
{
|
||||
return static_cast<int>(value.FloatingPointValue());
|
||||
}
|
||||
|
||||
return value.IntegerValue();
|
||||
}
|
||||
|
||||
double MenuMatcherFactory::TokenNumericFloatingPointValue(const SimpleParserValue& value)
|
||||
{
|
||||
if (value.m_type == SimpleParserValueType::INTEGER)
|
||||
{
|
||||
return static_cast<double>(value.IntegerValue());
|
||||
}
|
||||
|
||||
return value.FloatingPointValue();
|
||||
}
|
||||
|
||||
std::string& MenuMatcherFactory::TokenTextValue(const SimpleParserValue& value)
|
||||
{
|
||||
if(value.m_type == SimpleParserValueType::IDENTIFIER)
|
||||
{
|
||||
return value.IdentifierValue();
|
||||
}
|
||||
|
||||
return value.StringValue();
|
||||
}
|
Reference in New Issue
Block a user