API documentation

#include <textparser.h>

Type definitions

typedef char const *ccp

Pointer to a constant string.

typedef ccp const ccpc

Constant pointer to a constant string.

Functions

bool strmatch(ccpc begin, ccpc end, ccpc str)

String comparison.

Parameters
  • begin[in] Pointer to the first C string.

  • end[in] Pointer to end of the first C string.

  • str[in] Pointer to the second C string.

Types

template<class T, size_t base>
struct Number

Integer number.

Template Parameters
  • T – Integer type.

  • base – Integer base.

Public Members

T value

Value.

template<ccp truth>
struct Bool

Boolean.

Template Parameters

truth – Truth value.

Public Members

bool value

Value.

template<class T, ccp *labels>
struct Category

Category.

Template Parameters
  • T – Integer type.

  • .

Public Members

T value

Value.

Class definitions

class TextParser

Line based text parser.

Public Functions

inline TextParser(ccpc delimiter)

Constructor.

Parameters

delimiter[in] Field delimiter.

inline TextParser(ccpc delimiter, ccpc eol)

Constructor.

Parameters
  • delimiter[in] Field delimiter.

  • eol[in] Line delimiter.

void parse(char &result, ccpc begin, ccpc end) const

Parse a field.

Parameters
  • result[out] Result.

  • begin[in] Pointer to C string.

  • end[in] Pointer to end of C string.

void parse(double &result, ccpc begin, ccpc end) const

Parse a field.

Parameters
  • result[out] Result.

  • begin[in] Pointer to C string.

  • end[in] Pointer to end of C string.

void parse(float &result, ccpc begin, ccpc end) const

Parse a field.

Parameters
  • result[out] Result.

  • begin[in] Pointer to C string.

  • end[in] Pointer to end of C string.

template<size_t n>
void parse(char (&result)[n], ccpc begin, ccpc end) const

Parse a field.

Template Parameters

n – String length.

Parameters
  • result[out] Result.

  • begin[in] Pointer to C string.

  • end[in] Pointer to end of C string.

template<ccp truth>
void parse(Bool<truth> &result, ccpc begin, ccpc end) const

Parse a field.

Template Parameters

truth – Truth value.

Parameters
  • result[out] Result.

  • begin[in] Pointer to C string.

  • end[in] Pointer to end of C string.

template<class T, size_t base>
void parse(Number<T, base> &result, ccpc begin, ccpc end) const

Parse a field.

Template Parameters
  • T – Integer type.

  • base – Integer base.

Parameters
  • result[out] Result.

  • begin[in] Pointer to C string.

  • end[in] Pointer to end of C string.

template<class T, ccp *labels>
void parse(Category<T, labels> &result, ccpc begin, ccpc end) const

Parse a field.

Template Parameters
  • T – Integer type.

  • labels – Labels.

Parameters
  • result[out] Result.

  • begin[in] Pointer to C string.

  • end[in] Pointer to end of C string.

template<class T>
void parse(T &result, ccpc begin, ccpc end) const

Parse a field.

Template Parameters

T – Integer type.

Parameters
  • result[out] Result.

  • begin[in] Pointer to C string.

  • end[in] Pointer to end of C string.

template<class ...Args>
void parseLine(ccpc line, Args&... args) const

Parse a line.

Template Parameters

Args – Output variable types.

Parameters
  • line[in] Line to be parsed.

  • args[out] Variables to hold the parsed data.