BankDb.h (1285B)
1 #pragma once 2 #include <string> 3 #include <vector> 4 #include <map> 5 6 namespace zyn { 7 8 struct BankEntry 9 { 10 BankEntry(void); 11 std::string file; 12 std::string bank; 13 std::string name; 14 std::string comments; 15 std::string author; 16 std::string type; 17 int id; 18 bool add; 19 bool pad; 20 bool sub; 21 int time;//last update 22 typedef std::vector<std::string> svec; 23 svec tags(void) const; 24 bool match(std::string) const; 25 bool operator<(const BankEntry &b) const; 26 }; 27 28 29 class BankDb 30 { 31 public: 32 typedef std::vector<std::string> svec; 33 typedef std::vector<BankEntry> bvec; 34 typedef std::map<std::string,BankEntry> bmap; 35 36 //search for banks 37 //uses a space separated list of keywords and 38 //finds something that matches ALL keywords 39 bvec search(std::string) const; 40 41 //fully qualified paths only 42 void addBankDir(std::string); 43 44 //clear all known entries and banks 45 void clear(void); 46 47 //List of all tags 48 svec tags(void) const; 49 50 //scan banks 51 void scanBanks(void); 52 53 private: 54 BankEntry processXiz(std::string, std::string, bmap&) const; 55 bvec fields; 56 svec banks; 57 }; 58 59 }