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 #if __VISUALC__ < 1400
00050 #define _CRT_SECURE_NO_DEPRECATE
00051 #endif
00052 #endif
00053
00054 #include <stdio.h>
00055 #include <iostream>
00056 #include <fstream>
00057 #include <sstream>
00058 #include <vector>
00059
00060
00061
00062 namespace bbtk
00063 {
00064
00065 class BBTK_EXPORT ConfigurationException
00066 {
00067 public:
00068 ConfigurationException(const std::string& message) : mMessage(message) {}
00069
00070 std::string mMessage;
00071 };
00072
00073
00074
00075 class BBTK_EXPORT ConfigurationFile
00076 {
00077 public:
00078
00079 static ConfigurationFile& GetInstance()
00080 {
00081 static ConfigurationFile f;
00082 return f;
00083 }
00084
00085 ~ConfigurationFile();
00086
00087 void GetHelp(int level) const;
00088
00090 inline bool DotBbtkIsNew() { return mDot_bbtk_is_new; }
00091
00092 inline const std::string& Get_description() const
00093 { return mDescription;}
00094
00095 inline const std::string& Get_data_path() const
00096 { return mData_path;}
00097 inline const std::string& Get_file_separator() const
00098 { return mFile_separator;}
00099
00100 inline const std::string& Get_dot_bbtk_path() const
00101 { return mDot_bbtk_path;}
00102 inline const std::string& Get_bin_path() const
00103 { return mBin_path;}
00104 inline const std::string& Get_install_path() const
00105 { return mInstall_path;}
00106 inline const std::string& Get_doc_path() const
00107 { return mDoc_path;}
00108
00109 inline const std::string& Get_root_bbs_path() const
00110 { return mBbs_path;}
00111 inline const std::vector<std::string>& Get_bbs_paths() const
00112 { return mBbs_paths;}
00113 inline const std::vector<std::string>& Get_package_paths() const
00114 { return mPackage_paths;}
00115 inline const std::string& Get_config_xml_full_path() const
00116 { return mConfig_xml_full_path;}
00117 inline const std::string& Get_default_temp_dir() const
00118 { return mTemp_path;}
00119
00120 bool AddPackagePathsAndWrite( const std::string& package_root_path );
00121
00122 private:
00123 ConfigurationFile();
00124 void InstallPath ();
00125 void Read(const std::string& fileName);
00126 void CreateConfigXML( char *rootDirectory );
00127 void InitializeDotBbtkStructure();
00128
00129 private :
00130 std::string mDescription;
00132 std::string mConfig_xml_full_path;
00133
00136 std::string mBin_path;
00138 std::string mDot_bbtk_path;
00140 std::string mInstall_path;
00142 std::string mDoc_path;
00144 std::string mTemp_path;
00146 std::string mBbs_rel_path;
00148 std::string mBbs_path;
00152 std::string mData_path;
00153
00155 std::string mFile_separator;
00156
00159 std::string mUrl;
00161 std::vector<std::string> mBbs_paths;
00163 std::vector<std::string> mPackage_paths;
00165 std::vector<std::string> mExt_dll_paths;
00166
00167
00170 bool mDot_bbtk_is_new;
00171 };
00172
00173
00174 }
00175
00176
00177
00178 #endif
00179