00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef WLCACHEDDB_H
00021 #define WLCACHEDDB_H
00022
00023 #include <exception>
00024 #include <string>
00025 #include <map>
00026 #include "triplet.h"
00027 #include "db.h"
00028 #include "wlmodule.h"
00029
00034 class WlCachedDB
00035 {
00036 class Heading : public std::map<std::string, unsigned>
00037 {
00038 };
00039 class Entry : public std::map<unsigned, std::string>
00040 {
00041 };
00042 class Data : public std::map<std::string, Entry>
00043 {
00044 };
00045 public:
00046 WlCachedDB(class DB& db,
00047 bool initmode,
00048 const WLStaticDef& staticDef) throw(std::exception);
00049 bool check(const class Triplet& triplet) throw(std::exception);
00050 ~WlCachedDB();
00051 protected:
00052 bool exactMatch(const std::string logprefix,const class Triplet& triplet);
00053 bool patternMatch(const std::string logprefix,const class Triplet& triplet);
00054 std::string getRowComment(Data::const_iterator& itr) const;
00055 void logMatch(const std::string& logprefix,Data::const_iterator& itr,const class Triplet& triplet) const;
00056 private:
00057 class DB& _db;
00058 const WLStaticDef& _staticDef;
00059 Heading _heading;
00060 Data _data;
00061 };
00063 struct ToLower
00064 {
00065 char operator() (char c) const { return std::tolower(c); }
00066 };
00067 #endif