You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nmWATI/Include/iData/iXmlManager/Models/iXmlBaseItem.h

60 lines
1.3 KiB
C

#pragma once
#include <QVector>
#include <QtXml/QDomDocument>
#include "IxSerDes.h"
#include "ZxXpf.h"
#include "ZxSerializer.h"
#include "iXmlManager_global.h"
/// @brief XML基础行信息
class I_XMLMANAGER_EXPORT iXmlBaseItem : public QObject,
virtual public IxSerDes
{
Q_OBJECT
public:
iXmlBaseItem(QObject* parent = 0);
~iXmlBaseItem();
// 解析xml节点到List
virtual void parseInfo(const QDomElement& e);
// 把List分配到成员变量
// 输入开始的m_listValues中index并且返回下一个index
virtual int allocateInfo(int nIndex);
// 备份恢复
virtual bool saveBk();
virtual bool restoreBk();
// 序列化
virtual void onSerialize(ZxSerializer* ser);
virtual void onDeserialize(ZxSerializer* ser);
protected:
virtual void initXmlTags();
//主要检查是否数据
void checkStrToDigit(QString s, double& f);
void checkStrToDigit(QString s, int& n);
public:
QString m_sID; //ID
QString m_sName; //字段
protected:
// XML标签,需与成员变量严格对应
QStringList m_listTags;
// XML标签对应的数据,需与成员变量严格对应
QStringList m_listValues;
// 备份XML标签对应的数据,需与成员变量严格对应
QStringList m_listValuesBk;
};
typedef QVector<iXmlBaseItem*> vecXmlBaseItemsPtr;