Reads and writes INI files. More...
Classes | |
class | Comment |
Untouched text object. More... | |
class | Entry |
Key / Value pair. More... | |
class | Generic |
Base class for INI file line objects. More... | |
class | Section |
INI section chunk. More... | |
Public Member Functions | |
FileINI () | |
Initialize an INI file parser. | |
~FileINI () | |
Dispose of an INI file parser. | |
uint_t | Init (const char *pFilename) |
Initialize the records with a file on disk. | |
uint_t | Init (Filename *pFilename) |
Initialize the records with a file on disk. | |
uint_t | Init (InputMemoryStream *pInput) |
Initialize the records with an InputMemoryStream. | |
void | Shutdown (void) |
Dispose of the contents of the structure. | |
uint_t | Save (const char *pFilename) const |
Save a script file to disk. | |
uint_t | Save (Filename *pFilename) const |
Save a script file to disk. | |
uint_t | Save (OutputMemoryStream *pOutput) const |
Save a script file. | |
Section * | AddSection (const char *pSectionName) |
Create a new section and append it to the end of the INI file. | |
Section * | FindSection (const char *pSectionName, uint_t bAlwaysCreate=0) |
Find a Section. | |
void | DeleteSection (const char *pSectionName) |
Delete a named Section. | |
Static Public Member Functions | |
static FileINI * | New (void) |
Allocate and initialize a FileINI. | |
static FileINI * | New (const char *pFilename, uint_t bAlwaysCreate=0) |
Create a new pref file record and initialize it with entries from a text file on disk. | |
static FileINI * | New (Filename *pFilename, uint_t bAlwaysCreate=0) |
Create a new pref file record and initialize it with entries from a text file on disk. | |
static FileINI * | New (InputMemoryStream *pInput, uint_t bAlwaysCreate=0) |
Create a new pref file record and initialize it with entries from a text file on disk. | |
Private Member Functions | |
FileINI (const FileINI &)=delete | |
FileINI & | operator= (const FileINI &)=delete |
FileINI (FileINI &&)=delete | |
FileINI & | operator= (FileINI &&)=delete |
Private Attributes | |
Generic | m_Root |
Root entry for a list of sections. | |
Reads and writes INI files.
This class will read and write out INI text files Care is taken that all comments and extra, non-parsable, data is retained so when the file is modified and written back out, all of the extra data is untouched.
|
privatedelete |
|
privatedelete |
Burger::FileINI::FileINI | ( | void | ) |
Initialize an INI file parser.
Burger::FileINI::~FileINI | ( | ) |
Burger::FileINI::Section *BURGER_API Burger::FileINI::AddSection | ( | const char * | pSectionName | ) |
void BURGER_API Burger::FileINI::DeleteSection | ( | const char * | pSectionName | ) |
Delete a named Section.
Traverse the linked list for a section that has the requested name and delete it and all data attached to it.
pSectionName | Pointer to a "C" string of the new section to locate |
Burger::FileINI::Section *BURGER_API Burger::FileINI::FindSection | ( | const char * | pSectionName, |
uint_t | bAlwaysCreate = 0 ) |
Find a Section.
Traverse the linked list for a section that has the requested name. Return NULL if the record wasn't found and bAlwaysCreate is zero. If bAlwaysCreate is not zero and the record didn't exist, create one with the requested name.
pSectionName | Pointer to a "C" string of the new section to locate |
bAlwaysCreate | TRUE to create the section if one didn't already exist |
uint_t BURGER_API Burger::FileINI::Init | ( | const char * | pFilename | ) |
Initialize the records with a file on disk.
Purge all records from the class and load in new data from a file on disk.
pFilename | Pointer to a "C" string of a valid Burgerlib filename |
uint_t BURGER_API Burger::FileINI::Init | ( | Filename * | pFilename | ) |
Initialize the records with a file on disk.
Purge all records from the class and load in new data from a file on disk.
pFilename | Pointer to a Filename structure |
uint_t BURGER_API Burger::FileINI::Init | ( | InputMemoryStream * | pInput | ) |
Initialize the records with an InputMemoryStream.
Purge all records from the class and load in new data from a memory stream
pInput | Pointer to an image of the text file in memory |
|
static |
Create a new pref file record and initialize it with entries from a text file on disk.
Open the file and read in the entries into a newly allocated FileINI structure.
Return NULL if the file cannot be opened and the bAlwaysCreate flag is zero
pFilename | Pointer to a "C" string of a valid Burgerlib filename |
bAlwaysCreate | TRUE if the file can't be opened, return an empty record instead |
|
static |
Create a new pref file record and initialize it with entries from a text file on disk.
Open the file and read in the entries into a newly allocated FileINI structure.
Return NULL if the file cannot be opened and the bAlwaysCreate flag is zero
|
static |
Create a new pref file record and initialize it with entries from a text file on disk.
Read in the entries from the InputMemoryStream into a newly allocated FileINI structure.
Return NULL if the file cannot be opened and the bAlwaysCreate flag is zero
pInput | Pointer to a InputMemoryStream record that has the text file image |
bAlwaysCreate | TRUE if the file can't be opened, return an empty record instead |
|
static |
Allocate and initialize a FileINI.
uint_t BURGER_API Burger::FileINI::Save | ( | const char * | pFilename | ) | const |
Save a script file to disk.
Serialize the data contained in the entire class as a Windows style INI text file and save it to a file.
pFilename | Pointer to a Burgerlib Path name |
uint_t BURGER_API Burger::FileINI::Save | ( | Filename * | pFilename | ) | const |
Save a script file to disk.
Serialize the data contained in the entire class as a Windows style INI text file and save it to a file.
pFilename | Pointer to a Filename instance |
uint_t BURGER_API Burger::FileINI::Save | ( | OutputMemoryStream * | pOutput | ) | const |
Save a script file.
Serialize the data contained in the entire class as a Windows style INI text file.
pOutput | Output string to store the UTF-8 file image of the data |
void BURGER_API Burger::FileINI::Shutdown | ( | void | ) |
Dispose of the contents of the structure.
Every record is released from memory
|
private |
Root entry for a list of sections.