bbtkConfigurationFile.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00041 #ifndef __bbtkConfigurationFile_h__
00042 #define __bbtkConfigurationFile_h__
00043
00044 #include "bbtkSystem.h"
00045 #include <string>
00046
00047
00048 #ifdef WIN32
00049 #define _CRT_SECURE_NO_DEPRECATE
00050 #endif
00051
00052 #include <stdio.h>
00053 #include <iostream>
00054 #include <fstream>
00055 #include <sstream>
00056 #include <vector>
00057
00058
00059
00060 namespace bbtk
00061 {
00062
00063 class BBTK_EXPORT ConfigurationException
00064 {
00065 public:
00066 ConfigurationException(const std::string& message) : mMessage(message) {}
00067
00068 std::string mMessage;
00069 };
00070
00071
00072
00073 class BBTK_EXPORT ConfigurationFile
00074 {
00075 public:
00076
00077 static ConfigurationFile& GetInstance()
00078 {
00079 static ConfigurationFile f;
00080 return f;
00081 }
00082
00083 ~ConfigurationFile();
00084
00085 private:
00086 ConfigurationFile();
00087 void InstallPath ();
00088
00089 public:
00090 void GetHelp(int level) const;
00091
00092 inline const std::string& Get_description() const
00093 { return mDescription;}
00094
00095
00096 inline const std::string& Get_data_path() const
00097 { return mData_path;}
00098 inline const std::string& Get_file_separator() const
00099 { return mFile_separator;}
00100
00101 inline const std::string& Get_bin_path() const
00102 { return mBin_path;}
00103 inline const std::string& Get_install_path() const
00104 { return mInstall_path;}
00105 inline const std::string& Get_doc_path() const
00106 { return mDoc_path;}
00107 inline const std::string& Get_rsc_path() const
00108 { return mRsc_path;}
00109
00110 inline const std::string& Get_root_bbs_path() const
00111 { return mBbs_path;}
00112 inline const std::vector<std::string>& Get_bbs_paths() const
00113 { return mBbs_paths;}
00114 inline const std::vector<std::string>& Get_package_paths() const
00115 { return mPackage_paths;}
00116 inline const std::string& Get_config_xml_full_path() const
00117 { return mConfig_xml_full_path;}
00118 inline const std::string& Get_default_temp_dir() const
00119 { return mDefault_temp_dir;}
00120
00121 bool AddPackagePathsAndWrite( const std::string& package_root_path );
00122
00123 private:
00124 void Read(const std::string& fileName);
00125 std::string GetExecutablePath();
00126 void CreateConfigXML( char *rootDirectory );
00127
00128
00129 private :
00130 std::string mDescription;
00132 std::string mConfig_xml_full_path;
00133
00136 std::string mBin_path;
00138 std::string mInstall_path;
00140 std::string mDoc_rel_path;
00142 std::string mDoc_path;
00144 std::string mBbs_rel_path;
00146 std::string mBbs_path;
00148 std::string mRsc_rel_path;
00150 std::string mRsc_path;
00154 std::string mData_path;
00155
00157 std::string mFile_separator;
00158
00161 std::string mUrl;
00163 std::vector<std::string> mBbs_paths;
00165 std::vector<std::string> mPackage_paths;
00167 std::vector<std::string> mExt_dll_paths;
00169 std::string mDefault_temp_dir;
00170 };
00171
00172
00173 }
00174
00175
00176
00177 #endif
00178