cimforreduceloss/testHasttable/loadmatchexception.cpp

42 lines
817 B
C++
Raw Normal View History

#include "loadmatchexception.h"
QHash<QString,char > *LoadMatchException::ht=NULL;
LoadMatchException::LoadMatchException()
{
}
LoadMatchException::~LoadMatchException()
{
}
bool LoadMatchException::contains(const QString& key)
{
return LoadMatchException::ht->contains(key);
}
bool LoadMatchException::init(const QString& exceptionFilePath)
{
LoadMatchException::ht=new QHash<QString,char >;
QFile file(exceptionFilePath);
QString line;
if(file.open(QFile::ReadOnly))
{
QTextStream reader(&file);
while(!reader.atEnd())
{
line=reader.readLine().trimmed();
if(line.length()==0)
{
continue;
}
(*LoadMatchException::ht)[line]=0;
}
file.close();
}
return true;
}