Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members
|
Serialize a variant to or from JSON formatted file. More...
#include <FXJSONFile.h>
Public Member Functions | |
FXJSONFile () | |
Create JSON file i/o object. | |
FXJSONFile (const FXString &filename, Direction d=Load, FXuval sz=4096) | |
Create JSON file i/o object and open it. | |
FXbool | open (const FXString &filename, Direction d=Load, FXuval sz=4096) |
Open JSON file for direction d. | |
virtual FXival | fill (FXival count) |
Read at least count bytes into buffer; return bytes available, or -1 for error. | |
virtual FXival | flush (FXival count) |
Write at least count bytes from buffer; return space available, or -1 for error. | |
FXbool | close () |
Close JSON file and delete buffers. | |
virtual | ~FXJSONFile () |
Close JSON file. | |
Public Member Functions inherited from FX::FXJSON | |
FXJSON () | |
Initialize JSON serializer. | |
FXJSON (FXchar *buffer, FXuval sz=8192, Direction d=Load) | |
Initialize JSON serializer with buffer of size and direction. More... | |
FXbool | open (FXchar *buffer=nullptr, FXuval sz=8192, Direction d=Load) |
Open JSON parse buffer with given size and direction. More... | |
FXint | getLine () const |
Return current line number. | |
FXint | getColumn () const |
Return current column number. | |
FXlong | getOffset () const |
Return offset from begin of file. | |
virtual Error | load (FXVariant &variant) |
Load a variant from JSON stream. More... | |
virtual Error | save (const FXVariant &variant) |
Save a variant to JSON stream. More... | |
void | setNumericPrecision (FXuchar p) |
Floating point output precision control. More... | |
FXuchar | getNumericPrecision () const |
void | setNumericFormat (FXuchar f) |
Floating point output format control. More... | |
FXuchar | getNumericFormat () const |
void | setOutputFlow (FXuchar f) |
Change output flow format (Stream, Compact, Pretty). More... | |
FXuchar | getOutputFlow () const |
void | setIndentation (FXuchar d) |
Change indentation level for pretty print flow, the amount of indentation applied for each level. | |
FXuchar | getIndentation () const |
void | setLineWrap (FXint w) |
Change column at which lines are wrapped. | |
FXint | getLineWrap () const |
void | setEscapeMode (FXuchar e) |
Change string escape mode. More... | |
FXuchar | getEscapeMode () const |
void | setVersion (FXuchar v) |
Change json version. | |
FXuchar | getVersion () const |
void | setQuote (FXchar q) |
Change quote type, either (') or ("). | |
FXchar | getQuote () const |
FXbool | close () |
Close stream and delete buffer, if owned. More... | |
virtual | ~FXJSON () |
Close JSON stream and clean up. | |
Public Member Functions inherited from FX::FXParseBuffer | |
FXParseBuffer () | |
Initialize parse buffer to empty. | |
FXParseBuffer (FXchar *buffer, FXuval sz=4096, Direction d=Load) | |
Initialize parse buffer with given size and direction. More... | |
FXbool | open (FXchar *buffer=nullptr, FXuval sz=4096, Direction d=Load) |
Open parse buffer with given size and direction. | |
Direction | direction () const |
Return current direction. | |
FXuval | size () const |
Return current buffer size. | |
FXbool | close () |
Close parse buffer. | |
virtual | ~FXParseBuffer () |
Clean up and close buffer. | |
Additional Inherited Members | |
Public Types inherited from FX::FXJSON | |
enum | Error { ErrOK, ErrSave, ErrLoad, ErrToken, ErrColon, ErrComma, ErrBracket, ErrBrace, ErrQuotes, ErrQuote, ErrNumber, ErrIdent, ErrDuplicate, ErrEnd } |
JSON deserializer error codes. More... | |
enum | Flow { Stream, Compact, Pretty } |
JSON serializer flow modes. More... | |
Public Types inherited from FX::FXParseBuffer | |
enum | Direction { Stop = 0, Save = 1, Load = 2 } |
Static Public Member Functions inherited from FX::FXJSON | |
static const FXchar * | getError (Error err) |
Returns error for given error code. | |
Protected Types inherited from FX::FXJSON | |
enum | Token { TK_ERROR, TK_EOF, TK_COMMA, TK_COLON, TK_IDENT, TK_NAN, TK_INF, TK_NULL, TK_FALSE, TK_TRUE, TK_STRING, TK_PLUS, TK_MINUS, TK_INT, TK_HEX, TK_REAL, TK_LBRACK, TK_LBRACE, TK_RBRACK, TK_RBRACE } |
Protected Member Functions inherited from FX::FXJSON | |
virtual Token | next () |
Token | ident () |
Token | string () |
Error | loadMap (FXVariant &var) |
Error | loadArray (FXVariant &var) |
Error | loadVariant (FXVariant &var) |
Error | saveString (const FXString &str) |
Error | saveIdent (const FXString &str) |
Error | saveMap (const FXVariant &var) |
Error | saveArray (const FXVariant &var) |
Error | saveVariant (const FXVariant &var) |
Protected Member Functions inherited from FX::FXParseBuffer | |
FXbool | need (FXival count) |
FXbool | emit (FXchar ch, FXint count) |
FXbool | emit (const FXchar *str, FXint count) |
Static Protected Member Functions inherited from FX::FXJSON | |
static Token | identoken (const FXString &str) |
Protected Attributes inherited from FX::FXJSON | |
FXString | value |
FXlong | offset |
Token | token |
FXint | column |
FXint | indent |
FXint | line |
FXint | wrap |
FXchar | quote |
FXuchar | flow |
FXuchar | prec |
FXuchar | fmt |
FXuchar | esc |
FXuchar | dent |
FXuchar | ver |
Protected Attributes inherited from FX::FXParseBuffer | |
FXchar * | begptr |
FXchar * | endptr |
FXchar * | wptr |
FXchar * | rptr |
FXchar * | sptr |
Direction | dir |
Static Protected Attributes inherited from FX::FXJSON | |
static const FXchar *const | errors [] |
Serialize a variant to or from JSON formatted file.
Copyright © 1997-2022 Jeroen van der Zijp |