Mantid
|
#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 |
TSVSerialiser & | operator<< (const bool &val) |
TSVSerialiser & | operator<< (const char *val) |
TSVSerialiser & | operator<< (const double &val) |
TSVSerialiser & | operator<< (const int &val) |
TSVSerialiser & | operator<< (const QColor &val) |
TSVSerialiser & | operator<< (const QPoint &val) |
TSVSerialiser & | operator<< (const QPointF &val) |
TSVSerialiser & | operator<< (const QRect &val) |
TSVSerialiser & | operator<< (const QString &val) |
TSVSerialiser & | operator<< (const size_t &val) |
TSVSerialiser & | operator<< (const std::string &val) |
TSVSerialiser & | operator>> (bool &val) |
TSVSerialiser & | operator>> (double &val) |
TSVSerialiser & | operator>> (float &val) |
TSVSerialiser & | operator>> (int &val) |
TSVSerialiser & | operator>> (QColor &val) |
TSVSerialiser & | operator>> (QPoint &val) |
TSVSerialiser & | operator>> (QPointF &val) |
TSVSerialiser & | operator>> (QRect &val) |
TSVSerialiser & | operator>> (QString &val) |
TSVSerialiser & | operator>> (size_t &val) |
TSVSerialiser & | operator>> (std::string &val) |
template<typename T > | |
TSVSerialiser & | operator>> (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) |
TSVSerialiser & | writeLine (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 |
Definition at line 31 of file TSVSerialiser.h.
TSVSerialiser::TSVSerialiser | ( | ) |
Definition at line 21 of file TSVSerialiser.cpp.
|
explicit |
Definition at line 23 of file TSVSerialiser.cpp.
References parseLines().
bool TSVSerialiser::asBool | ( | const size_t | i | ) | const |
Definition at line 230 of file TSVSerialiser.cpp.
References m_curValues.
Referenced by operator>>(), and readBool().
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().
float TSVSerialiser::asFloat | ( | const size_t | i | ) | const |
Definition at line 217 of file TSVSerialiser.cpp.
References m_curValues.
Referenced by operator>>().
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().
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>>().
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>>().
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>>().
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>>().
QString TSVSerialiser::asQString | ( | const size_t | i | ) | const |
Definition at line 305 of file TSVSerialiser.cpp.
References m_curValues.
size_t TSVSerialiser::asSize_t | ( | const size_t | i | ) | const |
Definition at line 191 of file TSVSerialiser.cpp.
References m_curValues.
Referenced by operator>>().
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().
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.
bool TSVSerialiser::hasLine | ( | const std::string & | name | ) | const |
Definition at line 118 of file TSVSerialiser.cpp.
References m_lines.
Referenced by lineAsString(), and selectLine().
bool TSVSerialiser::hasSection | ( | const std::string & | name | ) | const |
Definition at line 120 of file TSVSerialiser.cpp.
References m_sections.
Referenced by sections(), and selectSection().
QString TSVSerialiser::lineAsQString | ( | const std::string & | name, |
const size_t | i = 0 |
||
) | const |
Definition at line 148 of file TSVSerialiser.cpp.
References 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().
TSVSerialiser & TSVSerialiser::operator<< | ( | const bool & | val | ) |
Definition at line 425 of file TSVSerialiser.cpp.
References storeBool().
TSVSerialiser & TSVSerialiser::operator<< | ( | const char * | val | ) |
Definition at line 399 of file TSVSerialiser.cpp.
References m_output.
TSVSerialiser & TSVSerialiser::operator<< | ( | const double & | val | ) |
Definition at line 410 of file TSVSerialiser.cpp.
References storeDouble().
TSVSerialiser & TSVSerialiser::operator<< | ( | const int & | val | ) |
Definition at line 415 of file TSVSerialiser.cpp.
References storeInt().
TSVSerialiser & TSVSerialiser::operator<< | ( | const QColor & | val | ) |
Definition at line 437 of file TSVSerialiser.cpp.
References m_output.
TSVSerialiser & TSVSerialiser::operator<< | ( | const QPoint & | val | ) |
Definition at line 443 of file TSVSerialiser.cpp.
References m_output.
TSVSerialiser & TSVSerialiser::operator<< | ( | const QPointF & | val | ) |
Definition at line 449 of file TSVSerialiser.cpp.
References m_output.
TSVSerialiser & TSVSerialiser::operator<< | ( | const QRect & | val | ) |
Definition at line 430 of file TSVSerialiser.cpp.
References m_output.
TSVSerialiser & TSVSerialiser::operator<< | ( | const QString & | val | ) |
Definition at line 404 of file TSVSerialiser.cpp.
References m_output.
TSVSerialiser & TSVSerialiser::operator<< | ( | const size_t & | val | ) |
Definition at line 420 of file TSVSerialiser.cpp.
References m_output.
TSVSerialiser & TSVSerialiser::operator<< | ( | const std::string & | val | ) |
Definition at line 394 of file TSVSerialiser.cpp.
References storeString().
TSVSerialiser & TSVSerialiser::operator>> | ( | bool & | val | ) |
Definition at line 357 of file TSVSerialiser.cpp.
References asBool(), and m_curIndex.
TSVSerialiser & TSVSerialiser::operator>> | ( | double & | val | ) |
Definition at line 337 of file TSVSerialiser.cpp.
References asDouble(), and m_curIndex.
TSVSerialiser & TSVSerialiser::operator>> | ( | float & | val | ) |
Definition at line 342 of file TSVSerialiser.cpp.
References asFloat(), and m_curIndex.
TSVSerialiser & TSVSerialiser::operator>> | ( | int & | val | ) |
Definition at line 327 of file TSVSerialiser.cpp.
References asInt(), and m_curIndex.
TSVSerialiser & TSVSerialiser::operator>> | ( | QColor & | val | ) |
Definition at line 367 of file TSVSerialiser.cpp.
References asQColor(), and m_curIndex.
TSVSerialiser & TSVSerialiser::operator>> | ( | QPoint & | val | ) |
Definition at line 372 of file TSVSerialiser.cpp.
References asQPoint(), and m_curIndex.
TSVSerialiser & TSVSerialiser::operator>> | ( | QPointF & | val | ) |
Definition at line 377 of file TSVSerialiser.cpp.
References asQPointF(), and m_curIndex.
TSVSerialiser & TSVSerialiser::operator>> | ( | QRect & | val | ) |
Definition at line 362 of file TSVSerialiser.cpp.
References asQRect(), and m_curIndex.
TSVSerialiser & TSVSerialiser::operator>> | ( | QString & | val | ) |
Definition at line 352 of file TSVSerialiser.cpp.
References asString(), and m_curIndex.
TSVSerialiser & TSVSerialiser::operator>> | ( | size_t & | val | ) |
Definition at line 332 of file TSVSerialiser.cpp.
References asSize_t(), and m_curIndex.
TSVSerialiser & TSVSerialiser::operator>> | ( | std::string & | val | ) |
Definition at line 347 of file TSVSerialiser.cpp.
References asString(), and m_curIndex.
|
inline |
Definition at line 46 of file TSVSerialiser.h.
std::string TSVSerialiser::outputLines | ( | ) | const |
Definition at line 499 of file TSVSerialiser.cpp.
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().
|
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.
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.
|
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.
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.
bool TSVSerialiser::readBool | ( | ) |
Definition at line 325 of file TSVSerialiser.cpp.
References asBool(), and m_curIndex.
double TSVSerialiser::readDouble | ( | ) |
Definition at line 319 of file TSVSerialiser.cpp.
References asDouble(), and m_curIndex.
int TSVSerialiser::readInt | ( | ) |
Definition at line 321 of file TSVSerialiser.cpp.
References asInt(), and m_curIndex.
std::string TSVSerialiser::readString | ( | ) |
Definition at line 323 of file TSVSerialiser.cpp.
References asString(), and m_curIndex.
std::vector< std::string > TSVSerialiser::sections | ( | const std::string & | name | ) | const |
Definition at line 132 of file TSVSerialiser.cpp.
References hasSection(), and m_sections.
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().
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.
void TSVSerialiser::storeBool | ( | const bool | val | ) |
void TSVSerialiser::storeDouble | ( | const double | val | ) |
void TSVSerialiser::storeInt | ( | const int | val | ) |
void TSVSerialiser::storeString | ( | const std::string & | val | ) |
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().
void TSVSerialiser::writeInlineSection | ( | const std::string & | name, |
const std::string & | body | ||
) |
Definition at line 486 of file TSVSerialiser.cpp.
TSVSerialiser & TSVSerialiser::writeLine | ( | const std::string & | name | ) |
Definition at line 382 of file TSVSerialiser.cpp.
void TSVSerialiser::writeRaw | ( | const std::string & | raw | ) |
Definition at line 455 of file TSVSerialiser.cpp.
void TSVSerialiser::writeSection | ( | const std::string & | name, |
const std::string & | body | ||
) |
Definition at line 467 of file TSVSerialiser.cpp.
|
private |
Definition at line 165 of file TSVSerialiser.h.
Referenced by asQColor(), asQPoint(), asQPointF(), asQRect(), clear(), operator>>(), readBool(), readDouble(), readInt(), readString(), selectLine(), and selectSection().
|
private |
Definition at line 164 of file TSVSerialiser.h.
Referenced by asBool(), asDouble(), asFloat(), asInt(), asQColor(), asQPoint(), asQPointF(), asQRect(), asQString(), asSize_t(), asString(), clear(), selectLine(), and selectSection().
|
private |
Definition at line 162 of file TSVSerialiser.h.
Referenced by clear(), hasLine(), lineAsString(), parseLines(), and selectLine().
|
private |
Definition at line 168 of file TSVSerialiser.h.
Referenced by clear(), outputLines(), writeInlineSection(), writeLine(), writeRaw(), and writeSection().
|
private |
Definition at line 167 of file TSVSerialiser.h.
Referenced by clear(), operator<<(), outputLines(), storeBool(), storeDouble(), storeInt(), storeString(), writeInlineSection(), writeLine(), writeRaw(), and writeSection().
|
private |
Definition at line 161 of file TSVSerialiser.h.
Referenced by clear(), hasSection(), parseLines(), sections(), and selectSection().