Main Page Class Hierarchy Compound List File List Compound Members Related Pages

# state_text.h

    00001 //
    00002 // state_text.h
    00003 //
    00004 // Copyright (C) 1996 Limit Point Systems, Inc.
    00005 //
    00006 // Author: Curtis Janssen <cljanss@limitpt.com>
    00007 // Maintainer: LPS
    00008 //
    00009 // This file is part of the SC Toolkit.
    00010 //
    00011 // The SC Toolkit is free software; you can redistribute it and/or modify
    00012 // it under the terms of the GNU Library General Public License as published by
    00013 // the Free Software Foundation; either version 2, or (at your option)
    00014 // any later version.
    00015 //
    00016 // The SC Toolkit is distributed in the hope that it will be useful,
    00017 // but WITHOUT ANY WARRANTY; without even the implied warranty of
    00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00019 // GNU Library General Public License for more details.
    00020 //
    00021 // You should have received a copy of the GNU Library General Public License
    00022 // along with the SC Toolkit; see the file COPYING.LIB.  If not, write to
    00023 // the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
    00024 //
    00025 // The U.S. Government is granted a limited license as per AL 91-7.
    00026 //
    00027
    00028 #ifndef _util_state_state_text_h
    00029 #define _util_state_state_text_h
    00030
    00031 #ifdef __GNUC__
    00032 #pragma interface
    00033 #endif
    00034
    00035 #include <util/state/state_file.h>
    00036
    00037 namespace sc {
    00038
    00044 class StateOutText: public StateOutFile {
    00045   private:
    00046     // do not allow copy constructor or assignment
    00047     StateOutText(const StateOutText&);
    00048     void operator=(const StateOutText&);
    00049   protected:
    00050     int no_newline_;
    00051     int no_array_;
    00052     void no_newline();
    00053     void no_array();
    00054     void newline();
    00055     void start_array();
    00056     void end_array();
    00057     int putobject(const Ref<SavableState> &);
    00058     int putparents(const ClassDesc*);
    00059   public:
    00060     StateOutText();
    00061     StateOutText(std::ostream& s);
    00062     StateOutText(const char *);
    00063     ~StateOutText();
    00064     int putstring(const char*);
    00065     int put_array_char(const char*,int);
    00066     int put_array_uint(const unsigned int*,int);
    00067     int put_array_int(const int*,int);
    00068     int put_array_float(const float*,int);
    00069     int put_array_double(const double*,int);
    00070     int put(const ClassDesc*);
    00071     int put(char r);
    00072     int put(unsigned int r);
    00073     int put(int r);
    00074     int put(float r);
    00075     int put(double r);
    00076     int put(const char*,int);
    00077     int put(const unsigned int*,int);
    00078     int put(const int*,int);
    00079     int put(const float*,int);
    00080     int put(const double*,int);
    00081   };
    00082
    00085 class StateInText: public StateInFile {
    00086   private:
    00087     // do not allow copy constructor or assignment
    00088     StateInText(const StateInText&);
    00089     void operator=(const StateInText&);
    00090   protected:
    00091     int newlines_;
    00092     int no_newline_;
    00093     int no_array_;
    00094     void no_newline();
    00095     void no_array();
    00096
    00097     int read(char*);
    00098     int read(unsigned int&);
    00099     int read(int&);
    00100     int read(float&);
    00101     int read(double&);
    00102     void newline();
    00103     void start_array();
    00104     void end_array();
    00105     int  getobject(Ref<SavableState> &);
    00106
    00107     void abort();
    00108   public:
    00109     StateInText();
    00110     StateInText(std::istream& s);
    00111     StateInText(const char *);
    00112     StateInText(const Ref<KeyVal> &);
    00113     ~StateInText();
    00114     int getstring(char*&);
    00115     int get_array_char(char*,int);
    00116     int get_array_uint(unsigned int*,int);
    00117     int get_array_int(int*,int);
    00118     int get_array_float(float*,int);
    00119     int get_array_double(double*,int);
    00120     int get(const ClassDesc**);
    00121     int get(char&r, const char *key = 0);
    00122     int get(unsigned int&r, const char *key = 0);
    00123     int get(int&r, const char *key = 0);
    00124     int get(float&r, const char *key = 0);
    00125     int get(double&r, const char *key = 0);
    00126     int get(char*&);
    00127     int get(unsigned int*&);
    00128     int get(int*&);
    00129     int get(float*&);
    00130     int get(double*&);
    00131   };
    00132
    00133 }
    00134
    00135 #endif
    00136
    00137 // Local Variables:
    00138 // mode: c++
    00139 // c-file-style: "CLJ"
    00140 // End: