Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
Gray::cIniFile Class Reference

#include <cIniFile.h>

Inheritance diagram for Gray::cIniFile:
Gray::IIniBaseEnumerator

Public Member Functions

 cIniFile ()
 
virtual ~cIniFile ()
 
bool isRead () const
 
HRESULT ReadIniStream (cStreamInput &s, bool bStripComments=false)
 
HRESULT ReadIniFile (const FILECHAR_t *pszFilePath, bool bStripComments=false)
 
HRESULT WriteIniFile (const FILECHAR_t *pszFilePath) const
 
cIniSectionEntryPtr EnumSection (ITERATE_t i=0) const
 
virtual HRESULT PropEnum (IPROPIDX_t ePropIdx, OUT cStringI &rsValue, cStringI *psPropTag=nullptr) const override
 
cIniSectionEntryPtr FindSection (const IniChar_t *pszSectionTitle=nullptr, bool bPrefix=false) const
 
const IniChar_tFindKeyLinePtr (const IniChar_t *pszSectionTitle, const IniChar_t *pszKey) const
 
virtual cIniSectionEntryPtr AddSection (const IniChar_t *pszSectionTitle=nullptr, bool bStripped=false, int iLine=0)
 
HRESULT SetKeyLine (const IniChar_t *pszSectionTitle, const IniChar_t *pszKey, const IniChar_t *pszLine)
 
HRESULT SetKeyArg (const IniChar_t *pszSectionTitle, const IniChar_t *pszKey, const IniChar_t *pszArg)
 

Friends

class cIniFileTests
 

Detailed Description

Very simple interface to read/write an ".INI" MIME_EXT_ini format file. Reads the whole file into memory so we may parse it further. Allows initial data keys without [SECTIONTYPE Sectionnamedata] (unlike windows)

Constructor & Destructor Documentation

◆ cIniFile()

Gray::cIniFile::cIniFile ( )

◆ ~cIniFile()

Gray::cIniFile::~cIniFile ( )
virtual

Member Function Documentation

◆ AddSection()

cIniSectionEntryPtr Gray::cIniFile::AddSection ( const IniChar_t pszSectionTitle = nullptr,
bool  bStripped = false,
int  iLine = 0 
)
virtual

Create a new section in the file. don't care if the key exists or not. dupes are OK.

  • pszSectionTitle = "SECTIONTYPE SECTIONNAME" (ASSUME already stripped []) pszSectionTitle = "" = default;

◆ EnumSection()

cIniSectionEntryPtr Gray::cIniFile::EnumSection ( ITERATE_t  i = 0) const
inline

◆ FindKeyLinePtr()

const IniChar_t * Gray::cIniFile::FindKeyLinePtr ( const IniChar_t pszSectionTitle,
const IniChar_t pszKey 
) const

Find a line in the [pszSectionTitle] with a key looking like pszKey=

◆ FindSection()

cIniSectionEntryPtr Gray::cIniFile::FindSection ( const IniChar_t pszSectionTitle = nullptr,
bool  bPrefix = false 
) const

Assume file has been read into memory already.

◆ isRead()

bool Gray::cIniFile::isRead ( ) const
inline

Was this read ?

◆ PropEnum()

HRESULT Gray::cIniFile::PropEnum ( IPROPIDX_t  ePropIdx,
OUT cStringI rsValue,
cStringI psPropTag = nullptr 
) const
overridevirtual

IIniBaseEnumerator Enumerate the sections.

Implements Gray::IIniBaseEnumerator.

◆ ReadIniFile()

HRESULT Gray::cIniFile::ReadIniFile ( const FILECHAR_t pszFilePath,
bool  bStripComments = false 
)

Open and read a whole INI file.

  • bStripComments = strip comments from the file.
    Note
    we need to read a file before writing it. (gets all the comments etc)

◆ ReadIniStream()

HRESULT Gray::cIniFile::ReadIniStream ( cStreamInput s,
bool  bStripComments = false 
)

Read in all the sections in the file.

◆ SetKeyArg()

HRESULT Gray::cIniFile::SetKeyArg ( const IniChar_t pszSectionTitle,
const IniChar_t pszKey,
const IniChar_t pszArg 
)

OK for pszSectionTitle == nullptr

◆ SetKeyLine()

HRESULT Gray::cIniFile::SetKeyLine ( const IniChar_t pszSectionTitle,
const IniChar_t pszKey,
const IniChar_t pszLine 
)
  • pszSectionTitle = OK for nullptr
  • pszLine = nullptr = delete;

◆ WriteIniFile()

HRESULT Gray::cIniFile::WriteIniFile ( const FILECHAR_t pszFilePath) const

Write the whole INI file. preserve line comments (if the didn't get stripped via bStripComments).

Friends And Related Function Documentation

◆ cIniFileTests

friend class cIniFileTests
friend

The documentation for this class was generated from the following files: