openddl-parser latest greatest
Signed-off-by: Kim Kulling <kim.kulling@googlemail.com>pull/538/head
parent
56e8dc5a43
commit
223a5385af
|
@ -1,7 +1,7 @@
|
|||
/*-----------------------------------------------------------------------------------------------
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Kim Kulling
|
||||
Copyright (c) 2014-2015 Kim Kulling
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
|
@ -138,6 +138,31 @@ Property *DDLNode::getProperties() const {
|
|||
return m_properties;
|
||||
}
|
||||
|
||||
bool DDLNode::hasProperty( const std::string &name ) {
|
||||
const Property *prop( findPropertyByName( name ) );
|
||||
return ( ddl_nullptr != prop );
|
||||
}
|
||||
|
||||
Property *DDLNode::findPropertyByName( const std::string &name ) {
|
||||
if( name.empty() ) {
|
||||
return ddl_nullptr;
|
||||
}
|
||||
|
||||
if( ddl_nullptr == m_properties ) {
|
||||
return ddl_nullptr;
|
||||
}
|
||||
Property *current( m_properties );
|
||||
while( ddl_nullptr != current ) {
|
||||
int res = strncmp( current->m_id->m_buffer, name.c_str(), name.size() );
|
||||
if( 0 == res ) {
|
||||
return current;
|
||||
}
|
||||
current = current->m_next;
|
||||
}
|
||||
|
||||
return ddl_nullptr;
|
||||
}
|
||||
|
||||
void DDLNode::setValue( Value *val ) {
|
||||
m_value = val;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*-----------------------------------------------------------------------------------------------
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Kim Kulling
|
||||
Copyright (c) 2014-2015 Kim Kulling
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*-----------------------------------------------------------------------------------------------
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Kim Kulling
|
||||
Copyright (c) 2014-2015 Kim Kulling
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*-----------------------------------------------------------------------------------------------
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Kim Kulling
|
||||
Copyright (c) 2014-2015 Kim Kulling
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
|
@ -57,6 +57,8 @@ public:
|
|||
const std::string &getName() const;
|
||||
void setProperties( Property *prop );
|
||||
Property *getProperties() const;
|
||||
bool hasProperty( const std::string &name );
|
||||
Property *findPropertyByName( const std::string &name );
|
||||
void setValue( Value *val );
|
||||
Value *getValue() const;
|
||||
void setDataArrayList( DataArrayList *dtArrayList );
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*-----------------------------------------------------------------------------------------------
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Kim Kulling
|
||||
Copyright (c) 2014-2015 Kim Kulling
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
|
@ -43,7 +43,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#endif // _WIN32
|
||||
|
||||
#define BEGIN_ODDLPARSER_NS namespace ODDLParser {
|
||||
#define END_ODDLPARSER_NS }
|
||||
#define END_ODDLPARSER_NS } // namespace ODDLParser
|
||||
#define USE_ODDLPARSER_NS using namespace ODDLParser;
|
||||
|
||||
BEGIN_ODDLPARSER_NS
|
||||
|
@ -113,6 +113,7 @@ private:
|
|||
const char *m_token;
|
||||
size_t m_size;
|
||||
};
|
||||
|
||||
struct Name {
|
||||
NameType m_type;
|
||||
Identifier *m_id;
|
||||
|
@ -122,6 +123,10 @@ struct Name {
|
|||
, m_id( id ) {
|
||||
// empty
|
||||
}
|
||||
|
||||
private:
|
||||
Name( const Name & );
|
||||
Name &operator = ( const Name& );
|
||||
};
|
||||
|
||||
struct Reference {
|
||||
|
@ -143,6 +148,10 @@ struct Reference {
|
|||
m_referencedName[ i ] = name;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
Reference( const Reference & );
|
||||
Reference &operator = ( const Reference & );
|
||||
};
|
||||
|
||||
struct Identifier {
|
||||
|
@ -154,6 +163,10 @@ struct Identifier {
|
|||
, m_buffer( buffer ) {
|
||||
// empty
|
||||
}
|
||||
|
||||
private:
|
||||
Identifier( const Identifier & );
|
||||
Identifier &operator = ( const Identifier & );
|
||||
};
|
||||
|
||||
struct Property {
|
||||
|
@ -169,6 +182,10 @@ struct Property {
|
|||
, m_next( ddl_nullptr ) {
|
||||
// empty
|
||||
}
|
||||
|
||||
private:
|
||||
Property( const Property & );
|
||||
Property &operator = ( const Property & );
|
||||
};
|
||||
|
||||
struct DataArrayList {
|
||||
|
@ -182,6 +199,11 @@ struct DataArrayList {
|
|||
, m_next( ddl_nullptr ) {
|
||||
// empty
|
||||
}
|
||||
|
||||
private:
|
||||
DataArrayList( const DataArrayList & );
|
||||
DataArrayList &operator = ( const DataArrayList & );
|
||||
|
||||
};
|
||||
|
||||
struct Context {
|
||||
|
@ -191,17 +213,10 @@ struct Context {
|
|||
: m_root( ddl_nullptr ) {
|
||||
// empty
|
||||
}
|
||||
};
|
||||
|
||||
struct BufferIt {
|
||||
std::vector<char> m_buffer;
|
||||
size_t m_idx;
|
||||
|
||||
BufferIt( const std::vector<char> &buffer )
|
||||
: m_buffer( buffer )
|
||||
, m_idx( 0 ) {
|
||||
// empty
|
||||
}
|
||||
private:
|
||||
Context( const Context & );
|
||||
Context &operator = ( const Context & );
|
||||
};
|
||||
|
||||
END_ODDLPARSER_NS
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*-----------------------------------------------------------------------------------------------
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Kim Kulling
|
||||
Copyright (c) 2014-2015 Kim Kulling
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*-----------------------------------------------------------------------------------------------
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Kim Kulling
|
||||
Copyright (c) 2014-2015 Kim Kulling
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*-----------------------------------------------------------------------------------------------
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Kim Kulling
|
||||
Copyright (c) 2014-2015 Kim Kulling
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
|
|
Loading…
Reference in New Issue