📄 xmlprofile.h
字号:
// XMLProfile.h: interface for the CXMLProfile class.
// By Emilio Guijarro Cameros & xxli@2004.09
// 注:至少需要MSXML2.DOMDocument,即Win98默认不支持需升级msxml
// TODO:对XPath的支持
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_XMLPROFILE_H__2FD03BBC_39C1_4CD3_8F4C_FF6F4275735C__INCLUDED_)
#define AFX_XMLPROFILE_H__2FD03BBC_39C1_4CD3_8F4C_FF6F4275735C__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <windows.h>
#include <shlobj.h>
#include <comutil.h>
#include <msxml.h>
/////////////////////////////////////////////////////////////////////
class CXMLProfile
{
class CXMLProfileException
{
public:
TCHAR sMessage[255];
CXMLProfileException(LPTSTR sMessage)
{
//xxli@2004.09.07
lstrcpyn(CXMLProfileException::sMessage, sMessage,255);
CXMLProfileException::sMessage[254] = _T('\0'); // Make sure that string ends with zero
//lstrcpy(CXMLProfileException::sMessage, sMessage);
}
};
IXMLDOMDocument *pXMLDoc;
IXMLDOMElement *getEntry(LPCTSTR lpszSection, LPCTSTR lpszEntry, IXMLDOMElement* base=NULL);
IXMLDOMElement *getSection(LPCTSTR lpszEntry, IXMLDOMElement* base=NULL);
_bstr_t sFileName;
_bstr_t sXMLBase;
public:
//xxli@2004.09.07
CXMLProfile(
LPCTSTR lpszProfileName, //配置名(根节点名)
LPCTSTR lpszProfileFilePath=NULL, //自定义配置文档路径
LPCTSTR lpszXslFilePath=NULL //XSL文件路径
);
//CXMLProfile(LPCTSTR lpszProfileName); //obsolete
bool deleteProfileEntry( LPCTSTR lpszSection, LPCTSTR lpszEntry );
bool writeProfileInt(LPCTSTR lpszSection, LPCTSTR lpszEntry, int nValue);
bool writeProfileString(LPCTSTR lpszSection, LPCTSTR lpszEntry, LPCTSTR lpszData);
int getProfileInt(LPCTSTR lpszSection, LPCTSTR lpszEntry, int nDefault);
LPSTR getProfileString(LPCTSTR lpszSection, LPCTSTR lpszEntry, LPCSTR lpszDefault, LPSTR lpBuffer, UINT nBufferSize);
bool saveProfile();
bool loadProfile();
~CXMLProfile();
};
#endif // !defined(AFX_XMLPROFILE_H__2FD03BBC_39C1_4CD3_8F4C_FF6F4275735C__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -