Langmuir
Simulation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LangmuirCore::Variable Class Referenceabstract

A class to map between variable names (keys) and locations (references) More...

#include <variable.h>

Public Types

enum  VariableModeFlag { Constant = 1 }
 A Flag to alter the behavoir of certain variable member functions. More...
 

Public Member Functions

 Variable (const QString &key, VariableMode mode=0, QObject *parent=0)
 Create a Variable, see Variable::Variable for description. More...
 
virtual void read (const QString &token)=0
 Cast the value stored in string to the correct type and store it in the correct location. More...
 
virtual QString key () const =0
 Get this variable's key (name) More...
 
virtual QString value () const =0
 Get this variable's value as a QString. More...
 
virtual QString keyValue () const =0
 Get this variable's key and value in the form 'key = value'. More...
 
bool isConstant () const
 True if the Variable::Constant mode flag was set. More...
 
const VariableMode & mode () const
 Get this variable's mode flags. More...
 

Protected Member Functions

virtual void write (QTextStream &stream) const =0
 Write 'key = value' to a stream. More...
 

Protected Attributes

QString m_key
 The name of this variable. More...
 
VariableMode m_mode
 The mode flags for this variable. More...
 

Friends

QTextStream & operator<< (QTextStream &stream, const Variable &variable)
 Operator overload to output 'key = value' to QTextStream. More...
 
QDebug operator<< (QDebug dbg, const Variable &variable)
 Operator overload to output 'key = value' to QDebug. More...
 
std::ostream & operator<< (std::ostream &stream, Variable &variable)
 Operator overload to output to output 'key = value' to std::ofstream. More...
 

Detailed Description

A class to map between variable names (keys) and locations (references)

Member Enumeration Documentation

A Flag to alter the behavoir of certain variable member functions.

Enumerator
Constant 

When constant, a variable's read / convert function does nothing.

Constructor & Destructor Documentation

LangmuirCore::Variable::Variable ( const QString &  key,
VariableMode  mode = 0,
QObject *  parent = 0 
)
inline

Create a Variable, see Variable::Variable for description.

initialize a Variable with a key

Member Function Documentation

bool LangmuirCore::Variable::isConstant ( ) const
inline

True if the Variable::Constant mode flag was set.

see if the Variable is really a Constant

virtual QString LangmuirCore::Variable::key ( ) const
pure virtual

Get this variable's key (name)

Implemented in LangmuirCore::TypedVariable< T >.

virtual QString LangmuirCore::Variable::keyValue ( ) const
pure virtual

Get this variable's key and value in the form 'key = value'.

Implemented in LangmuirCore::TypedVariable< T >, and LangmuirCore::TypedVariable< T >.

const Variable::VariableMode & LangmuirCore::Variable::mode ( ) const
inline

Get this variable's mode flags.

get the mode flags of this Variable

virtual void LangmuirCore::Variable::read ( const QString &  token)
pure virtual

Cast the value stored in string to the correct type and store it in the correct location.

This function assumes 'QTextStream& operator<<' has been implemented for that data type T. Keep this in mind if adding a new data type.

Implemented in LangmuirCore::TypedVariable< T >.

virtual QString LangmuirCore::Variable::value ( ) const
pure virtual
virtual void LangmuirCore::Variable::write ( QTextStream &  stream) const
protectedpure virtual

Write 'key = value' to a stream.

Implemented in LangmuirCore::TypedVariable< T >.

Friends And Related Function Documentation

QTextStream& operator<< ( QTextStream &  stream,
const Variable variable 
)
friend

Operator overload to output 'key = value' to QTextStream.

QDebug operator<< ( QDebug  dbg,
const Variable variable 
)
friend

Operator overload to output 'key = value' to QDebug.

std::ostream& operator<< ( std::ostream &  stream,
Variable variable 
)
friend

Operator overload to output to output 'key = value' to std::ofstream.

Member Data Documentation

QString LangmuirCore::Variable::m_key
protected

The name of this variable.

VariableMode LangmuirCore::Variable::m_mode
protected

The mode flags for this variable.


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