⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xml.h

📁 电力故障信息采集,主要是针对南自的保护装置,这个程序用在Linux操作系统下
💻 H
字号:
#ifndef XML_H#define XML_H#include "localmutex.h"#include "ysheader.h"#include "EXML.h"#include "EXMLDoc.h"#include "EXMLNode.h"#include "EXMLAttribute.h"#include "YsString.h"typedef IEXMLNode QDomNode;typedef class CXMLReader{public:    CXMLReader(const char* pszFileName);    ~CXMLReader();    public:    //==================================================================================================//    //= Begin: 兼容老版本接口:与老版本程序接口名称及参数保持一致    //==================================================================================================//    //打开XML文件    bool OpenDomXMLFile();        //保存XML文件    bool SaveXmlFile();        bool GetSomeNode(const QString& qstrHead, const QString& qstrAttriName, const QString& qstrValue);    QString GetCurrentNodeAttribValue(const QString& qstrName);    bool GetNodeAttr(QDomNode& node, const QString& qstrAttriName, QString& qstrAttriValue);    bool GetNodeAttr(QDomNode& node, const QString& qstrAttriName, int& nAttrValue);    QDomNode InsertDomNode(const QString& qstrParentName, const QString& qstrChildName);    QDomNode InsertChildNode(QDomNode& node, const QString& qstrChildName);    bool InsertNodeAttr(QDomNode& node, const QString& qstrAttriName, const QString& qstrAttriValue);public:	/// 取得父节点szDomName下的一个子节点szNodeName,匹配在第一个找到的节点	QDomNode GetDomNode(QString szDomName, QString szNodeName);	    /// 此函数的"..."部分,带入:属性1,值1,属性2,值2,...,NULL,NULL    QDomNode GetDomNode(char* pszNodeName, ...);        /// 此函数的"..."部分,带入:子节点名称,属性1,值1,属性2,值2,...,NULL,NULL    QDomNode GetDomNodex(const QString& ParentName, const char* pszChildName, ...);    /// 此函数的"..."部分,带入:属性1,值1,属性2,值2,...,NULL,NULL    QDomNode GetChildNode(QDomNode& node, const char* pszChildName, ...);    /// 取得node下子节点的个数    int GetChildNodeCount(QDomNode& node);    //==================================================================================================//    //= End: 兼容老版本接口:与老版本程序接口名称及参数保持一致    //==================================================================================================//// private:    ///     bool GetSomeNode(const char* pszHead, const char* pszAttriName, const char* pszAttriValue);    /// 取当前节点属性名为AttriName的属性值    const char* GetCurrentNodeAttribValue(const char* pszAttriName);        /// 查找节点parent下的属性名为AttriName、属性值为AttriValue的节点    QDomNode FindChildNode(QDomNode& parent, const char* pszAttriName, const char* pszAttriValue);    /// 取得名为ParentName的节点下的某个名为strChildName的子节点    QDomNode FindChildNode(const char* pszParentName, const char* pszChildName);     /// 取得node的属性strAttriName的值,返回值AttriValue    bool GetAttributeValue(QDomNode& node, const char* pszAttriName, QString& qstrAttriValue);    bool GetAttributeValue(QDomNode& node, const char* pszAttriName, int& nAttrValue);        /// 在ParentName节点的最后插入子节点ChildName,返回新插入节点的指针    QDomNode InsertNode(const char* pszParentName, const char* pszChildName);    /// 在node节点的最后插入子节点ChildName, 返回新插入子节点    QDomNode InsertChildNode(QDomNode& node, const char* pszChildName);    /// 在Node节点中添加或修改属性AttrName,值为AttrValue    bool InsertAttribute(QDomNode& node, const char* pszAttriName, const char* pszAttriValue);private:    typedef queue<QDomNode>QueueEXMLNode;    void GetAllNode(QDomNode& parent, QueueEXMLNode& qNodes);private:    /// XML文档结构化句柄    IEXMLDoc m_DocXML;    /// 当前节点对象    QDomNode m_NodeCurrent;public:    /// XML磁盘物理文件    std::string m_strFileName;    /// 插入操作同步对象    CLocalMutex m_Mutex;private:    struct ATTRI_PART    {        string strName;        string strValue;    };    };#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -