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/iBase/iUnit/iUnitGroup.h

60 lines
1.5 KiB
C

#pragma once
#include <QtXml/QDomDocument>
#include "iUnitItem.h"
// 单位组
class I_UNITSHARED_EXPORT iUnitGroup : public QObject
{
Q_OBJECT
public:
explicit iUnitGroup(QWidget *parent = 0);
~iUnitGroup();
public:
// 解析
void parseInfo(const QDomElement& e); //解析xml
void writeInfo(QDomElement& e,QDomDocument &doc); //写入xml
void copyFrom(iUnitGroup* p);
// 数据转换
// bool convert(QString sUnitSrc, double fValueSrc,
// QString sUnitDest, double& fValueDest, int &nDigit);
// bool convert(QString sUnitSrc, VecDouble vecValueSrc,
// QString sUnitDest, VecDouble& vecValueDest, int &nDigit);
bool convert(QString sUnitSrc, double fValueSrc,
QString sUnitDest, double& fValueDest, int &nDigit);
bool convert(QString sUnitSrc, VecDouble vecValueSrc,
QString sUnitDest, VecDouble& vecValueDest, int &nDigit);
// 查找是否还有某个单位
int indexOf(QString sUnit);
// 获取某个单位对象体
iUnitItem* getUnitItem(QString sUnit);
// 获取所有的单位名称
QStringList getAllUnitNames();
// 获取该单位组的基准单位
QString getUnitBase();
void clear();
public:
QString m_sID; //ID
QString m_sName; //名称
QString m_sType; //类型
QString m_sIcon; //图标
QString m_sTips; //备注说明
vecUnitItemPtr m_vecUnitItems;
};
typedef QVector<iUnitGroup*> vecUnitGroupPtr;