![]() |
Gray C++ Libraries
0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
|
#include <cIniSection.h>
Public Member Functions | |
cIniSectionData (bool bStripComments=false) noexcept | |
virtual | ~cIniSectionData () |
void | DisposeThis () |
bool | isStripped () const noexcept |
StrLen_t | get_BufferUsed () const noexcept |
StrLen_t | get_BufferSize () const noexcept |
ITERATE_t | get_LineQty () const noexcept |
IniChar_t * | GetLineEnum (ITERATE_t iLine=0) const noexcept |
ITERATE_t | FindTriggerName (const IniChar_t *pszTrigName) const |
virtual HRESULT | PropEnum (IPROPIDX_t ePropIdx, OUT cStringI &rsValue, cStringI *psKey=nullptr) const override |
void | ClearLineQty () |
ITERATE_t | FindKeyLine (const IniChar_t *pszKeyName, bool bPrefixOnly=false) const |
Find a key in the section (key=args) More... | |
const IniChar_t * | FindKeyLinePtr (const IniChar_t *pszKey) const |
const IniChar_t * | FindArgForKey (const IniChar_t *pszKey, const IniChar_t *pszDefault=nullptr) const |
int | FindIntForKey (const IniChar_t *pszKey, int iDefault=0) const |
virtual HRESULT | PropGet (const IniChar_t *pszPropTag, OUT cStringI &rsValue) const override |
bool | IsValidLines () const |
void | SetLinesCopy (const cIniSectionData §ion) |
ITERATE_t | AddLine (const IniChar_t *pszLine) |
bool | SetLine (ITERATE_t iLine, const IniChar_t *pszLine=nullptr) |
bool | RemoveLine (ITERATE_t iLine) |
ITERATE_t | AddKeyArg (const IniChar_t *pszKey, const IniChar_t *pszArg) |
ITERATE_t | AddKeyInt (const IniChar_t *pszKey, int iArg) |
ITERATE_t | SetKeyArg (const IniChar_t *pszKey, const IniChar_t *pszArg) |
ITERATE_t | SetKeyInt (const IniChar_t *pszKey, int iArg) |
void | AllocComplete () |
virtual HRESULT | PropSet (const IniChar_t *pszPropTag, const IniChar_t *pszValue) override |
StrLen_t | SetLinesParse (const IniChar_t *pszData, StrLen_t iLen=k_StrLen_UNK, const IniChar_t *pszSep=nullptr, STRP_MASK_t uFlags=(STRP_START_WHITE|STRP_MERGE_CRNL|STRP_END_WHITE|STRP_EMPTY_STOP)) |
cStringA | GetStringAll (const IniChar_t *pszSep=nullptr) const |
HRESULT | ReadSectionData (cStringA &rsSectionNext, cStreamInput &stream, bool bStripComments) |
HRESULT | WriteSectionData (cStreamOutput &file) |
Static Public Member Functions | |
static StrLen_t __stdcall | IsLineTrigger (const IniChar_t *pszLine) |
static StrLen_t __stdcall | MakeLine (IniChar_t *pszTmp, StrLen_t iSizeMax, const IniChar_t *pszKey, const IniChar_t *pszArg, IniChar_t chSep='=') |
![]() | |
static bool __stdcall | IsSectionHeader (const IniChar_t *pszLine) |
static bool __stdcall | IsLineComment (const IniChar_t *pszLine) |
static IniChar_t *__stdcall | FindLineArg (const IniChar_t *pszLine, bool bAllowSpace=false) |
static StrLen_t __stdcall | FindScriptLineEnd (const IniChar_t *pLineStr) |
static cStringI __stdcall | GetLineParse2 (const IniChar_t *pszLine, IniChar_t **ppszArgs=nullptr) |
static cStringI __stdcall | GetLineParse3 (const IniChar_t *pszLine, OUT cStringI &rsArgs) |
Static Public Attributes | |
static const StrLen_t | k_SECTION_SIZE_MAX = (256 * 1024) |
(chars) max size for whole section. (Windows Me/98/95 = 32K for INI) More... | |
static const ITERATE_t | k_LINE_QTY_MAX = (8 * 1024) |
max number of lines i support. (per section) More... | |
static const StrLen_t | k_LINE_LEN_MAX = (4 * 1024) |
max size for a single line (in chars). More... | |
static const StrLen_t | k_LINE_LEN_DEF = (1024) |
suggested/guessed/average size for lines (in chars). for alloc guessing. More... | |
Protected Member Functions | |
IniChar_t * | AllocBuffer (StrLen_t nSizeChars) |
For raw access to the m_Buffer. More... | |
void | AllocLines (ITERATE_t iLinesAlloc) |
IniChar_t * | AllocBeginMin (StrLen_t nSizeChars) |
Protected Attributes | |
bool | m_bStripComments |
has been stripped of blank lines, comments, leading and trailing line spaces. More... | |
Friends | |
class | cIniFile |
An array of lines (typically) in "Tag=Val" format or "Tag: Val". (comments and junk space is preserved) Mostly used as read only. Typically the data inside a [section] in an INI file. similar to _WIN32 GetPrivateProfileSection()
|
noexcept |
|
virtual |
Add the line, even if it is duplicated key.
add a text line to the end of this section. ASSUME m_bStripped has already been applied if used. Allow IsLineComment() and blank lines if NOT m_bStripped. strip newlines off. strip extra spaces off the end. allow leading spaces
Alloc at least this estimated amount. Meant to be used with ProcessBuffer ASSUME AllocComplete() will be called later.
For raw access to the m_Buffer.
void Gray::cIniSectionData::AllocComplete | ( | ) |
done loading, so trim to its used size.
|
protected |
void Gray::cIniSectionData::ClearLineQty | ( | ) |
don't re-alloc. just clear what is used.
void Gray::cIniSectionData::DisposeThis | ( | ) |
Dispose any data. we might reload it when needed. this might just be a stub.
const IniChar_t * Gray::cIniSectionData::FindArgForKey | ( | const IniChar_t * | pszKey, |
const IniChar_t * | pszDefault = nullptr |
||
) | const |
Find pszKey in the section.
int Gray::cIniSectionData::FindIntForKey | ( | const IniChar_t * | pszKey, |
int | iDefault = 0 |
||
) | const |
Find pszKey in the section.
ITERATE_t Gray::cIniSectionData::FindKeyLine | ( | const IniChar_t * | pszKeyName, |
bool | bPrefixOnly = false |
||
) | const |
Find a key in the section (key=args)
Find the first instance of a key in the section (key=args) From the top of the section find a specific key.
Find the line with this key in the section.
Find Unique Named trigger/label in block.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
enum the lines in the section.
Build a single string with all the section lines.
Is this line a script trigger/label in "@NAME" type format? Similar to other languages use of labels: ":DOSLabel" for .bat files. "CLabel:" for C++
|
inlinenoexcept |
has been stripped of blank lines, comments, leading and trailing line spaces.
bool Gray::cIniSectionData::IsValidLines | ( | ) | const |
All lines MUST be in the m_Buffer.
|
static |
Build a line in the form of KEY=ARG chSep = ':' or '='
|
overridevirtual |
Implements Gray::IIniBaseEnumerator.
|
overridevirtual |
Implements Gray::IIniBaseGetter.
|
overridevirtual |
Implements Gray::IIniBaseSetter.
HRESULT Gray::cIniSectionData::ReadSectionData | ( | cStringA & | rsSectionNext, |
cStreamInput & | stream, | ||
bool | bStripComments | ||
) |
Read the cIniSectionData from a cStreamInput. Up to EOF or [next section] Might be first section (with no [Section header] text in rsSectionNext)
Replace a line with an existing key. else just add to the end.
set the contents of a specific line. (NOT insert a line) pszLine = nullptr = delete.
void Gray::cIniSectionData::SetLinesCopy | ( | const cIniSectionData & | section | ) |
StrLen_t Gray::cIniSectionData::SetLinesParse | ( | const IniChar_t * | pszData, |
StrLen_t | iLen = k_StrLen_UNK , |
||
const IniChar_t * | pszSep = nullptr , |
||
STRP_MASK_t | uFlags = (STRP_START_WHITE | STRP_MERGE_CRNL | STRP_END_WHITE | STRP_EMPTY_STOP) |
||
) |
Set the section from a big data/text blob. Parse lines.
HRESULT Gray::cIniSectionData::WriteSectionData | ( | cStreamOutput & | file | ) |
|
friend |
|
static |
suggested/guessed/average size for lines (in chars). for alloc guessing.
|
static |
max size for a single line (in chars).
|
static |
max number of lines i support. (per section)
|
static |
(chars) max size for whole section. (Windows Me/98/95 = 32K for INI)
|
protected |
has been stripped of blank lines, comments, leading and trailing line spaces.