luna-sysmgr-common
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LSMessageJsonParser Class Reference

#include <JSONUtils.h>

Public Member Functions

 LSMessageJsonParser (LSMessage *message, const char *schema)
 
bool parse (const char *callerFunction, LSHandle *sender=0, ESchemaErrorOptions errOption=EIgnore)
 Parse the message using the schema passed in constructor. More...
 
std::string getMsgCategoryMethod ()
 function parses the message and creates a string with category & method appended to it More...
 
std::string getSender ()
 function retrieves the sender name from the message More...
 
pbnjson::JValue get ()
 
const char * getPayload ()
 
bool get (const char *name, std::string &str)
 
bool get (const char *name, bool &boolean)
 
template<class T >
bool get (const char *name, T &number)
 

Constructor & Destructor Documentation

LSMessageJsonParser::LSMessageJsonParser ( LSMessage *  message,
const char *  schema 
)

Member Function Documentation

pbnjson::JValue LSMessageJsonParser::get ( )
inline
bool LSMessageJsonParser::get ( const char *  name,
std::string &  str 
)
inline
bool LSMessageJsonParser::get ( const char *  name,
bool &  boolean 
)
inline
template<class T >
bool LSMessageJsonParser::get ( const char *  name,
T &  number 
)
inline
LSMessageJsonParser::getMsgCategoryMethod ( )

function parses the message and creates a string with category & method appended to it

Returns
string with category and method appended
const char* LSMessageJsonParser::getPayload ( )
inline
LSMessageJsonParser::getSender ( )

function retrieves the sender name from the message

Returns
sender name if available, empty string otherwise
bool LSMessageJsonParser::parse ( const char *  callerFunction,
LSHandle *  sender = 0,
ESchemaErrorOptions  errOption = EIgnore 
)

Parse the message using the schema passed in constructor.

Parameters
callerFunction-Name of the function
sender- If 'sender' is specified, automatically reply in case of bad syntax using standard format.
errOption- Schema error option
Returns
true if parsed successfully, false otherwise

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