Castor3D 0.16.0
Multiplatform 3D engine
Classes | Namespaces | Macros
FileParserModule.hpp File Reference

Classes

struct  castor::HasBaseParameterType< Type >
 Structure used to tell if an ParameterType has a base parameter type. More...
 
struct  castor::ParserFunctionAndParams
 The parser function and expected parameters. More...
 
struct  castor::AdditionalParsers
 

Namespaces

namespace  castor
 

Macros

#define CU_DO_WRITE_PARSER_NAME(funcname)
 
#define CU_DO_WRITE_BLOCK_PARSER_NAME(funcname, block)
 
#define CU_DO_WRITE_PARSER_CONTENT    bool result = false;
 
#define CU_DO_WRITE_PARSER_END(retval)    result = retval;
 
#define CU_DeclareAttributeParser(funcname)    bool CU_DO_WRITE_PARSER_NAME( funcname );
 
#define CU_DeclareAttributeParserBlock(funcname, block)    bool CU_DO_WRITE_BLOCK_PARSER_NAME( funcname, block );
 
#define CU_ImplementAttributeParser(funcname)
 
#define CU_EndAttribute()
 
#define CU_EndAttributePush(section)
 
#define CU_ImplementAttributeParserBlock(funcname, block)
 
#define CU_EndAttributePushBlock(section, block)
 
#define CU_ImplementAttributeParserNewBlock(funcname, oldBlock, newBlock)
 
#define CU_EndAttributePushNewBlock(section)
 
#define CU_EndAttributePop()
 
#define CU_ParsingError(error)    context.preprocessed->parseError( error )
 
#define CU_ParsingWarning(warning)    context.preprocessed->parseWarning( warning )
 
#define CU_MakeSectionName(a, b, c, d)    ( (castor::SectionId( a ) << 24 ) | ( castor::SectionId( b ) << 16 ) | ( castor::SectionId( c ) << 8 ) | ( castor::SectionId( d ) << 0 ) )
 

Typedefs

STL typedefs
using castor::Regex = std::basic_regex< xchar >
 
using castor::RegexIterator = std::regex_iterator< String::const_iterator >
 
using castor::MatchResults = std::match_results< String::const_iterator >
 

Enumerations

File Parser
enum class  castor::ParameterType : uint8_t {
  castor::eText = 0 , castor::eName = 1 , castor::ePath = 2 , castor::eCheckedText = 3 ,
  castor::eBitwiseOred32BitsCheckedText = 4 , castor::eBitwiseOred64BitsCheckedText = 5 , castor::eBool = 6 , castor::eInt8 = 7 ,
  castor::eInt16 = 8 , castor::eInt32 = 9 , castor::eInt64 = 10 , castor::eUInt8 = 11 ,
  castor::eUInt16 = 12 , castor::eUInt32 = 13 , castor::eUInt64 = 14 , castor::eFloat = 15 ,
  castor::eDouble = 16 , castor::eLongDouble = 17 , castor::ePixelFormat = 18 , castor::ePoint2I = 19 ,
  castor::ePoint3I = 20 , castor::ePoint4I = 21 , castor::ePoint2U = 22 , castor::ePoint3U = 23 ,
  castor::ePoint4U = 24 , castor::ePoint2F = 25 , castor::ePoint3F = 26 , castor::ePoint4F = 27 ,
  castor::ePoint2D = 28 , castor::ePoint3D = 29 , castor::ePoint4D = 30 , castor::eSize = 31 ,
  castor::ePosition = 32 , castor::eRectangle = 33 , castor::eRgbColour = 34 , castor::eRgbaColour = 35 ,
  castor::eHdrRgbColour = 36 , castor::eHdrRgbaColour = 37 , castor::eCount , castor::eMin = eText
}
 Parser function parameter types enumeration. More...
 

Parsers holders

using castor::SectionId = uint32_t
 The type for a section ID.
 
template<ParameterType Type, typename ParserValueHelperT = void>
using castor::ParserParameterValueType = typename ParserParameterHelper< Type, ParserValueHelperT >::ValueType
 
using castor::ParserParameterBaseSPtr = castor::SharedPtr< ParserParameterBase >
 
using castor::ParserFunction = castor::Function< bool( FileParserContext &, void *, ParserParameterArray const & ) >
 Parser function definition.
 
using castor::RawParserFunction = bool( * )( FileParserContext &, void *, ParserParameterArray const & )
 
template<typename BlockContextT >
using castor::ParserFunctionT = castor::Function< bool( FileParserContext &, BlockContextT *, ParserParameterArray const & ) >
 Parser function definition.
 
template<typename BlockContextT >
using castor::RawParserFunctionT = bool( * )( FileParserContext &, BlockContextT *, ParserParameterArray const & )
 
using castor::SectionAttributeParsers = Map< SectionId, ParserFunctionAndParams >
 The parsers sorted per section. This will be used to store the functions associated to a unique token.
 
using castor::AttributeParsers = StringMap< SectionAttributeParsers >
 The parsers sorted per token name.
 
using castor::UserContextCreator = castor::Function< void * ( FileParserContext & ) >
 User defined parsing context creator.
 
template<typename BlockContextT >
using castor::BlockParserFunctionT = bool( * )( FileParserContext &, BlockContextT *, ParserParameterArray const & )
 
static constexpr SectionId castor::PreviousSection = ( (castor::SectionId( 'P' ) << 24 ) | ( castor::SectionId( 'R' ) << 16 ) | ( castor::SectionId( 'E' ) << 8 ) | ( castor::SectionId( 'V' ) << 0 ) )
 Indicates that the next section for a parser is the previous one.
 
template<ParameterType Type, typename ParserValueHelperT = void>
ParameterType constexpr castor::ParserParameterParamType = ParserParameterHelper< Type, ParserValueHelperT >::ParamType
 
template<ParameterType Type, typename ParserValueHelperT = void>
StringView constexpr castor::ParserParameterStringType = ParserParameterHelper< Type, ParserValueHelperT >::StringType
 
template<ParameterType Type>
bool constexpr castor::hasBaseParameterTypeV = HasBaseParameterType< Type >::value
 
 castor::CU_DeclareSmartPtr (castor, FileParserContext, CU_API)
 
 castor::CU_DeclareVector (ParserParameterBaseSPtr, ParserParameter)
 
CU_API void castor::addParser (AttributeParsers &parsers, uint32_t oldSection, uint32_t newSection, String const &name, ParserFunction function, ParserParameterArray params=ParserParameterArray{})
 Adds a parser function to the parsers list.
 
static void castor::addParser (AttributeParsers &parsers, uint32_t section, String const &name, ParserFunction function, ParserParameterArray params=ParserParameterArray{})
 Adds a parser function to the parsers list.
 
template<typename SectionT , typename BlockContextT >
void castor::addParserT (AttributeParsers &parsers, SectionT section, String const &name, BlockParserFunctionT< BlockContextT > function, ParserParameterArray params=ParserParameterArray{})
 
template<typename SectionT , typename SectionU , typename BlockContextT >
void castor::addParserT (AttributeParsers &parsers, SectionT oldSection, SectionU newSection, String const &name, BlockParserFunctionT< BlockContextT > function, ParserParameterArray params=ParserParameterArray{})
 

Macro Definition Documentation

◆ CU_DeclareAttributeParser

#define CU_DeclareAttributeParser ( funcname)     bool CU_DO_WRITE_PARSER_NAME( funcname );

Define to ease the declaration of a parser.

◆ CU_DeclareAttributeParserBlock

#define CU_DeclareAttributeParserBlock ( funcname,
block )    bool CU_DO_WRITE_BLOCK_PARSER_NAME( funcname, block );

Define to ease the declaration of a parser.

◆ CU_DO_WRITE_BLOCK_PARSER_NAME

#define CU_DO_WRITE_BLOCK_PARSER_NAME ( funcname,
block )
Value:
funcname( castor::FileParserContext & context\
, block * blockContext\
, castor::ParserParameterArray const & params )
Definition FileParserContext.hpp:73

◆ CU_DO_WRITE_PARSER_CONTENT

#define CU_DO_WRITE_PARSER_CONTENT    bool result = false;

◆ CU_DO_WRITE_PARSER_END

#define CU_DO_WRITE_PARSER_END ( retval)     result = retval;

◆ CU_DO_WRITE_PARSER_NAME

#define CU_DO_WRITE_PARSER_NAME ( funcname)
Value:
funcname( castor::FileParserContext & context\
, void *\
, castor::ParserParameterArray const & params )

◆ CU_EndAttribute

#define CU_EndAttribute ( )
Value:
return result;\
}
#define CU_DO_WRITE_PARSER_END(retval)
Definition FileParserModule.hpp:26

Define to ease the implementation of a parser.

◆ CU_EndAttributePop

#define CU_EndAttributePop ( )
Value:
context.sections.pop_back();\
context.blocks.pop_back();\
return result;\
}

Define to ease the implementation of a parser.

◆ CU_EndAttributePush

#define CU_EndAttributePush ( section)
Value:
context.pendingSection = castor::SectionId( section );\
context.pendingBlock = nullptr;\
return result;\
}
uint32_t SectionId
The type for a section ID.
Definition FileParserModule.hpp:189

Define to ease the implementation of a parser.

◆ CU_EndAttributePushBlock

#define CU_EndAttributePushBlock ( section,
block )
Value:
context.pendingSection = castor::SectionId( section );\
context.pendingBlock = block;\
return result;\
}

Define to ease the implementation of a parser.

◆ CU_EndAttributePushNewBlock

#define CU_EndAttributePushNewBlock ( section)
Value:
context.pendingSection = castor::SectionId( section );\
context.pendingBlock = newBlockContext;\
return result;\
}

Define to ease the implementation of a parser.

◆ CU_ImplementAttributeParser

#define CU_ImplementAttributeParser ( funcname)
Value:
bool CU_DO_WRITE_PARSER_NAME( funcname )\
{\
#define CU_DO_WRITE_PARSER_CONTENT
Definition FileParserModule.hpp:23
#define CU_DO_WRITE_PARSER_NAME(funcname)
Definition FileParserModule.hpp:13

Define to ease the implementation of a parser.

◆ CU_ImplementAttributeParserBlock

#define CU_ImplementAttributeParserBlock ( funcname,
block )
Value:
bool CU_DO_WRITE_BLOCK_PARSER_NAME( funcname, block )\
{\
#define CU_DO_WRITE_BLOCK_PARSER_NAME(funcname, block)
Definition FileParserModule.hpp:18

Define to ease the implementation of a parser.

◆ CU_ImplementAttributeParserNewBlock

#define CU_ImplementAttributeParserNewBlock ( funcname,
oldBlock,
newBlock )
Value:
bool CU_DO_WRITE_BLOCK_PARSER_NAME( funcname, oldBlock )\
{\
auto newBlockContext = new newBlock{};\
context.allocatedBlocks.emplace_back( newBlockContext, castor::makeContextDeleter< newBlock >() );\

Define to ease the implementation of a parser.

◆ CU_MakeSectionName

#define CU_MakeSectionName ( a,
b,
c,
d )    ( (castor::SectionId( a ) << 24 ) | ( castor::SectionId( b ) << 16 ) | ( castor::SectionId( c ) << 8 ) | ( castor::SectionId( d ) << 0 ) )

Define to ease creation of a section name.

◆ CU_ParsingError

#define CU_ParsingError ( error)     context.preprocessed->parseError( error )

Define to ease the call to FileParser::parseError.

◆ CU_ParsingWarning

#define CU_ParsingWarning ( warning)     context.preprocessed->parseWarning( warning )

Define to ease the call to FileParser::parseWarning.