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

#include <cAppConfig.h>

Inheritance diagram for GrayLib::cAppConfigX:
GrayLib::CWinApp

Public Member Functions

 cAppConfigX (cStringF sProfileName, cStringF sRegistryKey="")
 
 ~cAppConfigX ()
 
HRESULT GetOpenIni (bool bCreate=true)
 
HRESULT FlushX ()
 
HRESULT EnumConfig (const IniChar_t *pszSection, OUT cArrayString< IniChar_t > &rArray)
 
cString GetConfigStr (const IniChar_t *pszSection, const IniChar_t *pszEntry, const GChar_t *pszDefault=nullptr)
 
UINT GetConfigUInt (const IniChar_t *pszSection, const IniChar_t *pszEntry, int iDefault=0)
 
bool GetConfigVar (const IniChar_t *pszSection, const IniChar_t *pszEntry, OUT cVariant &rvVal)
 
bool WriteConfigStr (const IniChar_t *pszSection, const IniChar_t *pszEntry, const GChar_t *pszVal)
 
bool WriteConfigInt (const IniChar_t *pszSection, const IniChar_t *pszEntry, int iVal)
 
bool WriteConfigVar (const IniChar_t *pszSection, const IniChar_t *pszEntry, const cVariant &vVal)
 

Protected Attributes

cStringF m_sProfileName
 The full path to the profile specific to this app. (or just "Appname" for a m_sRegistryKey ) More...
 
cIniFile m_IniFile
 Cached open INI file. (if we use it) More...
 
bool m_bIniFileModified
 If we are using the m_IniFile file vs the registry then we need to write it. More...
 

Detailed Description

A config that might be the config for this application or may be to some other assembly/module/etc A config that might be from an INI file or registry. cIniFile or cRegKey. Use cAppConfigSection to isolate a single section. Similar to what is exposed by CWinApp:

  1. in WIN.INI (very old method, no longer used)
  2. in App.ini
  3. in registry. The INI file access functions are listed as only being used for Win16 compatibility. Prefer the registry then fallback to INI file?

Constructor & Destructor Documentation

◆ cAppConfigX()

GrayLib::cAppConfigX::cAppConfigX ( cStringF  sProfileName,
cStringF  sRegistryKey = "" 
)

decide if we get config info from a file or the registry.

  • sProfileName = EXE file name. No Ext.

◆ ~cAppConfigX()

GrayLib::cAppConfigX::~cAppConfigX ( )

Member Function Documentation

◆ EnumConfig()

HRESULT GrayLib::cAppConfigX::EnumConfig ( const IniChar_t pszSection,
OUT cArrayString< IniChar_t > &  rArray 
)

List all the config sections (pszSection = nullptr) or the keys in a pszSection.

  • pszSection = nullptr = enum all sections.

◆ FlushX()

HRESULT GrayLib::cAppConfigX::FlushX ( )

Write/Save if there is anything to write.

◆ GetConfigStr()

cString GrayLib::cAppConfigX::GetConfigStr ( const IniChar_t pszSection,
const IniChar_t pszEntry,
const GChar_t pszDefault = nullptr 
)

like MFC GetProfileString() but with 2 additions

  • pszSection = nullptr = get all sections. separated by
    .
  • pszEntry = nullptr = get all tags. separated by
    .

◆ GetConfigUInt()

UINT GrayLib::cAppConfigX::GetConfigUInt ( const IniChar_t pszSection,
const IniChar_t pszEntry,
int  iDefault = 0 
)

◆ GetConfigVar()

bool GrayLib::cAppConfigX::GetConfigVar ( const IniChar_t pszSection,
const IniChar_t pszEntry,
OUT cVariant rvVal 
)

◆ GetOpenIni()

HRESULT GrayLib::cAppConfigX::GetOpenIni ( bool  bCreate = true)

Get an open INI file if it exits. else create it if bCreate.

◆ WriteConfigInt()

bool GrayLib::cAppConfigX::WriteConfigInt ( const IniChar_t pszSection,
const IniChar_t pszEntry,
int  iVal 
)

◆ WriteConfigStr()

bool GrayLib::cAppConfigX::WriteConfigStr ( const IniChar_t pszSection,
const IniChar_t pszEntry,
const GChar_t pszVal 
)

Write string to config file or registry. like MFC WriteProfileString

  • pszEntry = nullptr = delete pszSection.
  • pszValue = nullptr = delete pszEntry.

◆ WriteConfigVar()

bool GrayLib::cAppConfigX::WriteConfigVar ( const IniChar_t pszSection,
const IniChar_t pszEntry,
const cVariant vVal 
)

Member Data Documentation

◆ m_bIniFileModified

bool GrayLib::cAppConfigX::m_bIniFileModified
protected

If we are using the m_IniFile file vs the registry then we need to write it.

◆ m_IniFile

cIniFile GrayLib::cAppConfigX::m_IniFile
protected

Cached open INI file. (if we use it)

◆ m_sProfileName

cStringF GrayLib::cAppConfigX::m_sProfileName
protected

The full path to the profile specific to this app. (or just "Appname" for a m_sRegistryKey )


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