My Project
 All Classes Functions Variables Typedefs Enumerations Enumerator Pages
Public Types | Public Member Functions | Static Public Member Functions | List of all members
OpenDDLParser Class Reference

This is the main API for the OpenDDL-parser. More...

#include <OpenDDLParser.h>

Public Types

typedef void(* logCallback) (LogSeverity severity, const std::string &msg)
 The log callback function pointer.
 

Public Member Functions

 OpenDDLParser ()
 The default class constructor.
 
 OpenDDLParser (char *buffer, size_t len)
 The class constructor. More...
 
 ~OpenDDLParser ()
 The class destructor.
 
void setLogCallback (logCallback callback)
 Setter for an own log callback function. More...
 
logCallback getLogCallback () const
 Getter for the log callback. More...
 
void setBuffer (char *buffer, size_t len)
 Assigns a new buffer to parse. More...
 
void setBuffer (const std::vector< char > &buffer)
 Assigns a new buffer to parse. More...
 
const char * getBuffer () const
 Returns the buffer pointer. More...
 
size_t getBufferSize () const
 Returns the size of the buffer. More...
 
void clear ()
 Clears all parser data, including buffer and active context.
 
bool parse ()
 Starts the parsing of the OpenDDL-file. More...
 
DDLNodegetRoot () const
 Returns the root node. More...
 
ContextgetContext () const
 Returns the parser context, only available in case of a succeeded parsing. More...
 
char * parseNextNode (char *current, char *end)
 
char * parseHeader (char *in, char *end)
 
char * parseStructure (char *in, char *end)
 
char * parseStructureBody (char *in, char *end, bool &error)
 
void pushNode (DDLNode *node)
 
DDLNodepopNode ()
 
DDLNodetop ()
 

Static Public Member Functions

static void normalizeBuffer (std::vector< char > &buffer)
 
static char * parseName (char *in, char *end, Name **name)
 
static char * parseIdentifier (char *in, char *end, Identifier **id)
 
static char * parsePrimitiveDataType (char *in, char *end, Value::ValueType &type, size_t &len)
 
static char * parseReference (char *in, char *end, std::vector< Name * > &names)
 
static char * parseBooleanLiteral (char *in, char *end, Value **boolean)
 
static char * parseIntegerLiteral (char *in, char *end, Value **integer, Value::ValueType integerType=Value::ddl_int32)
 
static char * parseFloatingLiteral (char *in, char *end, Value **floating)
 
static char * parseStringLiteral (char *in, char *end, Value **stringData)
 
static char * parseHexaLiteral (char *in, char *end, Value **data)
 
static char * parseProperty (char *in, char *end, Property **prop)
 
static char * parseDataList (char *in, char *end, Value **data, size_t &numValues, Reference **refs, size_t &numRefs)
 
static char * parseDataArrayList (char *in, char *end, DataArrayList **dataList)
 
static const char * getVersion ()
 

Detailed Description

This is the main API for the OpenDDL-parser.

Use instances of this class to manage the parsing and handling of your parser contexts.

Constructor & Destructor Documentation

OpenDDLParser::OpenDDLParser ( char *  buffer,
size_t  len 
)

The class constructor.

Parameters
buffer[in] The buffer
len[in] Size of the buffer

Member Function Documentation

const char* OpenDDLParser::getBuffer ( ) const

Returns the buffer pointer.

Returns
The buffer pointer.
size_t OpenDDLParser::getBufferSize ( ) const

Returns the size of the buffer.

Returns
The buffer size.
Context* OpenDDLParser::getContext ( ) const

Returns the parser context, only available in case of a succeeded parsing.

Returns
Pointer to the active context or ddl_nullptr.
logCallback OpenDDLParser::getLogCallback ( ) const

Getter for the log callback.

Returns
The current log callback.
DDLNode* OpenDDLParser::getRoot ( ) const

Returns the root node.

Returns
The root node.
bool OpenDDLParser::parse ( )

Starts the parsing of the OpenDDL-file.

Returns
True in case of success, false in case of an error.
Remarks
In case of errors check log.
void OpenDDLParser::setBuffer ( char *  buffer,
size_t  len 
)

Assigns a new buffer to parse.

Parameters
buffer[in] The buffer
len[in] Size of the buffer
void OpenDDLParser::setBuffer ( const std::vector< char > &  buffer)

Assigns a new buffer to parse.

Parameters
buffer[in] The buffer as a std::vector.
void OpenDDLParser::setLogCallback ( logCallback  callback)

Setter for an own log callback function.

Parameters
callback[in] The own callback.

The documentation for this class was generated from the following file: