|
OpenM++ runtime library (libopenm)
|
ini-file reader: load all entries in memory and provide search methods. More...
#include <iniReader.h>
Public Member Functions | |
| IniFileReader (const char *i_filePath, const char *i_codePageName=nullptr) | |
| load all ini-file entries in memory and convert into UTF-8. | |
| bool | isLoaded (void) const noexcept |
| return true if ini-file loaded correctly or false on error | |
| bool | isExist (const char *i_section, const char *i_key) const noexcept |
| return true if section and key found in ini-file using case-neutral search. | |
| bool | isExist (const char *i_sectionKey) const noexcept |
| return true if section.key found in ini-file using case-neutral search. | |
| const string | strValue (const char *i_section, const char *i_key, const string &i_default="") const noexcept |
| return string value by section and key using case-neutral search, or default value if not found. | |
| const string | strValue (const char *i_sectionKey, const string &i_default="") const noexcept |
| return string value by section.key using case-neutral search, or default value if not found. | |
| const IniEntryVec & | rowsCRef (void) const |
| return const reference to ini-file entries. | |
| const NoCaseSet | sectionSet (void) const noexcept |
| return names of ini-file sections as case-neutral set of strings. | |
| const NoCaseMap | getSection (const char *i_section) const noexcept |
| return section by name as case-neutral map of (key,value). | |
Static Public Member Functions | |
| static void | loadMessages (const char *i_iniMsgPath, const string &i_language="", const char *i_codePageName=nullptr) noexcept |
| read language specific messages from path/to/theExe.message.ini and pass it to the log | |
| static list< pair< string, unordered_map< string, string > > > | loadAllMessages (const char *i_iniMsgPath, const char *i_codePageName=nullptr) noexcept |
| read language specific messages from path/to/theExe.message.ini for all languages | |
ini-file reader: load all entries in memory and provide search methods.
| IniFileReader::IniFileReader | ( | const char * | i_filePath, |
| const char * | i_codePageName = nullptr |
||
| ) |
load all ini-file entries in memory and convert into UTF-8.
| [in] | i_filePath | path to ini-file. |
| [in] | i_codePageName | (optional) name of encoding or Windows code page, ie: English_US.1252 |
| [in] | i_filePath | path to ini-file. |
| [in] | i_codePageName | (optional) name of encoding or Windows code page, ie: English_US.1252 |
Ini file example:
[section] ; section is required, global entries are not allowed
rem = ; comment only and empty value ; next line is empty value without comment non = val = no comments dsn = "DSN='server'; UID='user'; PWD='secret';" ; comment: database connection string lst = "the # quick" brown 'fox # jumps ; over' # use "quote" and 'apostrophe' to escape characters and keep spaces unb = "unbalanced quote ; this is not a comment: it is a value started from " quote
trim = Aname,Bname, \ ; comment: multi-line value joined with spaces trimmed Cname,DName ; comment: result is: Aname,Bname,Cname,DName
abcd = Aname,Bname, \ ; multi-line value ended with empty line Cname,DName \ ; result is: ; Aname,Bname,Cname,DName
; multi-line value started with " quote or ' apostrophe ; right spaces before \ is not trimmed, result is: ; Multi line text with spaces ; keep = "Multi line \ text with spaces" ; multi-line value started with " quote or ' apostrophe ; result is the same as above: ; Multi line text with spaces ; same = "\ Multi line \ text with spaces\ "
|
noexcept |
return true if section and key found in ini-file using case-neutral search.
return true if section and key exist in ini-file.
|
noexcept |
return true if section.key found in ini-file using case-neutral search.
return true if section.key exist in ini-file.
|
staticnoexcept |
read language specific messages from path/to/theExe.message.ini for all languages
| [in] | i_iniMsgPath | path to message ini-file, usually: path/to/theExe.message.ini |
|
noexcept |
return string value by section and key using case-neutral search, or default value if not found.
return string value by section and .key using case-neutral search, or default value if not found.