📄 cbasenode.h
字号:
#ifndef _CBASENODE_
#define _CBASENODE_
///////////////////////////////////////////////////////////////////////////////////
//引用libxml2的头文件
#include <libxml/xmlmemory.h>
#include <libxml/parser.h>
#include <libxml/encoding.h>
///////////////////////////////////////////////////////////////////////////////////
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#define NODELIST xmlNodePtr
#define NODE xmlNodePtr
#define MAXATTRVALUELEN 256 + 1
///////////////////////////////////////////////////////////////////////////////////
//
class CBaseNode
{
private:
unsigned char outValue[MAXATTRVALUELEN];
int outValueLen ;
bool m_bReady;
xmlDocPtr m_Doc ;// the xml docuement handle
// -----------------------------------------------------------------------
// Hidden constructors and operators
// -----------------------------------------------------------------------
void operator=(const CBaseNode&){};
CBaseNode(const CBaseNode&){};
void CloseXMLDoc();
public:
CBaseNode(){};
~CBaseNode() {CloseXMLDoc();};
void OpenXMLDoc(const char* xmlFileName);
NODE GetRootNode()
{
return xmlDocGetRootElement(m_Doc);
};
bool IsRightNode(NODE currentNode, const char* nodeName)
{
bool bRetval = false;
if(xmlStrcmp(currentNode->name, (xmlChar *) nodeName) == 0)
{
bRetval = true;
}
return bRetval;
}
void GetAttributeValue(NODE currentNode, const char* attrName, char* attrValue, const char* delaultValue);
CBaseNode(const char* xmlFileName)
{
OpenXMLDoc(xmlFileName);
};
bool IsReady(){return m_bReady;};
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -