value.h

00001 /* 
00002  * Gnome Chemistry Utils
00003  * value.h 
00004  *
00005  * Copyright (C) 2002-2006 Jean Bréfort <jean.brefort@normalesup.org>
00006  *
00007  * This program is free software; you can redistribute it and/or 
00008  * modify it under the terms of the GNU General Public License as 
00009  * published by the Free Software Foundation; either version 2 of the
00010  * License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
00020  * USA
00021  */
00022 
00023 #ifndef GCU_VALUE_H
00024 #define GCU_VALUE_H
00025 
00026 #include "chemistry.h"
00027 #include <string>
00028 #include <map>
00029 
00030 using namespace std;
00031 
00032 namespace gcu
00033 {
00034 
00038 class Value
00039 {
00040 public:
00044         Value ();
00048         virtual ~Value ();
00049 
00053         virtual char const *GetAsString () const;
00054 
00058         virtual double GetAsDouble () const;
00059 };
00060 
00064 class SimpleValue: public Value
00065 {
00066 friend class Element;
00067 
00068 public:
00072         SimpleValue ();
00076         virtual ~SimpleValue ();
00077 
00081         char const *GetAsString () const;
00085         double GetAsDouble () const;
00089         GcuValue const GetValue () const {return val;}
00090 
00091 private:
00092         GcuValue val;
00093         string str;
00094 };
00099 class DimensionalValue: public Value
00100 {
00101 friend class Element;
00102 
00103 public:
00107         DimensionalValue ();
00111         virtual ~DimensionalValue ();
00112 
00116         char const *GetAsString () const;
00120         double GetAsDouble () const;
00124         GcuDimensionalValue const GetValue () {return val;}
00125 
00126 private:
00127         GcuDimensionalValue val;
00128          string str;
00129 };
00130 
00134 class StringValue: public Value
00135 {
00136 friend class Element;
00137 
00138 public:
00142         StringValue ();
00146         virtual ~StringValue ();
00147 
00151         char const *GetAsString () const;
00152 
00153 private:
00154         string val;
00155 };
00156 
00160 class LocalizedStringValue: public Value
00161 {
00162 friend class Element;
00163 
00164 public:
00168         LocalizedStringValue ();
00172         virtual ~LocalizedStringValue ();
00173 
00178         char const *GetAsString () const;
00184         char const *GetLocalizedString (char const *lang) const;
00185 
00186 private:
00187         map <string, string> vals;
00188 };
00189 
00190 }       // namespace gcu
00191 
00192 #endif  //      GCU_VALUE_H

Generated on Wed Mar 19 19:27:25 2008 for The Gnome Chemistry Utils by  doxygen 1.5.5