Scopira  20080306
textflow.h
1 
2 /*
3  * Copyright (c) 2002-2007 National Research Council
4  *
5  * All rights reserved.
6  *
7  * This material is confidential and proprietary information of
8  * National Research Council Canada ("Confidential Information").
9  * This Confidential Information may only be used and reproduced
10  * in accordance with the terms of the license agreement.
11  *
12  */
13 
14 #ifndef __INCLUDED_SCOPIRA_TOOL_TEXTFLOW_H__
15 #define __INCLUDED_SCOPIRA_TOOL_TEXTFLOW_H__
16 
17 #include <scopira/tool/flow.h>
18 #include <scopira/tool/export.h>
19 
20 namespace scopira
21 {
22  namespace tool
23  {
24  class textiflow;
25  class textoflow;
26  }
27 }
28 
35 {
36  protected:
38  static bool is_whitespace(byte_t b);
40  byte_t non_whitespace(void);
41 
44 
45  public:
53  SCOPIRA_EXPORT textiflow(bool doref, iflow_i* in);
55  SCOPIRA_EXPORT virtual ~textiflow(void);
56 
58  SCOPIRA_EXPORT virtual bool failed(void) const;
59 
61  SCOPIRA_EXPORT virtual size_t read(byte_t* _buf, size_t _maxsize);
62 
63  SCOPIRA_EXPORT virtual bool read_bool(bool&);
64  SCOPIRA_EXPORT virtual bool read_char(char&);
65  SCOPIRA_EXPORT virtual bool read_short(short&);
66  SCOPIRA_EXPORT virtual bool read_int(int&);
67  SCOPIRA_EXPORT virtual bool read_size_t(size_t&);
68  SCOPIRA_EXPORT virtual bool read_int64_t(int64_t&);
69  SCOPIRA_EXPORT virtual bool read_long(long&);
70  SCOPIRA_EXPORT virtual bool read_float(float&);
71  SCOPIRA_EXPORT virtual bool read_double(double&);
72  SCOPIRA_EXPORT virtual bool read_string(std::string&);
73 
75  SCOPIRA_EXPORT void open(iflow_i* in);
77  SCOPIRA_EXPORT void close(void);
78 };
79 
87 {
88  protected:
91 
92  public:
100  SCOPIRA_EXPORT textoflow(bool doref, oflow_i* out);
102  SCOPIRA_EXPORT virtual ~textoflow(void);
103 
105  SCOPIRA_EXPORT virtual bool failed(void) const;
106 
108  SCOPIRA_EXPORT virtual size_t write(const byte_t* _buf, size_t _size);
109 
110  SCOPIRA_EXPORT virtual void write_bool(bool val);
111  SCOPIRA_EXPORT virtual void write_char(char val);
112  SCOPIRA_EXPORT virtual void write_short(short val);
113  SCOPIRA_EXPORT virtual void write_int(int val);
114  SCOPIRA_EXPORT virtual void write_size_t(size_t val);
115  SCOPIRA_EXPORT virtual void write_int64_t(int64_t val);
116  SCOPIRA_EXPORT virtual void write_long(long val);
117  SCOPIRA_EXPORT virtual void write_float(float val);
118  SCOPIRA_EXPORT virtual void write_double(double val);
119  SCOPIRA_EXPORT virtual void write_string(const std::string& val);
120 
122  SCOPIRA_EXPORT void open(oflow_i* out);
124  SCOPIRA_EXPORT void close(void);
125 };
126 
127 #endif
128 
Definition: flow.h:108
virtual bool read_long(long &)
virtual size_t read(byte_t *_buf, size_t _maxsize)
read raw block data, returns num read in
virtual bool read_int64_t(int64_t &)
void close(void)
close the current link
scopira::tool::byte_t byte_t
Definition: flow.h:73
Definition: archiveflow.h:20
count2_ptr< iflow_i > dm_in
input flow
Definition: textflow.h:43
Definition: flow.h:212
virtual bool read_bool(bool &)
Definition: flow.h:281
Definition: object.h:43
virtual bool read_float(float &)
virtual bool failed(void) const
are we in a failed state?
virtual bool read_size_t(size_t &)
Definition: textflow.h:34
count2_ptr< oflow_i > dm_out
output link
Definition: textflow.h:90
virtual bool read_string(std::string &)
static bool is_whitespace(byte_t b)
is it whitespace?
virtual ~textiflow(void)
destructor
virtual bool read_short(short &)
void open(iflow_i *in)
opens a new link
byte_t non_whitespace(void)
advance stream to next non whitespace and return it
textiflow(bool doref, iflow_i *in)
virtual bool read_char(char &)
Definition: textflow.h:86
virtual bool read_int(int &)
virtual bool read_double(double &)
Definition: flow.h:159