2014-11-26 17:09:37 +08:00
|
|
|
|
#ifndef NODETOTERMINAL_H
|
|
|
|
|
|
#define NODETOTERMINAL_H
|
|
|
|
|
|
//一个通过Node检索Terminal的表,做成单例形式
|
|
|
|
|
|
#include <QHash>
|
|
|
|
|
|
#include <QString>
|
2014-12-06 21:48:07 +08:00
|
|
|
|
#include <QVector>
|
2014-11-26 17:09:37 +08:00
|
|
|
|
class NodeToTerminal
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
2014-11-26 20:49:33 +08:00
|
|
|
|
NodeToTerminal();
|
2014-11-26 17:09:37 +08:00
|
|
|
|
~NodeToTerminal();
|
|
|
|
|
|
void add(const QString& key,const QString& value);
|
|
|
|
|
|
bool contains(const QString& key);
|
2014-12-06 21:48:07 +08:00
|
|
|
|
QVector<QString> value(const QString& key);
|
2014-11-26 17:09:37 +08:00
|
|
|
|
private:
|
2014-11-26 20:49:33 +08:00
|
|
|
|
class CG // 它的唯一工作就是在析构函数中删除CSingleton的实例
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
~CG()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (NodeToTerminal::ht)
|
|
|
|
|
|
delete NodeToTerminal::ht;
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
static CG Garbo; // 定义一个静态成员,在程序结束时,系统会调用它的析构函数
|
2014-12-06 21:48:07 +08:00
|
|
|
|
static QHash<QString,QVector<QString> > *ht;
|
2014-11-26 17:09:37 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
#endif // NODETOTERMINAL_H
|