Scopira 20080306

textflow.h

00001 
00002 /*
00003  *  Copyright (c) 2002-2007    National Research Council
00004  *
00005  *  All rights reserved.
00006  *
00007  *  This material is confidential and proprietary information of
00008  *  National Research Council Canada ("Confidential Information").
00009  *  This Confidential Information may only be used and reproduced
00010  *  in accordance with the terms of the license agreement.
00011  *
00012  */
00013  
00014 #ifndef __INCLUDED_SCOPIRA_TOOL_TEXTFLOW_H__
00015 #define __INCLUDED_SCOPIRA_TOOL_TEXTFLOW_H__
00016 
00017 #include <scopira/tool/flow.h>
00018 #include <scopira/tool/export.h>
00019 
00020 namespace scopira
00021 {
00022   namespace tool
00023   {
00024     class textiflow;
00025     class textoflow;
00026   }
00027 }
00028 
00034 class scopira::tool::textiflow : public scopira::tool::itflow_i
00035 {
00036   protected:
00038     static bool is_whitespace(byte_t b);
00040     byte_t non_whitespace(void);
00041 
00043     count2_ptr< iflow_i > dm_in;
00044     
00045   public:
00053     SCOPIRA_EXPORT textiflow(bool doref, iflow_i* in);
00055     SCOPIRA_EXPORT virtual ~textiflow(void);
00056 
00058     SCOPIRA_EXPORT virtual bool failed(void) const;
00059 
00061     SCOPIRA_EXPORT virtual size_t read(byte_t* _buf, size_t _maxsize);
00062 
00063     SCOPIRA_EXPORT virtual bool read_bool(bool&);
00064     SCOPIRA_EXPORT virtual bool read_char(char&);
00065     SCOPIRA_EXPORT virtual bool read_short(short&);
00066     SCOPIRA_EXPORT virtual bool read_int(int&);
00067     SCOPIRA_EXPORT virtual bool read_size_t(size_t&);
00068     SCOPIRA_EXPORT virtual bool read_int64_t(int64_t&);
00069     SCOPIRA_EXPORT virtual bool read_long(long&);
00070     SCOPIRA_EXPORT virtual bool read_float(float&);
00071     SCOPIRA_EXPORT virtual bool read_double(double&);
00072     SCOPIRA_EXPORT virtual bool read_string(std::string&);
00073 
00075     SCOPIRA_EXPORT void open(iflow_i* in);
00077     SCOPIRA_EXPORT void close(void);
00078 };
00079 
00086 class scopira::tool::textoflow : public scopira::tool::otflow_i
00087 {
00088   protected:
00090     count2_ptr< oflow_i > dm_out;
00091 
00092   public:
00100     SCOPIRA_EXPORT textoflow(bool doref, oflow_i* out);
00102     SCOPIRA_EXPORT virtual ~textoflow(void);
00103       
00105     SCOPIRA_EXPORT virtual bool failed(void) const;
00106 
00108     SCOPIRA_EXPORT virtual size_t write(const byte_t* _buf, size_t _size);
00109 
00110     SCOPIRA_EXPORT virtual void write_bool(bool val);
00111     SCOPIRA_EXPORT virtual void write_char(char val);
00112     SCOPIRA_EXPORT virtual void write_short(short val);
00113     SCOPIRA_EXPORT virtual void write_int(int val);
00114     SCOPIRA_EXPORT virtual void write_size_t(size_t val);
00115     SCOPIRA_EXPORT virtual void write_int64_t(int64_t val);
00116     SCOPIRA_EXPORT virtual void write_long(long val);
00117     SCOPIRA_EXPORT virtual void write_float(float val);
00118     SCOPIRA_EXPORT virtual void write_double(double val);
00119     SCOPIRA_EXPORT virtual void write_string(const std::string& val);
00120 
00122     SCOPIRA_EXPORT void open(oflow_i* out);
00124     SCOPIRA_EXPORT void close(void);
00125 };
00126 
00127 #endif
00128