00001 // -*- C++ -*- 00002 /* Copyright (C) 2007-2008 Johann Rudloff 00003 * License: GNU GPLv2 or later, see file "COPYING". No warranty of any kind! */ 00004 00005 #ifndef _CATALOG_MANAGER_H_ 00006 #define _CATALOG_MANAGER_H_ 00007 00008 #include <config.h> 00009 00010 #include <string> 00011 #include <vector> 00012 00013 namespace Limiro 00014 { 00015 00017 00018 class CatalogInfo 00019 { 00020 public: 00022 void clear() 00023 { 00024 title = subject = filename = ""; 00025 classLevel = vMajor = vMinor = 0; 00026 }; 00027 00028 std::string title; 00029 std::string subject; 00030 std::string filename; 00031 int classLevel; 00032 00033 int vMajor; 00034 int vMinor; 00035 }; 00036 00037 typedef std::vector<CatalogInfo> CatalogList; 00038 00039 00041 00045 class CatalogManager 00046 { 00047 public: 00048 CatalogManager(); 00049 ~CatalogManager(); 00050 00051 static bool extractInfo(const std::string& filename, CatalogInfo *inf); 00052 00053 void scanDirectory(std::string dirname); 00054 00055 std::vector<std::string> getSubjects(); 00056 CatalogList getCatalogList(std::vector<std::string> subjects); 00057 std::vector<int> getLevels(std::vector<std::string> subjects); 00058 CatalogList getCatalogs(std::vector<std::string> subjects, std::vector<int> levels); 00059 00060 #ifdef DEBUG 00061 void print(); 00062 #endif 00063 00064 private: 00065 CatalogList catalogs; 00066 00067 }; 00068 00069 } 00070 00071 #endif // _CATALOG_MANAGER_H_