최종완료보고 버전
This commit is contained in:
@@ -0,0 +1,90 @@
|
||||
#ifndef INI_FILE__H_
|
||||
#define INI_FILE__H_
|
||||
|
||||
|
||||
#include "Common.h"
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#pragma once
|
||||
|
||||
//#include <windows.h>
|
||||
#pragma warning(disable:4996)
|
||||
|
||||
#else
|
||||
|
||||
#ifdef MULTI_THREAD_MODEL
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
#endif // _WIN32
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class HIniFile
|
||||
{
|
||||
public:
|
||||
enum
|
||||
{
|
||||
IF_MAX_PATH = 512,
|
||||
IF_DEFAULT_BUFFER_SIZE = 1024,
|
||||
};
|
||||
|
||||
HIniFile();
|
||||
~HIniFile();
|
||||
|
||||
inline const char * GetIniFile() { return m_szIniFileName; }
|
||||
bool SetIniFile(const char * pszFileName);
|
||||
|
||||
const char * ReadString(const char * pszSetionName, const char * pszKeyName,
|
||||
const char * pszDefault, unsigned long nMaxSize = IF_DEFAULT_BUFFER_SIZE);
|
||||
bool WriteString(const char * pszSetionName, const char * pszKeyName, const char * pszString);
|
||||
|
||||
int ReadNumber(const char * pszSetionName, const char * pszKeyName, int nDefault);
|
||||
bool WriteNumber(const char * pszSetionName, const char * pszKeyName, int nNumber);
|
||||
|
||||
bool ReadBoolean(const char * pszSetionName, const char * pszKeyName, bool bDefault);
|
||||
bool WriteBoolean(const char * pszSetionName, const char * pszKeyName, bool bValue);
|
||||
|
||||
private:
|
||||
char m_szIniFileName[IF_MAX_PATH];
|
||||
char * m_pszBuffer;
|
||||
unsigned long m_dwBufferLength;
|
||||
};
|
||||
|
||||
|
||||
#ifndef _WIN32
|
||||
|
||||
// initialize file functions
|
||||
int GetPrivateProfileString_P(
|
||||
const char* lpAppName, // section name
|
||||
const char* lpKeyName, // key name
|
||||
const char* lpDefault, // default string
|
||||
char* lpReturnedString, // destination buffer
|
||||
unsigned int nSize, // size of destination buffer
|
||||
const char* lpFileName // initialization file name
|
||||
);
|
||||
|
||||
int GetPrivateProfileInt_P(
|
||||
const char* lpAppName, // section name
|
||||
const char* lpKeyName, // key name
|
||||
int nDefault, // return value if key name not found
|
||||
const char* lpFileName // initialization file name
|
||||
);
|
||||
|
||||
bool WritePrivateProfileString_P(
|
||||
const char* lpAppName, // section name
|
||||
const char* lpKeyName, // key name
|
||||
const char* lpString, // string to add
|
||||
const char* lpFileName // initialization file
|
||||
);
|
||||
|
||||
#endif // _WIN32
|
||||
|
||||
|
||||
#endif // INI_FILE__H_
|
||||
|
||||
Reference in New Issue
Block a user