iolegacy.h

Go to the documentation of this file.
00001 
00004 
00005 //
00006 // Copyright (c) 2000-2004 California Institute of Technology
00007 // Copyright (c) 2004-2007 University of Southern California
00008 // Rob Peters <rjpeters at usc dot edu>
00009 //
00010 // created: Tue Sep 26 18:47:31 2000
00011 // commit: $Id: iolegacy.h 10065 2007-04-12 05:54:56Z rjpeters $
00012 // $HeadURL: file:///lab/rjpeters/svnrepo/code/trunk/groovx/src/io/iolegacy.h $
00013 //
00014 // --------------------------------------------------------------------
00015 //
00016 // This file is part of GroovX.
00017 //   [http://ilab.usc.edu/rjpeters/groovx/]
00018 //
00019 // GroovX is free software; you can redistribute it and/or modify it
00020 // under the terms of the GNU General Public License as published by
00021 // the Free Software Foundation; either version 2 of the License, or
00022 // (at your option) any later version.
00023 //
00024 // GroovX is distributed in the hope that it will be useful, but
00025 // WITHOUT ANY WARRANTY; without even the implied warranty of
00026 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00027 // General Public License for more details.
00028 //
00029 // You should have received a copy of the GNU General Public License
00030 // along with GroovX; if not, write to the Free Software Foundation,
00031 // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
00032 //
00034 
00035 #ifndef GROOVX_IO_IOLEGACY_H_UTC20050626084021_DEFINED
00036 #define GROOVX_IO_IOLEGACY_H_UTC20050626084021_DEFINED
00037 
00038 #include "io/io.h"
00039 #include "io/reader.h"
00040 #include "io/writer.h"
00041 
00042 #include <iosfwd>
00043 
00044 namespace io
00045 {
00046   class legacy_reader;
00047   class legacy_writer;
00048 }
00049 
00050 // ########################################################
00051 
00053 
00054 class io::legacy_reader : public io::reader
00055 {
00056 public:
00057   legacy_reader(std::istream& is);
00058   virtual ~legacy_reader() throw();
00059 
00060   virtual io::version_id input_version_id();
00061 
00062   virtual char read_char(const rutz::fstring& name);
00063   virtual int read_int(const rutz::fstring& name);
00064   virtual bool read_bool(const rutz::fstring& name);
00065   virtual double read_double(const rutz::fstring& name);
00066   virtual void read_value_obj(const rutz::fstring& name, rutz::value& v);
00067 
00068   virtual void read_byte_array(const rutz::fstring& name, rutz::byte_array& data)
00069   { default_read_byte_array(name, data); }
00070 
00071   virtual nub::ref    <io::serializable>      read_object(const rutz::fstring& name);
00072   virtual nub::soft_ref<io::serializable> read_weak_object(const rutz::fstring& name);
00073 
00074   virtual void read_owned_object(const rutz::fstring& name,
00075                                nub::ref<io::serializable> obj);
00076 
00077   virtual void read_base_class(const rutz::fstring& base_class_name,
00078                                nub::ref<io::serializable> base_part);
00079 
00080   virtual nub::ref<io::serializable> read_root(io::serializable* root=0);
00081 
00082 protected:
00083   virtual rutz::fstring read_string_impl(const rutz::fstring& name);
00084 
00085 private:
00086   legacy_reader(const legacy_reader&);
00087   legacy_reader& operator=(const legacy_reader&);
00088 
00089   class impl;
00090   friend class impl;
00091 
00092   impl* const rep;
00093 };
00094 
00095 
00096 // ########################################################
00097 
00099 
00100 class io::legacy_writer : public io::writer
00101 {
00102 public:
00103   legacy_writer(std::ostream& os, bool write_bases=true);
00104   virtual ~legacy_writer() throw();
00105 
00106   void use_pretty_print(bool yes=true);
00107 
00108   virtual void write_char(const char* name, char val);
00109   virtual void write_int(const char* name, int val);
00110   virtual void write_bool(const char* name, bool val);
00111   virtual void write_double(const char* name, double val);
00112   virtual void write_value_obj(const char* name, const rutz::value& v);
00113 
00114   virtual void write_byte_array(const char* name,
00115                             const unsigned char* data,
00116                             unsigned int length);
00117 
00118   virtual void write_object(const char* name,
00119                            nub::soft_ref<const io::serializable> obj);
00120 
00121   virtual void write_owned_object(const char* name,
00122                                 nub::ref<const io::serializable> obj);
00123 
00124   virtual void write_base_class(const char* base_class_name,
00125                                 nub::ref<const io::serializable> base_part);
00126 
00127   virtual void write_root(const io::serializable* root);
00128 
00129 protected:
00130   virtual void write_cstring(const char* name, const char* val);
00131 
00132 private:
00133   legacy_writer(const legacy_writer&);
00134   legacy_writer& operator=(const legacy_writer&);
00135 
00136   class impl;
00137   friend class impl;
00138 
00139   impl* const rep;
00140 };
00141 
00142 static const char __attribute__((used)) vcid_groovx_io_iolegacy_h_utc20050626084021[] = "$Id: iolegacy.h 10065 2007-04-12 05:54:56Z rjpeters $ $HeadURL: file:
00143 #endif // !GROOVX_IO_IOLEGACY_H_UTC20050626084021_DEFINED

The software described here is Copyright (c) 1998-2005, Rob Peters.
This page was generated Wed Dec 3 06:49:39 2008 by Doxygen version 1.5.5.