Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members
|
The FXINI class loads or saves an FXVariant to an .INI text file. More...
#include <FXINI.h>
Public Types | |
enum | Error { ErrOK, ErrSave, ErrLoad, ErrToken, ErrColon, ErrComma, ErrBracket, ErrBrace, ErrQuotes, ErrQuote, ErrNumber, ErrEnd } |
Public Types inherited from FX::FXParseBuffer | |
enum | Direction { Stop = 0, Save = 1, Load = 2 } |
Public Member Functions | |
FXINI () | |
Initialize INI parser. | |
FXINI (FXchar *buffer, FXuval sz=8192, Direction d=Load) | |
Initialize INI parser with buffer of size and direction. More... | |
FXbool | open (FXchar *buffer, FXuval sz=8192, Direction d=Load) |
Open INI 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. | |
Error | load (FXVariant &variant) |
Load a variant from stream. More... | |
Error | save (const FXVariant &variant) |
Save a variant to 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 | setEscapeMode (FXuchar e) |
Change string escape mode; 0=don't escape unicode in strings; 1=escape unicode as , 2=escape UTF8 multi-byte characters as or . More... | |
FXuchar | getEscapeMode () const |
FXbool | close () |
Close INI parser. More... | |
virtual | ~FXINI () |
Close INI parser 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. | |
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 parse buffer. | |
virtual | ~FXParseBuffer () |
Clean up and close buffer. | |
Static Public Member Functions | |
static const FXchar * | getError (Error err) |
Returns error code for given error. | |
Protected Attributes | |
FXlong | offset |
FXint | token |
FXint | column |
FXint | indent |
FXint | line |
FXuchar | state |
FXuchar | prec |
FXuchar | fmt |
FXuchar | esc |
Protected Attributes inherited from FX::FXParseBuffer | |
FXchar * | begptr |
FXchar * | endptr |
FXchar * | wptr |
FXchar * | rptr |
FXchar * | sptr |
Direction | dir |
Additional Inherited Members | |
Protected Member Functions inherited from FX::FXParseBuffer | |
FXbool | need (FXival count) |
FXbool | emit (FXchar ch, FXint count) |
FXbool | emit (const FXchar *str, FXint count) |
The FXINI class loads or saves an FXVariant to an .INI text file.
The FXVariant structure is subject to some limits:
When saving, numeric values are printed with configurable precision; (default=15 digits which results in minimal information loss for real numbers).
Values may be arbitrary strings, and this includes any legal UTF8- encoded value. When saving, strings may be escaped to ensure the information may be read back in unchanged. The following applies to when strings are escaped:
The default setting is to allow UTF8 characters in the output.
enum FX::FXINI::Error |
Initialize INI parser with buffer of size and direction.
Text location (column, line number, byte offset) is reset.
FXbool FX::FXINI::close | ( | ) |
Close INI parser.
To permit diagnostics, text location not reset.
Load a variant from stream.
Return false if stream wasn't opened for loading, or syntax error.
Open INI parse buffer with given size and direction.
Text location (column, line number, byte offset) is reset.
Save a variant to stream.
Return false if stream wasn't opened for saving, or disk was full.
|
inline |
Change string escape mode; 0=don't escape unicode in strings; 1=escape unicode as , 2=escape UTF8 multi-byte characters as or .
Default is to escape control characters only.
|
inline |
Floating point output format control.
The format mode is interpreted as follows:
0 No exponent. 1 Exponent. 2 Output exponent when required.
The default mode is 2.
|
inline |
Floating point output precision control.
This controls the number of significant digits written to the output. The default is 15.
Copyright © 1997-2022 Jeroen van der Zijp |