00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00016
00017 #ifndef header_resourceoption
00018 #define header_resourceoption
00019
00020 #include <list>
00021 #include <string>
00022
00023 class CL_ResourceOption
00024 {
00025 public:
00026 CL_ResourceOption(std::string _name, std::string _value)
00027 {
00028 name = _name;
00029 value = _value;
00030 has_value = true;
00031 multiple_values = false;
00032 values = NULL;
00033 }
00034
00035 CL_ResourceOption(std::string _name, std::list<std::string> *_values)
00036 {
00037 name = _name;
00038 values = _values;
00039 value = (values->empty() == false) ? (values->front()) : std::string("");
00040 multiple_values = true;
00041 has_value = true;
00042 }
00043
00044 CL_ResourceOption(std::string _name)
00045 {
00046 name = _name;
00047 has_value = false;
00048 multiple_values = false;
00049 values = NULL;
00050 }
00051
00052 virtual ~CL_ResourceOption()
00053 {
00054 if (values != NULL) delete values;
00055 }
00056
00057 bool multi_valued() { return multiple_values; }
00058 std::list<std::string> *get_all_values() { return values; }
00059
00060 std::string get_name() { return name; }
00061 std::string get_value()
00062 {
00063 if (has_value) return value;
00064 else return std::string("NO VALUE");
00065 }
00066
00067 private:
00068 std::string name;
00069 std::string value;
00070 std::list<std::string> *values;
00071 bool has_value;
00072 bool multiple_values;
00073 };
00074
00075 #endif