Barracuda Application Server C/C++ Reference
Native APIs, integration guides, and platform interfaces
JParser.h File Reference
#include <BaAtoi.h>
#include <AllocatorIntf.h>
Include dependency graph for JParser.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  JParserIntf
 The JParserIntf interface class is the interface between the parser and an object that implements the JParserIntf interface. More...
 
struct  JErr
 The JSON error container object. More...
 
struct  JParserVal
 The parser sets a JParserVal before calling the parser callback JParserIntf. More...
 
struct  JParser
 The JSON parser parses a JSON stream and calls the JParserIntf callback interface for each parsed object/primitive type. More...
 

Macros

#define JParserIntf_constructor(o, serviceMA)   (o)->service=serviceMA
 Initialize the callback interface. More...
 
#define JParserIntf_serviceCB(o, v, recLev)   (o)->service(o,v,recLev)
 Invoke the callback synchronously. More...
 
#define JErr_constructor(o)   (o)->err=JErrT_NoErr
 Initialize only the error code to JErrT_NoErr. More...
 
#define JErr_reset(o)   (o)->err=JErrT_NoErr, (o)->msg=0
 Clear the error code and message pointer so the object can be reused. More...
 
#define JErr_isError(o)   ((o)->err!=JErrT_NoErr)
 
#define JErr_noError(o)   ((o)->err==JErrT_NoErr)
 
#define JErr_getErrT(o)   (o)->err
 
#define JErr_getExpT(o)   (o)->expType
 
#define JErr_getRecT(o)   (o)->recType
 
#define JParser_getStatus(o)   ((JParsStat)(o)->status)
 Inspect the last parser result without changing state. More...
 

Typedefs

typedef int(* JParserIntf_Service) (struct JParserIntf *o, struct JParserVal *v, int recLevel)
 Receive one parsed value or container boundary synchronously. More...
 
typedef struct JParserIntf JParserIntf
 The JParserIntf interface class is the interface between the parser and an object that implements the JParserIntf interface. More...
 
typedef struct JErr JErr
 The JSON error container object. More...
 
typedef struct JParserVal JParserVal
 The parser sets a JParserVal before calling the parser callback JParserIntf. More...
 
typedef U8 JParserStackNode
 The stack used internally by JParser. More...
 

Enumerations

enum  JVType {
  JVType_InvalidType , JVType_String , JVType_Double , JVType_Int ,
  JVType_Long , JVType_Boolean , JVType_Null , JVType_Object ,
  JVType_Array
}
 The JSON types. More...
 
enum  JErrT {
  JErrT_NoErr =0 , JErrT_JsonErr , JErrT_WrongType , JErrT_InvalidMethodParams ,
  JErrT_FmtValErr , JErrT_MemErr , JErrT_IOErr
}
 JSON error codes. More...
 
enum  JParserT {
  JParserT_InvalidType =0 , JParserT_Null , JParserT_String = 's' , JParserT_Double = 'f' ,
  JParserT_Int = 'd' , JParserT_Long = 'l' , JParserT_Boolean = 'b' , JParserT_BeginObject = '{' ,
  JParserT_BeginArray = '[' , JParserT_EndObject = '}' , JParserT_EndArray = ']'
}
 Type 't' in JParserVal. More...
 
enum  JParsStat {
  JParsStat_DoneEOS =1 , JParsStat_Done , JParsStat_NeedMoreData = 100 , JParsStat_ParseErr = 200 ,
  JParsStat_IntfErr , JParsStat_MemErr , JParsStat_StackOverflow
}
 JSON Parser Status. More...
 

Functions

BA_API int JErr_setTooFewParams (JErr *o)
 Record JErrT_InvalidMethodParams with a static message if no error exists. More...
 
BA_API int JErr_setTypeErr (JErr *o, JVType expT, JVType recT)
 Record JErrT_WrongType only when no earlier error exists. More...
 
BA_API int JErr_setError (JErr *o, JErrT err, const char *msg)
 Record an error only when no earlier error exists. More...
 
BA_API void JParser_constructor (JParser *o, JParserIntf *intf, char *nameBuf, int namebufSize, AllocatorIntf *alloc, int extraStackLen)
 Create a JSON parser object. More...
 
BA_API int JParser_parse (JParser *o, const U8 *buf, U32 size)
 Feed or resume parsing a top-level JSON object or array. More...
 
BA_API void JParser_destructor (JParser *o)
 Free internal assembly storage. More...