Wt::WVar< VARTYPE, PARENT > Class Template Reference

read only More...

#include <wvar.h>

Inheritance diagram for Wt::WVar< VARTYPE, PARENT >:

Inheritance graph
[legend]
Collaboration diagram for Wt::WVar< VARTYPE, PARENT >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 WVar (VARTYPE value=0)
VARTYPE readValue () const
VARTYPE get (VARTYPE) const
 usefull for overrides and variables connection
void set (VARTYPE value)
void connect (WVarBase &var)
 connect as a proxy to another WVar
 operator VARTYPE () const
 operator const std::string () const
WVarBaseoperator+= (const VARTYPE &value)
WVarBaseoperator-= (const VARTYPE &value)
WVarBaseoperator++ ()
 prefix operator
WVarBaseoperator++ (int)
 postfix operator
WVarBaseoperator-- ()
WVarBaseoperator-- (int)

Public Attributes

Signal012M< bool, VARTYPE,
VARTYPE, Blocker > 
aboutToChange
Signal012< void, VARTYPE,
VARTYPE > 
changed
Signal01< void, VARTYPE > read
sigc::signal1< VARTYPE, VARTYPE,
Overrider > 
override

Protected Types

typedef std::pair< bool, VARTYPE > ValidValue

Protected Member Functions

const VARTYPE & getValue () const
 avoids emitting read signal
void setValue (const VARTYPE &value)
 avoids emitting aboutToChange, changed signal

Friends

class WrappedParent::Parent

Classes

class  WrappedParent

Detailed Description

template<typename VARTYPE, typename PARENT = WVarBase<int>::RW>
class Wt::WVar< VARTYPE, PARENT >

read only

Definition at line 283 of file wvar.h.


Member Typedef Documentation

template<typename VARTYPE>
typedef std::pair<bool, VARTYPE> Wt::WVarBase< VARTYPE >::ValidValue [protected, inherited]

Definition at line 105 of file wvar.h.


Constructor & Destructor Documentation

template<typename VARTYPE, typename PARENT = WVarBase<int>::RW>
Wt::WVar< VARTYPE, PARENT >::WVar ( VARTYPE  value = 0  )  [inline]

Definition at line 285 of file wvar.h.

00286             : WVarBase<VARTYPE>(value) {}


Member Function Documentation

template<typename VARTYPE>
void Wt::WVarBase< VARTYPE >::connect ( WVarBase< VARTYPE > &  var  )  [inline, inherited]

connect as a proxy to another WVar

Definition at line 182 of file wvar.h.

Referenced by Wt::Frame::onLayoutChange().

00182                                 {
00183         // set the real variable to the proxy value
00184         var = getValue();
00185 
00186         changed.connect(
00187             sigc::slot1<void, VARTYPE>(
00188                 sigc::mem_fun(var, &WVarBase::set
00189                                  )));
00190 
00191         override.connect(sigc::mem_fun(var, &WVarBase::get
00192                                           ));
00193     }

template<typename VARTYPE>
VARTYPE Wt::WVarBase< VARTYPE >::get ( VARTYPE   )  const [inline, inherited]

usefull for overrides and variables connection

Todo:
get, set and other they should really

Definition at line 172 of file wvar.h.

Referenced by Wt::WVarBase< ExpandData >::connect().

00172                          {
00173             return readValue();
00174         }

template<typename VARTYPE>
const VARTYPE& Wt::WVarBase< VARTYPE >::getValue (  )  const [inline, protected, inherited]

avoids emitting read signal

Definition at line 121 of file wvar.h.

Referenced by Wt::WVarBase< ExpandData >::connect().

00121                                     {
00122         return value_;
00123     }

template<typename VARTYPE>
Wt::WVarBase< VARTYPE >::operator const std::string (  )  const [inline, inherited]

Definition at line 199 of file wvar.h.

00199                                      {
00200         return boost::lexical_cast<std::string>(readValue());
00201     }

template<typename VARTYPE>
Wt::WVarBase< VARTYPE >::operator VARTYPE (  )  const [inline, inherited]

Definition at line 195 of file wvar.h.

References Wt::WVarBase< VARTYPE >::readValue().

00195                              {
00196         return readValue();
00197     }

Here is the call graph for this function:

template<typename VARTYPE>
WVarBase& Wt::WVarBase< VARTYPE >::operator++ ( int   )  [inline, inherited]

postfix operator

Definition at line 233 of file wvar.h.

00233                               {
00234         VARTYPE other(*this);
00235         other++;
00236         *this = other;
00237         return *this;
00238     }

template<typename VARTYPE>
WVarBase& Wt::WVarBase< VARTYPE >::operator++ (  )  [inline, inherited]

prefix operator

Definition at line 218 of file wvar.h.

00218                            {
00219         VARTYPE other(*this);
00220         ++other;
00221         *this = other;
00222         return *this;
00223     }

template<typename VARTYPE>
WVarBase& Wt::WVarBase< VARTYPE >::operator+= ( const VARTYPE &  value  )  [inline, inherited]

Definition at line 203 of file wvar.h.

00203                                                {
00204         if (value) {
00205             *this = getValue() + value;
00206         }
00207         return *this;
00208     }

template<typename VARTYPE>
WVarBase& Wt::WVarBase< VARTYPE >::operator-- ( int   )  [inline, inherited]

Definition at line 240 of file wvar.h.

00240                               {
00241         VARTYPE other(*this);
00242         other--;
00243         *this = other;
00244         return *this;
00245     }

template<typename VARTYPE>
WVarBase& Wt::WVarBase< VARTYPE >::operator-- (  )  [inline, inherited]

Definition at line 225 of file wvar.h.

00225                            {
00226         VARTYPE other(*this);
00227         --other;
00228         *this = other;
00229         return *this;
00230     }

template<typename VARTYPE>
WVarBase& Wt::WVarBase< VARTYPE >::operator-= ( const VARTYPE &  value  )  [inline, inherited]

Definition at line 210 of file wvar.h.

00210                                                 {
00211         if (value) {
00212             *this = getValue() - value;
00213         }
00214         return *this;
00215     }

template<typename VARTYPE>
VARTYPE Wt::WVarBase< VARTYPE >::readValue (  )  const [inline, inherited]

Definition at line 161 of file wvar.h.

Referenced by Wt::WVarBase< ExpandData >::get(), Wt::WVarBase< ExpandData >::operator const std::string(), and Wt::WVarBase< VARTYPE >::operator VARTYPE().

00161                               {
00162         read.emit(value_);
00163         const OverideValue v = override.emit(value_);
00164         return (v.isValid()) ? v.value() : value_;
00165     }

template<typename VARTYPE>
void Wt::WVarBase< VARTYPE >::set ( VARTYPE  value  )  [inline, inherited]

Definition at line 177 of file wvar.h.

Referenced by Wt::WVarBase< ExpandData >::connect().

00177                         {
00178         *this = value;
00179     }

template<typename VARTYPE>
void Wt::WVarBase< VARTYPE >::setValue ( const VARTYPE &  value  )  [inline, protected, inherited]

avoids emitting aboutToChange, changed signal

Definition at line 126 of file wvar.h.

Referenced by Wt::WVarBase< ExpandData >::operator=().

00126                                          {
00127         value_ = value;
00128     }


Friends And Related Function Documentation

template<typename VARTYPE, typename PARENT = WVarBase<int>::RW>
friend class WrappedParent::Parent [friend]

Definition at line 300 of file wvar.h.


Member Data Documentation

template<typename VARTYPE>
Signal012M<bool, VARTYPE, VARTYPE, Blocker> Wt::WVarBase< VARTYPE >::aboutToChange [inherited]

Definition at line 156 of file wvar.h.

Referenced by Wt::Layout::init(), and Wt::WVarBase< ExpandData >::operator=().

template<typename VARTYPE>
Signal012<void, VARTYPE, VARTYPE> Wt::WVarBase< VARTYPE >::changed [inherited]

Definition at line 157 of file wvar.h.

Referenced by Wt::WVarBase< ExpandData >::connect(), Wt::Frame::Frame(), Wt::PushButton::init(), Wt::Layout::init(), Wt::Label::init(), Wt::CascadeLayout::init(), Wt::WVarBase< ExpandData >::operator=(), and Wt::Widget::Widget().

template<typename VARTYPE>
sigc::signal1<VARTYPE, VARTYPE, Overrider> Wt::WVarBase< VARTYPE >::override [mutable, inherited]

Definition at line 159 of file wvar.h.

Referenced by Wt::WVarBase< ExpandData >::connect(), Wt::Layout::init(), Wt::WVarBase< ExpandData >::readValue(), and Wt::Widget::Widget().

template<typename VARTYPE>
Signal01<void, VARTYPE> Wt::WVarBase< VARTYPE >::read [mutable, inherited]

Definition at line 158 of file wvar.h.

Referenced by Wt::WVarBase< ExpandData >::readValue().


The documentation for this class was generated from the following file:

Generated Fri Jul 28 19:33:52 2006.
Copyright © 1998-2003 by the respective authors.

This document is licensed under the terms of the GNU Free Documentation License and may be freely distributed under the conditions given by this license.