My Project
|
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 #pragma once 00029 #include "Define.h" 00030 00031 #include <map> 00032 #include "SystemHelper.h" 00033 00034 namespace SallyAPI 00035 { 00036 namespace System 00037 { 00046 00047 class DLL_API_SALLY COption 00048 { 00049 private: 00050 static std::string m_strDefaultFile; 00051 std::string m_strFile; 00052 std::map<std::string, std::string> m_PropertyCache; 00053 public: 00054 COption(const std::string& iniFile = ""); 00055 ~COption(); 00056 00057 int GetPropertyInt(const std::string& component, const std::string& id, int defaultValue = -1); 00058 std::string GetPropertyString(const std::string& component, const std::string& id, const std::string& defaultValue = ""); 00059 bool GetPropertyBool(const std::string& component, const std::string& id, bool defaultValue = false); 00060 00061 void SetPropertyInt(const std::string& component, const std::string& id, int value); 00062 void SetPropertyString(const std::string& component, const std::string& id, const std::string& value); 00063 void SetPropertyBool(const std::string& component, const std::string& id, bool value); 00064 00065 static int GetPropertyIntStatic(const std::string& component, const std::string& id, int defaultValue = -1, const std::string& iniFile = ""); 00066 static std::string GetPropertyStringStatic(const std::string& component, const std::string& id, const std::string& defaultValue = "", const std::string& iniFile = ""); 00067 static bool GetPropertyBoolStatic(const std::string& component, const std::string& id, bool defaultValue = false, const std::string& iniFile = ""); 00068 00069 static void SetPropertyIntStatic(const std::string& component, const std::string& id, int value, const std::string& iniFile); 00070 static void SetPropertyStringStatic(const std::string& component, const std::string& id, const std::string& value, const std::string& iniFile); 00071 static void SetPropertyBoolStatic(const std::string& component, const std::string& id, bool value, const std::string& iniFile); 00072 static void SetDefaultFile(const std::string& defaultFile); 00073 }; 00074 } 00075 }