00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef _dgChannel_h_
00027 #define _dgChannel_h_
00028
00035 #include <iostream>
00036 #include <string>
00037
00038 #include "dgChannelBuf.h"
00039
00040 namespace DGD {
00041
00140 class channel: public std::ostream {
00141 public:
00142 typedef std::ostream Parent;
00143
00144 public:
00145 channel( const std::string& name );
00146 void open();
00147 void close();
00148 bool is_open() const;
00149 operator bool () const;
00150 const std::string& name() const;
00151 channelbuf* rdbuf() const;
00152 channelbuf& rdbuf();
00153
00154 void indent_step( unsigned int step );
00155 unsigned int indent_step() const;
00156 void incr_indent();
00157 void decr_indent();
00158 void indent( unsigned int val );
00159 unsigned int indent() const;
00160
00161 void min_width( unsigned int width );
00162 unsigned int min_width() const;
00163 void max_width( unsigned int width );
00164 unsigned int max_width() const;
00165
00166 void wrap( bool allow );
00167 bool wrap() const;
00168 void word_wrap( bool allow );
00169 bool word_wrap() const;
00170
00171 void space_chars(const char* spc = " \t");
00172 std::string space_chars() const;
00173
00174 virtual void header();
00175
00176 private:
00177 bool m_is_open;
00178 std::string m_name;
00179 channelbuf m_buffer;
00180 channelbuf m_tmp_buffer;
00181 };
00182
00183 enum Assoc_type {
00184 Assoc_Append = 0,
00185 Assoc_Assign,
00186 Assoc_Prepend,
00187 Assoc_Delete
00188 };
00189
00190 void assoc( std::ostream* s, channel& channel,
00191 const Assoc_type action = Assoc_Append );
00192 void assoc( std::ostream& s, channel& channel,
00193 const Assoc_type action = Assoc_Append );
00194
00195 #ifndef DGD_WITHOUT_BOOST
00196 void assoc( std::ostream* s, const std::string& name,
00197 const Assoc_type action = Assoc_Append );
00198 #endif // DGD_WITHOUT_BOOST
00199
00200 };
00201
00202 #endif
00203
00204
00205
00206
00207
00208
00209
00210