Scopira  20080306
printflow.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_PRINTFLOW_H__
15 #define __INCLUDED_SCOPIRA_TOOL_PRINTFLOW_H__
16 
17 #include <scopira/tool/flow.h>
18 #include <scopira/tool/export.h>
19 #include <scopira/tool/export.h>
20 
21 namespace scopira
22 {
23  namespace tool
24  {
25  class printiflow;
26  class printoflow;
27 
29  SCOPIRA_EXPORT void flow_printf(oflow_i& o, const char* fmt, ...);
30  }
31 }
32 
43 {
44  protected:
46  static bool is_whitespace(byte_t b);
48  byte_t non_whitespace(void);
51 
52  public:
60  SCOPIRA_EXPORT printiflow(bool doref, iflow_i* in);
62  SCOPIRA_EXPORT virtual ~printiflow(void);
63 
65  SCOPIRA_EXPORT virtual bool failed(void) const;
66 
68  SCOPIRA_EXPORT virtual size_t read(byte_t* _buf, size_t _maxsize);
69 
70  // parsing routines
71 
72  SCOPIRA_EXPORT virtual bool read_bool(bool&);
73  SCOPIRA_EXPORT virtual bool read_char(char&);
74  SCOPIRA_EXPORT virtual bool read_short(short&);
75  SCOPIRA_EXPORT virtual bool read_int(int&);
76  SCOPIRA_EXPORT virtual bool read_size_t(size_t&);
77  SCOPIRA_EXPORT virtual bool read_int64_t(int64_t&);
78  SCOPIRA_EXPORT virtual bool read_long(long&);
79  SCOPIRA_EXPORT virtual bool read_float(float&);
80  SCOPIRA_EXPORT virtual bool read_double(double&);
81 
89  SCOPIRA_EXPORT virtual bool read_string(std::string&);
90 
92  SCOPIRA_EXPORT void open(iflow_i* in);
94  SCOPIRA_EXPORT void close(void);
95 
96  // extra routines
97 
104  SCOPIRA_EXPORT virtual bool read_string(std::string& ret, int _max);
105 
111  SCOPIRA_EXPORT bool read_string_word(std::string &ret);
112 };
113 
121 {
122  protected:
125 
126  public:
134  SCOPIRA_EXPORT printoflow(bool doref, oflow_i* in);
136  SCOPIRA_EXPORT virtual ~printoflow(void);
137 
139  SCOPIRA_EXPORT virtual bool failed(void) const;
140 
142  SCOPIRA_EXPORT virtual size_t write(const byte_t* _buf, size_t _size);
143 
144  SCOPIRA_EXPORT virtual void write_bool(bool val);
145  SCOPIRA_EXPORT virtual void write_char(char val);
146  SCOPIRA_EXPORT virtual void write_short(short val);
147  SCOPIRA_EXPORT virtual void write_int(int val);
148  SCOPIRA_EXPORT virtual void write_size_t(size_t val);
149  SCOPIRA_EXPORT virtual void write_int64_t(int64_t val);
150  SCOPIRA_EXPORT virtual void write_long(long val);
151  SCOPIRA_EXPORT virtual void write_float(float val);
152  SCOPIRA_EXPORT virtual void write_double(double val);
153  SCOPIRA_EXPORT virtual void write_string(const std::string& val);
154 
156  SCOPIRA_EXPORT void open(oflow_i* in);
158  SCOPIRA_EXPORT void close(void);
159 
161  SCOPIRA_EXPORT void printf(const char* fmt, ...);
162 };
163 
164 #endif
165 
virtual bool read_float(float &)
Definition: printflow.h:120
Definition: printflow.h:42
virtual bool read_size_t(size_t &)
Definition: flow.h:108
printiflow(bool doref, iflow_i *in)
scopira::tool::byte_t byte_t
Definition: flow.h:73
void close(void)
close the current link
virtual bool read_int(int &)
Definition: archiveflow.h:20
count2_ptr< oflow_i > dm_out
output link
Definition: printflow.h:124
Definition: flow.h:212
Definition: flow.h:281
Definition: object.h:43
byte_t non_whitespace(void)
advance stream to next non whitespace and return it
virtual size_t read(byte_t *_buf, size_t _maxsize)
read raw block data, returns num read in
virtual bool read_short(short &)
virtual bool read_char(char &)
void flow_printf(oflow_i &o, const char *fmt,...)
printf style
static bool is_whitespace(byte_t b)
is it whitespace?
count2_ptr< iflow_i > dm_in
input flow
Definition: printflow.h:50
virtual ~printiflow(void)
destructor
virtual bool read_int64_t(int64_t &)
virtual bool read_string(std::string &)
virtual bool read_double(double &)
virtual bool read_long(long &)
virtual bool failed(void) const
are we in a failed state?
bool read_string_word(std::string &ret)
virtual bool read_bool(bool &)
void open(iflow_i *in)
opens a new link
Definition: flow.h:159