DGD Library
Version: 0.1.0.14 | Updated: Thu Aug 10 16:58:28 2006
Home
DGD News
FAQ
Code Documentation
DGD Installation Guide
Bugs-n-Features
DGD at Sourceforge.net
Download DGD
Subversion
Code Documentation
Documentation
Namespaces
Class Hierarchy
Class List
File List
Namespace Members
Functions
Globals
Tutorial
Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

dgChannelManip.h

Go to the documentation of this file.
00001 // -*- c++ -*-
00002 //
00003 // $Id$
00004 //
00005 // This program is free software; you can redistribute it and/or modify
00006 // it under the terms of the GNU General Public License as published by
00007 // the Free Software Foundation; either version 2 of the License, or
00008 // (at your option) any later version.
00009 //
00010 // This program is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU General Public License
00016 // along with this program; if not, write to the Free Software
00017 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 //
00019 // This file is part of Depression Glass library.
00020 //
00021 // Copyright (c) 2002. Dimitry Kloper <kloper@users.sf.net> . 
00022 //
00023 // dgChannelManip.h -- manipulators for the channel
00024 //
00025 
00026 #ifndef _dgChannelManip_h_
00027 #define _dgChannelManip_h_
00028 
00035 #include "dgChannel.h"
00036 
00037 namespace DGD {
00038 
00049 template <class Arg_type>
00050 class channel_manip {
00051    public:
00052       typedef void (channel::*method_type)( Arg_type );
00053    public:
00054       method_type m_method;
00055       Arg_type    m_argument;
00056       
00057       explicit channel_manip( method_type method, Arg_type arg ):
00058          m_method(method), m_argument(arg) {}
00059 };
00060 
00069 class channel_manip_void {
00070    public:
00071       typedef void (channel::*method_type)();
00072 
00073    public:
00074       method_type m_method;
00075 
00076       explicit channel_manip_void( method_type m ):
00077          m_method(m) {}
00078 };
00079 
00089 class channel_manip_nop {
00090    public:
00091       channel_manip_nop() {}
00092 };
00093 
00097 typedef channel_manip<bool> channel_manip_bool;
00098 
00102 typedef channel_manip<unsigned int>  channel_manip_uint;
00103 
00107 inline std::ostream& operator <<( std::ostream& cnl, 
00108                                   const channel_manip_void& manip ) {
00109    
00110    (dynamic_cast<channel&>(cnl).*(manip.m_method))();
00111    return cnl;
00112 }
00113 
00117 inline std::ostream& operator <<( std::ostream& cnl, 
00118                                   const channel_manip_bool& manip ) {
00119    (dynamic_cast<channel&>(cnl).*(manip.m_method))( manip.m_argument );
00120    return cnl;
00121 }
00122 
00126 inline std::ostream& operator <<( std::ostream& cnl, 
00127                                   const channel_manip_uint& manip ) {
00128    (dynamic_cast<channel&>(cnl).*(manip.m_method))( manip.m_argument );
00129    return cnl;
00130 }
00131 
00139 inline channel& operator <<( std::ostream& cnl, 
00140                              const channel_manip_nop& manip ) {
00141    
00142    return dynamic_cast<channel&>(cnl);
00143 }
00144 
00149 const channel_manip_void incr = channel_manip_void( &channel::incr_indent );
00150 
00155 const channel_manip_void decr = channel_manip_void( &channel::decr_indent );
00156 
00204 const channel_manip_nop  dgd  = channel_manip_nop();
00205 
00210 inline channel_manip_uint step( unsigned int s ) {
00211    return channel_manip_uint( &channel::indent_step, s );
00212 }
00213 
00218 inline channel_manip_uint indent( unsigned int s ) {
00219    return channel_manip_uint( &channel::indent, s );
00220 }
00221 
00226 inline channel_manip_uint minwidth( unsigned int s ) {
00227    return channel_manip_uint( &channel::min_width, s );
00228 }
00229 
00234 inline channel_manip_uint maxwidth( unsigned int s ) {
00235    return channel_manip_uint( &channel::max_width, s );
00236 }
00237 
00242 inline channel_manip_bool wrap( bool s ) {
00243    return channel_manip_bool( &channel::wrap, s );
00244 }
00245 
00250 inline channel_manip_bool word_wrap( bool s ) {
00251    return channel_manip_bool( &channel::word_wrap, s );
00252 }
00253 
00254 }; // end of namespace DGD
00255 
00256 #endif /* _dgChannelManip_h_ */
00257 
00258 /* 
00259  * Local Variables:
00260  * compile-command: "make dgChannelManip.obj"
00261  * End:
00262  */
00263 
00264 

Generated on Thu Aug 10 16:48:28 2006 for DGD Library by doxygen1.3

SourceForge.net Logo Powered by Mason Powered by Perl
Web design derived from Pasilda design found on www.oswd.org.
Copyright (c) 2002, 2003. Dimitry Kloper <kloper@users.sourceforge.net>