00001 /* 00002 ot_lib - Object Type Library 00003 Copyright (C) 2002 Alessandro Bonfanti 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public 00016 License along with this library; if not, write to the Free 00017 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 00019 Alessandro Bonfanti 00020 xjbon@tin.it 00021 */ 00022 00023 00024 #ifndef OT_ENUM_FIELD_LIST_H 00025 #define OT_ENUM_FIELD_LIST_H 00026 00027 class OT_ENUM_FIELD_LIST : public ot_obj 00028 { 00029 00030 private: 00031 00032 map<string,OT_ENUM_FIELD> m_fields; 00033 00034 OT_ENUM_FIELD_LIST(void); 00035 00036 static bool checkIntegrity(const OT_ENUM_FIELD_LIST &r,const string &filename,int line); 00037 00038 void deleteSelection(void); 00039 00040 public: 00041 00042 00043 // ######################################### 00044 // CONSTRUCTORS & DESTRUCTOR 00045 // ######################################### 00046 00047 OT_ENUM_FIELD_LIST(const OT_ENUM_FIELD &f); 00048 OT_ENUM_FIELD_LIST(const OT_ENUM_FIELD_LIST &r); 00049 00050 00051 // ######################################### 00052 // IMPLEMENTATIONS OF THE VIRTUAL FUNCTIONS 00053 // ######################################### 00054 00055 ot_obj *dup(void) const; 00056 void asXml(ostream &s,int i) const; 00057 bool asData(ostream &s) const; 00058 static OT_ENUM_FIELD_LIST * fromData(istream &s); 00059 00060 00061 // ######################################### 00062 // PROPIETARY FUNCTIONS 00063 // ######################################### 00064 00065 bool set(const string &str); 00066 bool set(int val); 00067 string getSelectedString(void) const; 00068 int getSelectedInt(void) const; 00069 OT_ENUM_FIELD getSelected(void) const; 00070 00071 00072 // ######################################### 00073 // MATH OPERATOR 00074 // ######################################### 00075 00076 OT_ENUM_FIELD_LIST operator + (const OT_ENUM_FIELD_LIST &r) const; 00077 00078 OT_ENUM_FIELD_LIST operator + (const OT_ENUM_FIELD &r) const; 00079 00080 OT_ENUM_FIELD_LIST operator = (const OT_ENUM_FIELD_LIST &r); 00081 00082 void operator += (const OT_ENUM_FIELD &r); 00083 00084 bool operator == (const OT_ENUM_FIELD_LIST &r) const; 00085 00087 bool operator == (const ot_obj *o) const 00088 { 00089 if(o && o->getType()==getType()) return(*this==*((OT_ENUM_FIELD_LIST *) o)); 00090 else return(false); 00091 } 00092 00093 }; 00094 00095 #endif