STK++ 0.9.13
STK::Proxy< String > Class Reference

Specialization of the Proxy class for String. More...

#include <STK_Proxy.h>

Public Member Functions

 Proxy (String &x)
 constructor : create a reference of the String x.
 Proxy (String const &x)
 constructor : create a constant reference of the String x.
 Proxy (Proxy const &p)
 copy constructor
Proxy & operator= (Proxy const &p)
 copy operator
 ~Proxy ()
 destructor.
 operator String & ()
 Conversion operator to String.
 operator String const & () const
 Constant Conversion operator to String.
 operator String & ()
 Conversion operator to Type.
 operator String const & () const
 Constant Conversion operator to Type.

Protected Attributes

String & x_
 A reference on the String wrapped.
String const & y_
 A constant reference on the String wrapped.

Friends

istream & operator>> (istream &is, Proxy< String > p)
 Overloading of the operator >> for the type String using a Proxy.
ostream & operator<< (ostream &os, Proxy< String > const &p)
 Overloading of the operator << for the type String using a constant Proxy.

Detailed Description

Specialization of the Proxy class for String.

Definition at line 137 of file STK_Proxy.h.

Constructor & Destructor Documentation

◆ Proxy() [1/3]

STK::Proxy< String >::Proxy ( String & x)
inline

constructor : create a reference of the String x.

Parameters
xthe object to wrap

Definition at line 147 of file STK_Proxy.h.

147: x_(x), y_(x) {}
String & x_
A reference on the String wrapped.
Definition STK_Proxy.h:140
String const & y_
A constant reference on the String wrapped.
Definition STK_Proxy.h:141
The Proxy class allow to surdefine operators and methods for every kind of class without using dynami...
Definition STK_Proxy.h:52

References x_, and y_.

Referenced by operator<<, operator=(), operator>>, and Proxy().

◆ Proxy() [2/3]

STK::Proxy< String >::Proxy ( String const & x)
inline

constructor : create a constant reference of the String x.

Parameters
xthe object to wrap

Definition at line 151 of file STK_Proxy.h.

151: x_(const_cast<String&>(x)), y_(x) {}

References x_, and y_.

◆ Proxy() [3/3]

STK::Proxy< String >::Proxy ( Proxy< String > const & p)
inline

copy constructor

Parameters
pthe object to copy

Definition at line 155 of file STK_Proxy.h.

155: x_(p.x_), y_(p.y_) {}
Type & x_
A reference on the object wrapped.
Definition STK_Proxy.h:54
Type const & y_
A reference on the object wrapped.
Definition STK_Proxy.h:55

References Proxy(), x_, and y_.

◆ ~Proxy()

STK::Proxy< String >::~Proxy ( )
inline

destructor.

Definition at line 161 of file STK_Proxy.h.

161{}

Member Function Documentation

◆ operator String &() [1/2]

STK::Proxy< String >::operator String & ( )
inline

Conversion operator to String.

Definition at line 163 of file STK_Proxy.h.

163{ return x_;}

References x_.

◆ operator String &() [2/2]

STK::Proxy< String >::operator String & ( )
inline

Conversion operator to Type.

Definition at line 81 of file STK_Proxy.h.

81{ return x_;}

References x_.

◆ operator String const &() [1/2]

STK::Proxy< String >::operator String const & ( ) const
inline

Constant Conversion operator to String.

Definition at line 165 of file STK_Proxy.h.

165{ return y_;}

References y_.

◆ operator String const &() [2/2]

STK::Proxy< String >::operator String const & ( ) const
inline

Constant Conversion operator to Type.

Definition at line 83 of file STK_Proxy.h.

83{ return y_;}

References y_.

◆ operator=()

Proxy & STK::Proxy< String >::operator= ( Proxy< String > const & p)
inline

copy operator

Parameters
pthe proxy to copy

Definition at line 159 of file STK_Proxy.h.

159{ x_ = p.x_; return *this;}

References Proxy(), STK::Proxy< Type >::x_, and x_.

◆ operator<<

ostream & operator<< ( ostream & os,
Proxy< String > const & p )
friend

Overloading of the operator << for the type String using a constant Proxy.

Parameters
osthe output stream
pthe value to send to the stream

Definition at line 183 of file STK_Proxy.h.

184 { return Arithmetic<String>::isNA(p.x_) ? (os << stringNa) : (os << p.y_);}
static bool isNA(Type const &x)

References STK::Arithmetic< Type >::isNA(), Proxy(), STK::stringNa, STK::Proxy< Type >::x_, and STK::Proxy< Type >::y_.

◆ operator>>

istream & operator>> ( istream & is,
Proxy< String > p )
friend

Overloading of the operator >> for the type String using a Proxy.

For String type we just check that we have not read a NA value.

Parameters
isthe input stream
pthe value to get from the stream

Definition at line 171 of file STK_Proxy.h.

172 {
173 String buff;
174 is >> std::skipws >> buff;
176 return is;
177 }

References STK::Arithmetic< Type >::NA(), Proxy(), and STK::stringNa.

Member Data Documentation

◆ x_

String& STK::Proxy< String >::x_
protected

A reference on the String wrapped.

Definition at line 140 of file STK_Proxy.h.

Referenced by operator String &(), operator=(), Proxy(), Proxy(), and Proxy().

◆ y_

String const& STK::Proxy< String >::y_
protected

A constant reference on the String wrapped.

Definition at line 141 of file STK_Proxy.h.

Referenced by operator String const &(), Proxy(), Proxy(), and Proxy().


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