32 #ifndef VLXParserVLT_INCLUDE_ONCE 33 #define VLXParserVLT_INCLUDE_ONCE 140 mLastTag = mToken.mString;
145 st->setLineNumber(
tokenizer()->lineNumber() );
149 if (mToken.mString.length())
150 vl::Log::error(
vl::Say(
"Line %n : parse error at '%s'.\n") << mTokenizer->lineNumber() << mToken.mString.c_str() );
160 vl::Log::error(
vl::Say(
"Line %n : parse error at '%s'.\n") << mTokenizer->lineNumber() << mToken.mString.c_str() );
166 vl::Log::error(
vl::Say(
"Line %n : parse error at '%s'.\n") << mTokenizer->lineNumber() << mToken.mString.c_str() );
180 if (!mLastTag.empty())
182 object->setTag(mLastTag.c_str());
196 if (mToken.mString.length() == 2)
198 if (mToken.mString ==
"ID")
201 if (!object->
uid().empty() &&
object->uid() !=
"#NULL")
214 object->setID(mToken.mString.c_str());
222 if (mToken.mString ==
"Id" || mToken.mString ==
"iD" || mToken.mString ==
"id")
231 name_value.
setKey( mToken.mString.c_str() );
245 if (mLastTag.empty())
247 mLastTag = mToken.mString;
269 list->setLineNumber(
tokenizer()->lineNumber() );
301 if (!mLastTag.empty())
309 if (!mLastTag.empty())
317 if (!mLastTag.empty())
319 name_value.
value().
setID(mToken.mString.c_str());
325 if (!mLastTag.empty())
333 if (!mLastTag.empty())
341 if (!mLastTag.empty())
343 name_value.
value().
setReal( atof(mToken.mString.c_str()) );
358 if (!mLastTag.empty())
360 list->
setTag(mLastTag.c_str());
372 switch( mToken.mType )
377 if (mLastTag.empty())
378 mLastTag = mToken.mString;
392 list->
value().push_back( value );
403 sub_list->setLineNumber(
tokenizer()->lineNumber() );
407 list->
value().push_back( value );
421 list->
value().push_back(value);
430 if (!mLastTag.empty())
432 value.
setString( mToken.mString.c_str() ); list->
value().push_back( value );
437 if (!mLastTag.empty())
450 list->
value().push_back( value );
461 if (!mLastTag.empty())
463 value.
setID( mToken.mString.c_str() ); list->
value().push_back( value );
468 if (!mLastTag.empty())
470 value.
setBool( mToken.mString ==
"true" ); list->
value().push_back( value );
475 if (!mLastTag.empty())
477 value.
setInteger( atoll(mToken.mString.c_str()) ); list->
value().push_back( value );
482 if (!mLastTag.empty())
484 value.
setReal( atof(mToken.mString.c_str()) ); list->
value().push_back( value );
498 struct struct_consume_tag
500 struct_consume_tag(
vl::ref<VLXArray>* p1, std::string* p2): p_arr(p1), p_tag(p2) {}
502 ~struct_consume_tag()
504 if ((*p_arr).get() && !p_tag->empty())
506 (*p_arr)->setTag(p_tag->c_str());
513 } consume_tag(&arr, &mLastTag);
566 case VLTToken::Integer: arr_integer->value().push_back( atoll( mToken.mString.c_str() ) );
break;
580 arr_floating->value().reserve(1024);
595 case VLTToken::real: arr_floating->value().push_back( atof( mToken.mString.c_str() ) );
break;
627 case VLTToken::String: printf(
"String = %s\n", mToken.mString.c_str());
break;
628 case VLTToken::ID: printf(
"ID = %s\n", mToken.mString.c_str());
break;
631 case VLTToken::real: printf(
"real = %s\n", mToken.mString.c_str());
break;
640 printf(
"Line %d: syntax error : '%s'.\n", mTokenizer->lineNumber(), mToken.mString.c_str());
649 std::string mLastTag;
double setReal(double val)
const VLTTokenizer * tokenizer() const
void setKey(const char *key)
VLXRawtextBlock * getRawtextBlock()
Wrapper for all VLX value types.
An abstract class representing a file.
bool getToken(VLTToken &token)
A simple String formatting class.
VLX_EXPORT VLXList * setList(VLXList *)
void parseMetadata()
Moves the <Metadata> key/value pairs in the Metadata map for quick and easy access and removes the <M...
void setValue(const char *value)
Key/value pair used by VLXStructure.
long long setInteger(long long val)
VLX_EXPORT VLXRawtextBlock * setRawtextBlock(VLXRawtextBlock *)
void setLineNumber(int line)
Parses a VLT file translating it into a VLX hierarchy.
void setTag(const char *tag)
static void error(const String &message)
Use this function to provide information about run-time errors: file not found, out of memory...
An array of 64 bits floating point numbers, can also have a tag.
bool parseArray(vl::ref< VLXArray > &arr)
#define VL_INSTRUMENT_CLASS(ClassName, BaseClass)
A token of information as defined by VLT specification.
std::vector< vl::ref< VLXStructure > > mStructures
const std::string & setIdentifier(const char *str)
std::vector< VLXValue > & value()
const std::string & setString(const char *str)
A list of key/VLXValue pairs, can also have a tag.
A simple sequence of VLXValue objects, can also have a tag.
#define VL_SERIALIZER_VERSION
VLX_EXPORT VLXStructure * setStructure(VLXStructure *)
void setLineNumber(int line)
VLX_EXPORT VLXArray * setArray(VLXArray *)
bool parseList(VLXList *list)
An array of 64 bits integers, can also have a tag.
Tokenizer used to parse VLT files.
VLTTokenizer * tokenizer()
const std::string & setID(const char *str)
const std::string & uid() const
bool parseStructure(VLXStructure *object)
Base class for VLX parsers.
std::map< std::string, VLXValue > mMetadata