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