mrDarker
2025-08-13 6ba20a51d17d6be2cf9886f3622863e95c2994fb
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
86
87
88
89
90
91
92
93
94
95
96
97
// FileMap.h: interface for the CFileMap class.
// 110222 OhByungGil
//////////////////////////////////////////////////////////////////////
 
#if !defined(AFX_FILEMAP_H__42CF4DC4_087E_4E66_9F2B_7764E7DDDF47__INCLUDED_)
#define AFX_FILEMAP_H__42CF4DC4_087E_4E66_9F2B_7764E7DDDF47__INCLUDED_
 
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
 
#ifdef _MSC_VER
#pragma warning(disable:4786)
#endif
 
#include<map>
 
#include "BasedConfig.h"
 
class CFileMap : public CBasedConfig 
{
public:
    CFileMap();
//    CFileMap(char* szFileName);
    virtual ~CFileMap();
 
 
    BOOL    Initialize(HKEY hKey, CString strKey, CString strFilename);
    
    //////////////////////////////////////////////////////////////////////////
    BOOL    SetItemValue(CString strName, CString& strValue);
    BOOL    SetItemValue(CString strName, int& nValue);
    BOOL    SetItemValue(CString strName, unsigned short &nValue);
    BOOL    SetItemValue(CString strName, double& dValue);
    
    BOOL    SetItemValue(int nIdx, CString strName, CString& strValue);
    BOOL    SetItemValue(int nIdx, CString strName, int& nValue);
    BOOL    SetItemValue(int nIdx, CString strName, unsigned short &nValue);
    BOOL    SetItemValue(int nIdx, CString strName, double& dValue);
    //////////////////////////////////////////////////////////////////////////
 
    //////////////////////////////////////////////////////////////////////////
    int        GetItemValue(CString strName, CString& strValue, CString strDefault = _T(""));
    int        GetItemValue(CString strName, int& nValue, int nDefault = 0);
    int        GetItemValue(CString strName, unsigned short &nValue, unsigned short sDefault = 0);
    int        GetItemValue(CString strName, double& dValue, double dDefault = 0.0);
    
    int        GetItemValue(int nIdx, CString strName, CString& strValue, CString strDefault = _T(""));
    int        GetItemValue(int nIdx, CString strName, int& nValue, int nDefault = 0);
    int        GetItemValue(int nIdx, CString strName, unsigned short &nValue, unsigned short sDefault = 0);
    int        GetItemValue(int nIdx, CString strName, double& dValue, double dDefault = 0.0);
    
    //////////////////////////////////////////////////////////////////////////
    
    BOOL    RemoveAllItem();
    BOOL    RemoveItem(CString strName);
    BOOL    RemoveItem(int nIdx, CString strName);
    
    // OhByungGil  Modify -> LogFile Write
    void    SetLogMode(BOOL bMode)                    {    m_bLogMode = bMode;    }
    BOOL    GetLogMode()                            {    return m_bLogMode;    }
    void    SetLogFilePath(CString strLogFilePath)    {    m_strLogFileName = strLogFilePath;}
    CString GetLogFilePath()                        {    return m_strLogFileName;    }
    
    BOOL    WriteToFile();
    
    void    SetRewriteMode(BOOL bRewrite)    { m_bRewrite = bRewrite; }
    BOOL    GetRewriteMode()                { return m_bRewrite; }
 
protected:
    void    WriteLog( CString strName, CString strValue );
    void    WriteLog( CString strName, int& nValue );
    void    WriteLog( CString strName, unsigned short &nValue );
    void    WriteLog( CString strName, double& dValue );
 
    BOOL    WriteToLogFile(CString& strContents);
    void    StringSeperate(CString& strLine, CString* pStrTitle, CString* pStrData);
private:
    CString                m_strFileName;
    int                    m_nItemCount;
    BOOL                m_bRewrite;
    
    CString                m_strLogFileName;    // OhByungGil 100531
    BOOL                m_bLogMode;
    
    CRITICAL_SECTION    m_cs;
 
 
    std::map<CString,CString>                    m_ItemList;
    std::map<CString,CString>::iterator            m_Iter;
 
 
 
 
};
 
#endif // !defined(AFX_FILEMAP_H__42CF4DC4_087E_4E66_9F2B_7764E7DDDF47__INCLUDED_)