/* * JSONparseCore.h * * Created on: 5 Mar 2017 * Author: wentzelc */ #ifndef REDACORE_JSONPARSECORE_H_ #define REDACORE_JSONPARSECORE_H_ // redA Libraries #include #include // Standard C/C++ Libraries #include #include #include #include //--------------------------------------------------------------------------- class CJSONparse { private: CDataTree * DataTree; // File operation int InputHandle; int OutputHandle; CShiftBuffer * Buffer; // Parsing operation char * BufEnd; char * BufPos; char * LineMark; int LineNo; int Level; // Printing Operation char Spacer[100]; int SpacerLen; // Error bool Error; char ErrorText[100]; // File Buffer operation bool CreateBuffer( int pBufLen ); bool FillBuffer(); void FreeBuffer(); // Parsing functions inline void SkipWhiteSpace() { while (isspace(*BufPos)) { if (*BufPos == '\n') { LineMark = BufPos; LineNo++; } BufPos++; } } bool ParseObject( TDataMember * Object ); bool ParseString( char ** Value, int * pLen = NULL, EDataType * pType = NULL ); bool ParsePrimitive( char ** Value, int * pLen = NULL, EDataType * pType = NULL ); bool SaveObject( TDataMember * Object, const int Indent ); public: CJSONparse( CDataTree * pDataTree ); ~CJSONparse(); bool LoadFile( const char * FilePath, int pBufLen = 500 ); bool SaveFile( const char * FilePath, const int ValueTab = 20 ); const char * GetError() { return ((Error)? ErrorText : "Success"); }; }; #endif /* REDACORE_JSONPARSECORE_H_ */