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
 
Proxyoperator= (Proxy const &p)
 copy operator
 
 ~Proxy ()
 destructor.
 
 operator String & ()
 Conversion operator to String.
 
 operator String const & () const
 Constant Conversion operator to String.
 

Protected Attributes

Stringx_
 A reference on the String wrapped.
 
String consty_
 A constant reference on the String wrapped.
 

Friends

istreamoperator>> (istream &is, Proxy< String > p)
 Overloading of the operator >> for the type String using a Proxy.
 
ostreamoperator<< (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

◆ 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) {}
std::basic_string< Char > String
STK fundamental type of a String.

◆ 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_) {}

◆ ~Proxy()

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

destructor.

Definition at line 161 of file STK_Proxy.h.

161{}

Member Function Documentation

◆ operator String &()

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

Conversion operator to String.

Definition at line 163 of file STK_Proxy.h.

163{ return x_;}

References STK::Proxy< Type >::x_.

◆ operator String const &()

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 STK::Proxy< Type >::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 STK::Proxy< Type >::x_.

Friends And Related Symbol Documentation

◆ 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_);}
String stringNa
Representation of a Not Available value.
static bool isNA(Type const &x)

◆ 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;
175 p = (buff == stringNa) ? Arithmetic<String>::NA() : buff;
176 return is;
177 }
static Type NA()
Adding a Non Available (NA) special number.

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.

◆ y_

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

A constant reference on the String wrapped.

Definition at line 141 of file STK_Proxy.h.


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