Mantid
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
MantidQt::API::TSVSerialiser Class Reference

#include <TSVSerialiser.h>

Public Member Functions

bool asBool (const size_t i) const
 
double asDouble (const size_t i) const
 
float asFloat (const size_t i) const
 
int asInt (const size_t i) const
 
QColor asQColor (const size_t i)
 
QPoint asQPoint (const size_t i)
 
QPointF asQPointF (const size_t i)
 
QRect asQRect (const size_t i)
 
QString asQString (const size_t i) const
 
size_t asSize_t (const size_t i) const
 
std::string asString (const size_t i) const
 
void clear ()
 
bool hasLine (const std::string &name) const
 
bool hasSection (const std::string &name) const
 
QString lineAsQString (const std::string &name, const size_t i=0) const
 
std::string lineAsString (const std::string &name, const size_t i=0) const
 
TSVSerialiseroperator<< (const bool &val)
 
TSVSerialiseroperator<< (const char *val)
 
TSVSerialiseroperator<< (const double &val)
 
TSVSerialiseroperator<< (const int &val)
 
TSVSerialiseroperator<< (const QColor &val)
 
TSVSerialiseroperator<< (const QPoint &val)
 
TSVSerialiseroperator<< (const QPointF &val)
 
TSVSerialiseroperator<< (const QRect &val)
 
TSVSerialiseroperator<< (const QString &val)
 
TSVSerialiseroperator<< (const size_t &val)
 
TSVSerialiseroperator<< (const std::string &val)
 
TSVSerialiseroperator>> (bool &val)
 
TSVSerialiseroperator>> (double &val)
 
TSVSerialiseroperator>> (float &val)
 
TSVSerialiseroperator>> (int &val)
 
TSVSerialiseroperator>> (QColor &val)
 
TSVSerialiseroperator>> (QPoint &val)
 
TSVSerialiseroperator>> (QPointF &val)
 
TSVSerialiseroperator>> (QRect &val)
 
TSVSerialiseroperator>> (QString &val)
 
TSVSerialiseroperator>> (size_t &val)
 
TSVSerialiseroperator>> (std::string &val)
 
template<typename T >
TSVSerialiseroperator>> (std::vector< T > &val)
 
std::string outputLines () const
 
void parseLines (const std::string &lines)
 
template<typename T >
void parseLines (const std::string &name, std::vector< T > &container)
 Parse all lines matching a name and extract the values to a vector. More...
 
template<typename T , typename Extractor >
void parseLines (const std::string &name, std::vector< T > &container, Extractor &&extractor)
 Parse all lines matching a name and extract the values to a vector. More...
 
bool readBool ()
 
double readDouble ()
 
int readInt ()
 
std::string readString ()
 
std::vector< std::string > sections (const std::string &name) const
 
bool selectLine (const std::string &name, const size_t i=0)
 
bool selectSection (const std::string &name, const size_t i=0)
 
void storeBool (const bool val)
 
void storeDouble (const double val)
 
void storeInt (const int val)
 
void storeString (const std::string &val)
 
 TSVSerialiser ()
 
 TSVSerialiser (const std::string &lines)
 
std::vector< std::string > values (const std::string &name, const size_t i=0) const
 
void writeInlineSection (const std::string &name, const std::string &body)
 
TSVSerialiserwriteLine (const std::string &name)
 
void writeRaw (const std::string &raw)
 
void writeSection (const std::string &name, const std::string &body)
 

Private Attributes

int m_curIndex
 
std::vector< std::string > m_curValues
 
Mantid::Kernel::CaseInsensitiveMap< std::vector< std::string > > m_lines
 
bool m_midLine
 
std::stringstream m_output
 
Mantid::Kernel::CaseInsensitiveMap< std::vector< std::string > > m_sections
 

Detailed Description

Definition at line 31 of file TSVSerialiser.h.

Constructor & Destructor Documentation

◆ TSVSerialiser() [1/2]

TSVSerialiser::TSVSerialiser ( )

Definition at line 21 of file TSVSerialiser.cpp.

◆ TSVSerialiser() [2/2]

TSVSerialiser::TSVSerialiser ( const std::string &  lines)
explicit

Definition at line 23 of file TSVSerialiser.cpp.

References parseLines().

Member Function Documentation

◆ asBool()

bool TSVSerialiser::asBool ( const size_t  i) const

Definition at line 230 of file TSVSerialiser.cpp.

References m_curValues.

Referenced by operator>>(), and readBool().

◆ asDouble()

double TSVSerialiser::asDouble ( const size_t  i) const

Definition at line 204 of file TSVSerialiser.cpp.

References m_curValues.

Referenced by asQPointF(), operator>>(), and readDouble().

◆ asFloat()

float TSVSerialiser::asFloat ( const size_t  i) const

Definition at line 217 of file TSVSerialiser.cpp.

References m_curValues.

Referenced by operator>>().

◆ asInt()

int TSVSerialiser::asInt ( const size_t  i) const

Definition at line 178 of file TSVSerialiser.cpp.

References m_curValues.

Referenced by asQColor(), asQPoint(), asQRect(), operator>>(), and readInt().

◆ asQColor()

QColor TSVSerialiser::asQColor ( const size_t  i)

Definition at line 260 of file TSVSerialiser.cpp.

References asInt(), m_curIndex, and m_curValues.

Referenced by operator>>().

◆ asQPoint()

QPoint TSVSerialiser::asQPoint ( const size_t  i)

Definition at line 274 of file TSVSerialiser.cpp.

References asInt(), m_curIndex, and m_curValues.

Referenced by operator>>().

◆ asQPointF()

QPointF TSVSerialiser::asQPointF ( const size_t  i)

Definition at line 286 of file TSVSerialiser.cpp.

References asDouble(), m_curIndex, and m_curValues.

Referenced by operator>>().

◆ asQRect()

QRect TSVSerialiser::asQRect ( const size_t  i)

Definition at line 243 of file TSVSerialiser.cpp.

References asInt(), m_curIndex, and m_curValues.

Referenced by operator>>().

◆ asQString()

QString TSVSerialiser::asQString ( const size_t  i) const

Definition at line 305 of file TSVSerialiser.cpp.

References m_curValues.

◆ asSize_t()

size_t TSVSerialiser::asSize_t ( const size_t  i) const

Definition at line 191 of file TSVSerialiser.cpp.

References m_curValues.

Referenced by operator>>().

◆ asString()

std::string TSVSerialiser::asString ( const size_t  i) const

Definition at line 298 of file TSVSerialiser.cpp.

References m_curValues.

Referenced by operator>>(), and readString().

◆ clear()

void TSVSerialiser::clear ( )

Definition at line 507 of file TSVSerialiser.cpp.

References m_curIndex, m_curValues, m_lines, m_midLine, m_output, and m_sections.

◆ hasLine()

bool TSVSerialiser::hasLine ( const std::string &  name) const

Definition at line 118 of file TSVSerialiser.cpp.

References m_lines.

Referenced by lineAsString(), and selectLine().

◆ hasSection()

bool TSVSerialiser::hasSection ( const std::string &  name) const

Definition at line 120 of file TSVSerialiser.cpp.

References m_sections.

Referenced by sections(), and selectSection().

◆ lineAsQString()

QString TSVSerialiser::lineAsQString ( const std::string &  name,
const size_t  i = 0 
) const

Definition at line 148 of file TSVSerialiser.cpp.

References lineAsString().

◆ lineAsString()

std::string TSVSerialiser::lineAsString ( const std::string &  name,
const size_t  i = 0 
) const

Definition at line 139 of file TSVSerialiser.cpp.

References hasLine(), and m_lines.

Referenced by lineAsQString(), and values().

◆ operator<<() [1/11]

TSVSerialiser & TSVSerialiser::operator<< ( const bool &  val)

Definition at line 425 of file TSVSerialiser.cpp.

References storeBool().

◆ operator<<() [2/11]

TSVSerialiser & TSVSerialiser::operator<< ( const char *  val)

Definition at line 399 of file TSVSerialiser.cpp.

References m_output.

◆ operator<<() [3/11]

TSVSerialiser & TSVSerialiser::operator<< ( const double &  val)

Definition at line 410 of file TSVSerialiser.cpp.

References storeDouble().

◆ operator<<() [4/11]

TSVSerialiser & TSVSerialiser::operator<< ( const int &  val)

Definition at line 415 of file TSVSerialiser.cpp.

References storeInt().

◆ operator<<() [5/11]

TSVSerialiser & TSVSerialiser::operator<< ( const QColor &  val)

Definition at line 437 of file TSVSerialiser.cpp.

References m_output.

◆ operator<<() [6/11]

TSVSerialiser & TSVSerialiser::operator<< ( const QPoint &  val)

Definition at line 443 of file TSVSerialiser.cpp.

References m_output.

◆ operator<<() [7/11]

TSVSerialiser & TSVSerialiser::operator<< ( const QPointF &  val)

Definition at line 449 of file TSVSerialiser.cpp.

References m_output.

◆ operator<<() [8/11]

TSVSerialiser & TSVSerialiser::operator<< ( const QRect &  val)

Definition at line 430 of file TSVSerialiser.cpp.

References m_output.

◆ operator<<() [9/11]

TSVSerialiser & TSVSerialiser::operator<< ( const QString &  val)

Definition at line 404 of file TSVSerialiser.cpp.

References m_output.

◆ operator<<() [10/11]

TSVSerialiser & TSVSerialiser::operator<< ( const size_t &  val)

Definition at line 420 of file TSVSerialiser.cpp.

References m_output.

◆ operator<<() [11/11]

TSVSerialiser & TSVSerialiser::operator<< ( const std::string &  val)

Definition at line 394 of file TSVSerialiser.cpp.

References storeString().

◆ operator>>() [1/12]

TSVSerialiser & TSVSerialiser::operator>> ( bool &  val)

Definition at line 357 of file TSVSerialiser.cpp.

References asBool(), and m_curIndex.

◆ operator>>() [2/12]

TSVSerialiser & TSVSerialiser::operator>> ( double &  val)

Definition at line 337 of file TSVSerialiser.cpp.

References asDouble(), and m_curIndex.

◆ operator>>() [3/12]

TSVSerialiser & TSVSerialiser::operator>> ( float &  val)

Definition at line 342 of file TSVSerialiser.cpp.

References asFloat(), and m_curIndex.

◆ operator>>() [4/12]

TSVSerialiser & TSVSerialiser::operator>> ( int &  val)

Definition at line 327 of file TSVSerialiser.cpp.

References asInt(), and m_curIndex.

◆ operator>>() [5/12]

TSVSerialiser & TSVSerialiser::operator>> ( QColor &  val)

Definition at line 367 of file TSVSerialiser.cpp.

References asQColor(), and m_curIndex.

◆ operator>>() [6/12]

TSVSerialiser & TSVSerialiser::operator>> ( QPoint &  val)

Definition at line 372 of file TSVSerialiser.cpp.

References asQPoint(), and m_curIndex.

◆ operator>>() [7/12]

TSVSerialiser & TSVSerialiser::operator>> ( QPointF &  val)

Definition at line 377 of file TSVSerialiser.cpp.

References asQPointF(), and m_curIndex.

◆ operator>>() [8/12]

TSVSerialiser & TSVSerialiser::operator>> ( QRect &  val)

Definition at line 362 of file TSVSerialiser.cpp.

References asQRect(), and m_curIndex.

◆ operator>>() [9/12]

TSVSerialiser & TSVSerialiser::operator>> ( QString &  val)

Definition at line 352 of file TSVSerialiser.cpp.

References asString(), and m_curIndex.

◆ operator>>() [10/12]

TSVSerialiser & TSVSerialiser::operator>> ( size_t &  val)

Definition at line 332 of file TSVSerialiser.cpp.

References asSize_t(), and m_curIndex.

◆ operator>>() [11/12]

TSVSerialiser & TSVSerialiser::operator>> ( std::string &  val)

Definition at line 347 of file TSVSerialiser.cpp.

References asString(), and m_curIndex.

◆ operator>>() [12/12]

template<typename T >
TSVSerialiser & MantidQt::API::TSVSerialiser::operator>> ( std::vector< T > &  val)
inline

Definition at line 46 of file TSVSerialiser.h.

◆ outputLines()

std::string TSVSerialiser::outputLines ( ) const

Definition at line 499 of file TSVSerialiser.cpp.

References m_midLine, and m_output.

◆ parseLines() [1/3]

void TSVSerialiser::parseLines ( const std::string &  lines)

Definition at line 25 of file TSVSerialiser.cpp.

References m_lines, m_sections, and Mantid::Kernel::Logger::warning().

Referenced by TSVSerialiser().

◆ parseLines() [2/3]

template<typename T >
void MantidQt::API::TSVSerialiser::parseLines ( const std::string &  name,
std::vector< T > &  container 
)
inline

Parse all lines matching a name and extract the values to a vector.

This is an overloaded version of the function below that uses a default extractor function. This expects that the type of the container matches one of the parsable types implemented in this class.

Parameters
name:: the name of the line to match with
container:: the output vector to store values in

Definition at line 69 of file TSVSerialiser.h.

References value.

◆ parseLines() [3/3]

template<typename T , typename Extractor >
void MantidQt::API::TSVSerialiser::parseLines ( const std::string &  name,
std::vector< T > &  container,
Extractor &&  extractor 
)
inline

Parse all lines matching a name and extract the values to a vector.

The third argument should be a function that accepts a TSVSerialiser instance and returns the parsed value matching the type of the container.

Parameters
name:: the name of the line to match with
container:: the output vector to store values in
extractor:: function to use to extract values from each line

Definition at line 91 of file TSVSerialiser.h.

References index, and value.

◆ readBool()

bool TSVSerialiser::readBool ( )

Definition at line 325 of file TSVSerialiser.cpp.

References asBool(), and m_curIndex.

◆ readDouble()

double TSVSerialiser::readDouble ( )

Definition at line 319 of file TSVSerialiser.cpp.

References asDouble(), and m_curIndex.

◆ readInt()

int TSVSerialiser::readInt ( )

Definition at line 321 of file TSVSerialiser.cpp.

References asInt(), and m_curIndex.

◆ readString()

std::string TSVSerialiser::readString ( )

Definition at line 323 of file TSVSerialiser.cpp.

References asString(), and m_curIndex.

◆ sections()

std::vector< std::string > TSVSerialiser::sections ( const std::string &  name) const

Definition at line 132 of file TSVSerialiser.cpp.

References hasSection(), and m_sections.

◆ selectLine()

bool TSVSerialiser::selectLine ( const std::string &  name,
const size_t  i = 0 
)

Definition at line 152 of file TSVSerialiser.cpp.

References hasLine(), m_curIndex, m_curValues, m_lines, and values().

◆ selectSection()

bool TSVSerialiser::selectSection ( const std::string &  name,
const size_t  i = 0 
)

Definition at line 164 of file TSVSerialiser.cpp.

References hasSection(), m_curIndex, m_curValues, and m_sections.

◆ storeBool()

void TSVSerialiser::storeBool ( const bool  val)

Definition at line 317 of file TSVSerialiser.cpp.

References m_output.

Referenced by operator<<().

◆ storeDouble()

void TSVSerialiser::storeDouble ( const double  val)

Definition at line 312 of file TSVSerialiser.cpp.

References m_output.

Referenced by operator<<().

◆ storeInt()

void TSVSerialiser::storeInt ( const int  val)

Definition at line 314 of file TSVSerialiser.cpp.

References m_output.

Referenced by operator<<().

◆ storeString()

void TSVSerialiser::storeString ( const std::string &  val)

Definition at line 315 of file TSVSerialiser.cpp.

References m_output.

Referenced by operator<<().

◆ values()

std::vector< std::string > TSVSerialiser::values ( const std::string &  name,
const size_t  i = 0 
) const

Definition at line 122 of file TSVSerialiser.cpp.

References lineAsString().

Referenced by selectLine().

◆ writeInlineSection()

void TSVSerialiser::writeInlineSection ( const std::string &  name,
const std::string &  body 
)

Definition at line 486 of file TSVSerialiser.cpp.

References m_midLine, and m_output.

◆ writeLine()

TSVSerialiser & TSVSerialiser::writeLine ( const std::string &  name)

Definition at line 382 of file TSVSerialiser.cpp.

References m_midLine, and m_output.

◆ writeRaw()

void TSVSerialiser::writeRaw ( const std::string &  raw)

Definition at line 455 of file TSVSerialiser.cpp.

References m_midLine, and m_output.

◆ writeSection()

void TSVSerialiser::writeSection ( const std::string &  name,
const std::string &  body 
)

Definition at line 467 of file TSVSerialiser.cpp.

References m_midLine, and m_output.

Member Data Documentation

◆ m_curIndex

int MantidQt::API::TSVSerialiser::m_curIndex
private

◆ m_curValues

std::vector<std::string> MantidQt::API::TSVSerialiser::m_curValues
private

◆ m_lines

Mantid::Kernel::CaseInsensitiveMap<std::vector<std::string> > MantidQt::API::TSVSerialiser::m_lines
private

Definition at line 162 of file TSVSerialiser.h.

Referenced by clear(), hasLine(), lineAsString(), parseLines(), and selectLine().

◆ m_midLine

bool MantidQt::API::TSVSerialiser::m_midLine
private

◆ m_output

std::stringstream MantidQt::API::TSVSerialiser::m_output
private

◆ m_sections

Mantid::Kernel::CaseInsensitiveMap<std::vector<std::string> > MantidQt::API::TSVSerialiser::m_sections
private

Definition at line 161 of file TSVSerialiser.h.

Referenced by clear(), hasSection(), parseLines(), sections(), and selectSection().


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