jaula API Reference version 1.4.0
jaula_value.h
00001 
00002 /*
00003  * jaula_value.h : JSON Analysis User Library Acronym
00004  * Generic values definitions
00005  *
00006  * Copyright (C) 2007, 2008, 2009 Kombo Morongo <morongo666@gmail.com>
00007  *
00008  * This library is free software; you can redistribute it and/or modify it
00009  * under the terms of the GNU Lesser General Public License as published by
00010  * the Free Software Foundation; either version 2.1 of the License, or (at
00011  * your option) any later version.
00012  *
00013  * This library is distributed in the hope that it will be useful, but
00014  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
00015  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
00016  * License for more details.
00017  *
00018  * You should have received a copy of the GNU Lesser General Public License
00019  * along with this library; if not, write to the Free Software Foundation,
00020  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
00021  *
00022  * svn info:
00023  * $Author: morongo $
00024  * $HeadURL: https://jaula.svn.sourceforge.net/svnroot/jaula/tags/jaula-1.4.0/jaula/jaula_value.h $
00025  * $Id: jaula_value.h 45 2009-01-11 16:17:03Z morongo $
00026  * $Revision: 45 $
00027  */
00028 
00029 #ifndef _JAULA_VALUE_H_
00030 #define _JAULA_VALUE_H_
00031 
00032 #include <jaula/jaula_bad_data_type.h>
00033 
00038 namespace JAULA
00039 {                                // namespace JAULA
00040 
00052   class Value
00053   {                              // class Value
00054     public:
00055 
00059       enum    ValueType
00060       {                          // enum ValueType
00062         TYPE_NULL
00064         ,   TYPE_BOOLEAN
00066         ,   TYPE_STRING
00068         ,   TYPE_NUMBER
00070         ,   TYPE_NUMBER_INT
00072         ,   TYPE_ARRAY
00074         ,   TYPE_OBJECT
00075       };                         // enum ValueType
00076 
00080       virtual ~Value();
00081 
00089       ValueType getType(void) const;
00090 
00099       virtual void repr(std::ostream &ostr) const = 0;
00100 
00110       virtual void set(Value const &origin) throw(Bad_Data_Type);
00111 
00130       Value &operator=(Value const &orig) throw(Bad_Data_Type);
00131 
00145       static Value *duplicate(Value const &orig);
00146 
00147     protected:
00148 
00161       Value(ValueType Type);
00162 
00163     private:
00164 
00168       ValueType  Type_;
00169   };                             // class Value
00170 
00171 }                                // namespace JAULA
00172 
00173 
00192 std::ostream &operator<<(std::ostream &ostr, JAULA::Value const &val);
00193 #endif
00194 
00195 // EOF $Id: jaula_value.h 45 2009-01-11 16:17:03Z morongo $