Scopira  20080306
propflow.h
1 
2 /*
3  * Copyright (c) 2002 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_PROPFLOW_H__
15 #define __INCLUDED_SCOPIRA_TOOL_PROPFLOW_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 commentiflow;
25 
26  class propiflow;
27  class propoflow;
28  class property;
29  }
30 }
31 
32 //
33 // rightnow it can read from a custom and custom-old
34 // text format.
35 // future file formats include: XML, Win32 registry
36 //
37 
44 {
45  protected:
48  bool dm_atzero;
49 
50  public:
52  commentiflow(bool doref, iflow_i* in);
53 
55  virtual bool failed(void) const;
56 
58  virtual size_t read(byte_t* _buf, size_t _maxsize);
60  virtual size_t read_byte(byte_t &out);
61 
63  void open(iflow_i* in);
65  void close(void);
66 };
67 
75 {
76  protected:
78  static bool is_whitespace(byte_t b);
80  byte_t non_whitespace(void);
81 
84 
85  public:
93  SCOPIRA_EXPORT propiflow(bool doref, iflow_i* in);
95  SCOPIRA_EXPORT virtual ~propiflow(void);
96 
98  SCOPIRA_EXPORT virtual bool failed(void) const;
99 
101  SCOPIRA_EXPORT virtual size_t read(byte_t* _buf, size_t _maxsize);
102 
103  SCOPIRA_EXPORT virtual bool read_bool(bool&);
104  SCOPIRA_EXPORT virtual bool read_char(char&);
105  SCOPIRA_EXPORT virtual bool read_short(short&);
106  SCOPIRA_EXPORT virtual bool read_int(int&);
107  SCOPIRA_EXPORT virtual bool read_size_t(size_t&);
108  SCOPIRA_EXPORT virtual bool read_int64_t(int64_t&);
109  SCOPIRA_EXPORT virtual bool read_long(long&);
110  SCOPIRA_EXPORT virtual bool read_float(float&);
111  SCOPIRA_EXPORT virtual bool read_double(double&);
112  SCOPIRA_EXPORT virtual bool read_string(std::string&);
113 
115  SCOPIRA_EXPORT virtual bool read_object(object* &out);
116 
125  SCOPIRA_EXPORT bool read_keyword(std::string& ret, bool& keyword);
126 
128  SCOPIRA_EXPORT void open(iflow_i* in);
130  SCOPIRA_EXPORT void close(void);
131 
134  bool read_property(property* rp, int level = 0);
135 };
136 
144 {
145  protected:
148 
149  public:
157  SCOPIRA_EXPORT propoflow(bool doref, oflow_i* out);
159  SCOPIRA_EXPORT virtual ~propoflow(void);
160 
162  SCOPIRA_EXPORT virtual bool failed(void) const;
163 
165  SCOPIRA_EXPORT virtual size_t write(const byte_t* _buf, size_t _size);
166 
167  SCOPIRA_EXPORT virtual void write_bool(bool val);
168  SCOPIRA_EXPORT virtual void write_char(char val);
169  SCOPIRA_EXPORT virtual void write_short(short val);
170  SCOPIRA_EXPORT virtual void write_int(int val);
171  SCOPIRA_EXPORT virtual void write_size_t(size_t val);
172  SCOPIRA_EXPORT virtual void write_int64_t(int64_t val);
173  SCOPIRA_EXPORT virtual void write_long(long val);
174  SCOPIRA_EXPORT virtual void write_float(float val);
175  SCOPIRA_EXPORT virtual void write_double(double val);
176  SCOPIRA_EXPORT virtual void write_string(const std::string& val);
177 
179  SCOPIRA_EXPORT virtual void write_object(const scopira::tool::object* o);
180 
182  SCOPIRA_EXPORT void write_keyword(const std::string& i);
184  SCOPIRA_EXPORT void write_indent(int n);
185 
187  SCOPIRA_EXPORT void open(oflow_i* out);
189  SCOPIRA_EXPORT void close(void);
190 
192  SCOPIRA_EXPORT void write_property(property* rp, int indent = 0);
193 };
194 
195 #endif
196 
Definition: flow.h:108
commentiflow(bool doref, iflow_i *in)
ctor
scopira::tool::byte_t byte_t
Definition: flow.h:73
Definition: archiveflow.h:20
count2_ptr< iflow_i > dm_in
input flow
Definition: propflow.h:83
Definition: propflow.h:74
Definition: object.h:43
Definition: flow.h:352
void close(void)
close the current link
Definition: object.h:71
virtual size_t read(byte_t *_buf, size_t _maxsize)
read raw block data, returns num read in
count2_ptr< oflow_i > dm_out
output link
Definition: propflow.h:147
Definition: propflow.h:43
Definition: prop.h:38
Definition: flow.h:421
count2_ptr< iflow_i > dm_in
input flow
Definition: propflow.h:47
virtual size_t read_byte(byte_t &out)
read one byte
virtual bool failed(void) const
are we in a failed state?
void open(iflow_i *in)
opens a new link
Definition: propflow.h:143
Definition: flow.h:159