From 491f5e227663a4d25ed6eeceb5de3ba99278e206 Mon Sep 17 00:00:00 2001 From: "dmy@lab" Date: Fri, 16 Jan 2015 16:27:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E5=BF=BD=E7=95=A5=E4=B8=80?= =?UTF-8?q?=E4=BA=9B=E8=B4=9F=E8=8D=B7=E7=9A=84=E5=8A=9F=E8=83=BD=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: dmy@lab --- testHasttable/loadmapping.cpp | 26 +++++++++++++++++++++++++- testHasttable/loadmapping.h | 2 ++ testHasttable/loadmatchexception.cpp | 7 ++++++- testHasttable/loadmatchexception.h | 1 + testHasttable/main.cpp | 2 +- 5 files changed, 35 insertions(+), 3 deletions(-) diff --git a/testHasttable/loadmapping.cpp b/testHasttable/loadmapping.cpp index 2ae4731..e0725fd 100644 --- a/testHasttable/loadmapping.cpp +++ b/testHasttable/loadmapping.cpp @@ -18,22 +18,40 @@ LoadMapping::~LoadMapping() bool LoadMapping::load(const QString &loadDir,const QString &matchdDir,const QString &exceptionFile) { + if(LoadMapping::ht->keys().length()>0) { return true;//只执行一次 } - if(!QFileInfo::exists(loadDir)|!QFileInfo::exists(matchdDir)|!QFileInfo::exists(exceptionFile)) + if(!QFileInfo::exists(loadDir)) { + std::cout<<"load file not exists."<readMatch(matchdDir)) { + std::cout<<"read match failed"<loadMatchException.init(exceptionFile); + if(!this->readLoads(loadDir)) { + std::cout<<"read load failed"<loadMatchException.contains(fileName)) + { + std::cout<<"ignore "<loadsToLoadInfo.contains(fileName)) { std::cout< > *ht; QHash > > loads; QHash > loadsToLoadInfo; + LoadMatchException loadMatchException; }; #endif // LOADMAPPING_H diff --git a/testHasttable/loadmatchexception.cpp b/testHasttable/loadmatchexception.cpp index 0d4dbc9..17aad04 100644 --- a/testHasttable/loadmatchexception.cpp +++ b/testHasttable/loadmatchexception.cpp @@ -1,6 +1,6 @@ #include "loadmatchexception.h" - +#include QHash *LoadMatchException::ht=NULL; LoadMatchException::LoadMatchException() { @@ -14,6 +14,7 @@ LoadMatchException::~LoadMatchException() bool LoadMatchException::contains(const QString& key) { + return LoadMatchException::ht->contains(key); } @@ -36,6 +37,10 @@ bool LoadMatchException::init(const QString& exceptionFilePath) } file.close(); } + else + { + std::cout<<"cannot open exception file "< #include #include + class LoadMatchException { public: diff --git a/testHasttable/main.cpp b/testHasttable/main.cpp index 3414b01..3484803 100644 --- a/testHasttable/main.cpp +++ b/testHasttable/main.cpp @@ -8,7 +8,7 @@ int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); LoadMapping lm; - lm.load("D:/Project/佛山项目/数据/搭网架参数文件/泰安/泰安负荷","D:/Project/佛山项目/数据/匹配的数据",""); + lm.load("D:/Project/佛山项目/数据/搭网架参数文件/泰安/泰安负荷","D:/Project/佛山项目/数据/匹配的数据","D:/Project/佛山项目/数据/exception.txt"); // ReadWrite aa; // RegexExtract re;