1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
// HMRegiConfig.h: interface for the CConfig class.
//
//////////////////////////////////////////////////////////////////////
 
#if !defined(AFX_CONFIG_H__F8E1E3C1_3652_4862_BC5B_B089CDD610CD__INCLUDED_)
#define AFX_CONFIG_H__F8E1E3C1_3652_4862_BC5B_B089CDD610CD__INCLUDED_
 
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
 
#include "BasedConfig.h"
 
enum Grouping    //!> ÆÄÀÏ °ü¸® ¸ðµâ ±×·ì
{
    FileMap_Mode = 1,        ///> STL Map À̿렰ü¸®
    FileManager_Mode = 2,    ///> MFC COblist À̿렰ü¸®
    Registery_mode = 4,        ///> ·¹Áö½ºÆ®¸® °ü¸®
    Ini_Mode = 5            ///> INI ÆÄÀÏ À̿렰ü¸®
};
 
/*!
* \brief
* µ¥ÀÌÅÍ °ü¸® Å¬·¡½º 
* µ¥ÀÌÅÍ °ü¸® Å¬·¡½º·Î¼­ (ÆÄÀÏ °ü¸®, ·¹Áö½ºÆ®¸® °ü¸®¸¦ Áö¿øÇÑ´Ù.) \n\n
* ÆÄÀÏ ¸ðµå\n
* SetRegiConfig À» ÀÌ¿ëÇÏ¿© ÆÄÀÏ ¿Àǽà¸Þ¸ð¸®·Î ÆÄÀÏÀÇ ³»¿ëÀ» ÀûÀç ÇÑ´Ù. \n
* µ¥ÀÌÅÍ ÀÔ/Ãâ·Â ÈÄ WriteToFile ÇÔ¼ö¸¦ ÅëÇØ¼­ µ¿±âÈ­ Çϰųª ReWriteMode¸¦ ÀÌ¿ëÇÏ¿© ½Ç½Ã°£ µ¿±âÈ­ ÇÒ ¼ö ÀÖ´Ù.
*/
class AFX_EXT_CLASS CConfig  
{
public:
    CConfig();
    virtual ~CConfig();
 
    BOOL    SetLogWriteMode(BOOL bUse,CString strFilePath);                                                    //!> ·Î±× ¸ðµå ¼³Á¤
    
    BOOL    SetRegiConfig(HKEY hKey, CString strKey, TCHAR* szFilename, Grouping Select = FileMap_Mode);    //!> ÆÄÀÏ/·¹Áö½ºÆ®¸® ·Îµå 
 
    BOOL    DeleteAllItem();                                                                                //!> Àüü µ¥ÀÌÅÍ »èÁ¦
    BOOL    DeleteValue(CString strvalue);                                                                    //!> ¼±Å൥ÀÌÅÍ »èÁ¦
    BOOL    DeleteValue(CString strvalue, int nIdx);                                                        //!> ¼±Å൥ÀÌÅÍ »èÁ¦
 
    // File_Mode ¸¸ Àû¿ë.
    BOOL    WriteToFile();                                                                                    //!> FIle Mode ÀÏ °æ¿ì ¸Þ¸ð¸®ÀÇ ³»¿ëÀ» ÆÄÀÏ¿¡ ÀúÀåÇÑ´Ù.
    void    SetRewriteMode(BOOL bRewrite);                                                                    //!> FIle Mode ÀÏ °æ¿ì ½Ç½Ã°£ µ¿±âÈ­ ¸ðµå¸¦ ¼³Á¤ÇÑ´Ù.
    BOOL    GetRewriteMode();                                                                                //!> File Mode ÀÏ °æ¿ì ½Ç½Ã°£ µ¿±âÈ­ ¸ðµå ¿©ºÎ¸¦ ¹ÝȯÇÑ´Ù.
 
    CString    GetFilePath();                                                                                    //!> File Mode ÀÏ °æ¿ì °ü¸®Çϴ ÆÄÀÏÀÇ °æ·Î¸¦ ¹ÝȯÇÑ´Ù.
 
    //////////////////////////////////////////////////////////////////////////
    BOOL    SetItemValue(CString strName,  CString strvalue);                                                //!> Set strName : Ç׸ñ±¸ºÐÀڠŸÀÔ : CStringÇü  
    BOOL    SetItemValue(CString strName, int nValue);                                                        //!> Set strName : Ç׸ñ±¸ºÐÀڠŸÀÔ : intÇü  
    BOOL    SetItemValue(CString strName, unsigned short sValue);                                            //!> Set strName : Ç׸ñ±¸ºÐÀڠŸÀÔ : unsigned shortÇü  
    BOOL    SetItemValue(CString strName, double dValue);                                                    //!> Set strName : Ç׸ñ±¸ºÐÀڠŸÀÔ : doubleÇü  
    
    BOOL    SetItemValue(int nIdx, CString strName, CString strvalue);                                        //!> Set nIdx : ¹è¿­ À妽º, strName : Ç׸ñ±¸ºÐÀڠŸÀÔ : CStringÇü  
    BOOL    SetItemValue(int nIdx, CString strName, int nValue);                                            //!> Set nIdx : ¹è¿­ À妽º, strName : Ç׸ñ±¸ºÐÀڠŸÀÔ : intÇü  
    BOOL    SetItemValue(int nIdx, CString strName, unsigned short sValue);                                    //!> Set nIdx : ¹è¿­ À妽º, strName : Ç׸ñ±¸ºÐÀڠŸÀÔ : unsigned shortÇü
    BOOL    SetItemValue(int nIdx, CString strName, double dValue);                                            //!> Set nIdx : ¹è¿­ À妽º, strName : Ç׸ñ±¸ºÐÀڠŸÀÔ : doubleÇü  
    
    //////////////////////////////////////////////////////////////////////////
    int        GetItemValue(CString strName, CString& strValue, CString strDefault = _T(""));                    //!> Get strName : Ç׸ñ±¸ºÐÀڠŸÀÔ : CStringÇü  
    int        GetItemValue(CString strName, int& nValue, int nDefault = 0);                                    //!> Get strName : Ç׸ñ±¸ºÐÀڠŸÀÔ : intÇü  
    int        GetItemValue(CString strName, unsigned short &nValue, unsigned short sDefault = 0);                //!> Get strName : Ç׸ñ±¸ºÐÀڠŸÀÔ : unsigned shortÇü  
    int        GetItemValue(CString strName, double& dValue, double dDefault = 0.0);                            //!> Get strName : Ç׸ñ±¸ºÐÀڠŸÀÔ : doubleÇü  
    
    int        GetItemValue(int nIdx, CString strName, CString& strValue, CString strDefault = _T(""));        //!> Get nIdx : ¹è¿­ À妽º, strName : Ç׸ñ±¸ºÐÀڠŸÀÔ : CStringÇü  
    int        GetItemValue(int nIdx, CString strName, int& nValue, int nDefault = 0);                            //!> Get nIdx : ¹è¿­ À妽º, strName : Ç׸ñ±¸ºÐÀڠŸÀÔ : intÇü  
    int        GetItemValue(int nIdx, CString strName, unsigned short &nValue, unsigned short sDefault = 0);    //!> Get nIdx : ¹è¿­ À妽º, strName : Ç׸ñ±¸ºÐÀڠŸÀÔ : unsigned shortÇü
    int        GetItemValue(int nIdx, CString strName, double& dValue, double dDefault = 0.0);                    //!> Get nIdx : ¹è¿­ À妽º, strName : Ç׸ñ±¸ºÐÀڠŸÀÔ : doubleÇü  
 
public:
    
    Grouping        m_Classification;                                                                        ///> ÆÄÀÏ/·¹Áö½ºÆ®¸® °ü¸® Å¸ÀÔ
 
protected:
    
    CBasedConfig    *m_pConfig;                                                                                ///> ±âº» °´Ã¼ Æ÷ÀÎÅÍ
 
    CString            m_strFilePath;                                                                            ///> ÆÄÀÏ °æ·Î
};
 
#endif // !defined(AFX_CONFIG_H__F8E1E3C1_3652_4862_BC5B_B089CDD610CD__INCLUDED_)