Jpp  18.6.0-rc.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Attributes | Friends | List of all members
JPARSER::JProxy< T, false > Class Template Reference

Template specialisation of JProxy for non-fundamental data type. More...

#include <JParser.hh>

Inheritance diagram for JPARSER::JProxy< T, false >:

Public Member Functions

 JProxy (const std::string &option, const T &value)
 Constructor. More...
 
 JProxy (const T &value)
 Constructor. More...
 
const TgetValue () const
 Get actual value. More...
 
const std::string & getOption () const
 Get option. More...
 
const TgetCustom () const
 Get custom value. More...
 
JProxyoperator= (const JProxy &object)
 Assignment operator. More...
 
JProxyoperator= (const T &value)
 Assignment to a value. More...
 

Protected Attributes

std::string __option
 
T __custom
 

Friends

std::istream & operator>> (std::istream &in, JProxy &object)
 Read option from input. More...
 
std::ostream & operator<< (std::ostream &out, const JProxy &object)
 Write options to output. More...
 

Detailed Description

template<class T>
class JPARSER::JProxy< T, false >

Template specialisation of JProxy for non-fundamental data type.

Definition at line 289 of file JParser.hh.

Constructor & Destructor Documentation

template<class T >
JPARSER::JProxy< T, false >::JProxy ( const std::string &  option,
const T value 
)
inline

Constructor.

Parameters
optiontextual value
valuecustom value

Definition at line 299 of file JParser.hh.

299  :
300  T(),
301  __option(option),
302  __custom(value)
303  {}
do set_variable OUTPUT_DIRECTORY $WORKDIR T
template<class T >
JPARSER::JProxy< T, false >::JProxy ( const T value)
inline

Constructor.

Parameters
valueactual value

Definition at line 311 of file JParser.hh.

311  :
312  T(value),
313  __option(),
314  __custom()
315  {}
do set_variable OUTPUT_DIRECTORY $WORKDIR T

Member Function Documentation

template<class T >
const T& JPARSER::JProxy< T, false >::getValue ( ) const
inline

Get actual value.

Returns
value

Definition at line 323 of file JParser.hh.

324  {
325  return static_cast<const T&>(*this);
326  }
do set_variable OUTPUT_DIRECTORY $WORKDIR T
template<class T >
const std::string& JPARSER::JProxy< T, false >::getOption ( ) const
inline

Get option.

Returns
option

Definition at line 334 of file JParser.hh.

335  {
336  return __option;
337  }
template<class T >
const T& JPARSER::JProxy< T, false >::getCustom ( ) const
inline

Get custom value.

Returns
value

Definition at line 345 of file JParser.hh.

346  {
347  return __custom;
348  }
template<class T >
JProxy& JPARSER::JProxy< T, false >::operator= ( const JProxy< T, false > &  object)
inline

Assignment operator.

Note that only the actual value is assigned.

Parameters
objectobject
Returns
this object

Definition at line 359 of file JParser.hh.

360  {
361  static_cast<T&>(*this) = static_cast<const T&>(object);
362 
363  return *this;
364  }
do set_variable OUTPUT_DIRECTORY $WORKDIR T
template<class T >
JProxy& JPARSER::JProxy< T, false >::operator= ( const T value)
inline

Assignment to a value.

Parameters
valuevalue
Returns
this object

Definition at line 373 of file JParser.hh.

374  {
375  static_cast<T&>(*this) = value;
376 
377  return *this;
378  }
do set_variable OUTPUT_DIRECTORY $WORKDIR T

Friends And Related Function Documentation

template<class T >
std::istream& operator>> ( std::istream &  in,
JProxy< T, false > &  object 
)
friend

Read option from input.

Parameters
ininput stream
objectoption
Returns
input stream

Definition at line 388 of file JParser.hh.

389  {
390  using namespace std;
391 
392  string buffer;
393 
394  if (getline(in, buffer)) {
395 
396  if (buffer == object.__option) {
397 
398  static_cast<T&>(object) = object.__custom;
399 
400  } else {
401 
402  istringstream is(buffer);
403 
404  is >> static_cast<T&>(object);
405 
406  in.setstate(is.rdstate());
407  }
408  }
409 
410  return in;
411  }
is
Definition: JDAQCHSM.chsm:167
do set_variable OUTPUT_DIRECTORY $WORKDIR T
std::istream & getline(std::istream &in, JString &object)
Read string from input stream until end of line.
Definition: JString.hh:478
then fatal The output file must have the wildcard in the e g root fi eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Definition: JCanberra.sh:48
template<class T >
std::ostream& operator<< ( std::ostream &  out,
const JProxy< T, false > &  object 
)
friend

Write options to output.

Parameters
outoutput stream
objectoption
Returns
output stream

Definition at line 421 of file JParser.hh.

422  {
423  return out << static_cast<const T&>(object);
424  }

Member Data Documentation

template<class T >
std::string JPARSER::JProxy< T, false >::__option
protected

Definition at line 427 of file JParser.hh.

template<class T >
T JPARSER::JProxy< T, false >::__custom
protected

Definition at line 428 of file JParser.hh.


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