Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

resourceoption.h

Go to the documentation of this file.
00001 /*
00002         $Id: resourceoption.h,v 1.4 2001/03/04 17:54:47 mbn Exp $
00003 
00004         ------------------------------------------------------------------------
00005         ClanLib, the platform independent game SDK.
00006 
00007         This library is distributed under the GNU LIBRARY GENERAL PUBLIC LICENSE
00008         version 2. See COPYING for details.
00009 
00010         For a total list of contributers see CREDITS.
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

Generated at Wed Apr 4 19:54:03 2001 for ClanLib by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001