Data Structures | Public Types | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes

ts::config::Builder Class Reference

Class to build the configuration table from parser events. More...

#include <TsBuilder.h>

Collaboration diagram for ts::config::Builder:
Collaboration graph
[legend]

Data Structures

struct  Handler

Public Types

typedef Builder self

Public Member Functions

 Builder ()
 Default constructor.
virtual ~Builder ()
 Destructor.
 Builder (Configuration const &config)
 Construct with existing configuration.
Rv< Configurationbuild (Buffer const &buffer)
 Build the table.

Protected Member Functions

virtual void groupOpen (Token const &token)
 Dispatch methods.
virtual void groupClose (Token const &token)
virtual void groupName (Token const &token)
virtual void listOpen (Token const &token)
virtual void listClose (Token const &token)
virtual void pathOpen (Token const &token)
virtual void pathTag (Token const &token)
virtual void pathIndex (Token const &token)
virtual void pathClose (Token const &token)
virtual void literalValue (Token const &token)
virtual void invalidToken (Token const &token)
virtual int syntaxError (char const *text)
 Syntax error handler.
selfinit ()
 Initialization, called from constructors.

Static Protected Member Functions

static void dispatch (void *data, Token *token)
 Static method to handle parser event callbacks.
static int syntaxErrorDispatch (void *data, char const *text)
 Static method for syntax errors.

Protected Attributes

Handler _dispatch [TS_CONFIG_N_EVENT_TYPES]
 Dispatch table for parse events.
TsConfigHandlers _handlers
 Event handler table for the parser.
Configuration _config
 Configuration to update.
Errata _errata
 Error accumulator.
Value _v
 Current value.
Buffer _name
 Pending group name, if any.
Buffer _extent
 Accumulator for multi-token text.
Location _loc
 Cache for multi-token text.
Path _path
 Path accumulator.

Detailed Description

Class to build the configuration table from parser events.

Definition at line 35 of file TsBuilder.h.


Member Typedef Documentation

Definition at line 37 of file TsBuilder.h.


Constructor & Destructor Documentation

ts::config::Builder::Builder (  )  [inline]

Default constructor.

Definition at line 96 of file TsBuilder.h.

References init().

virtual ts::config::Builder::~Builder (  )  [inline, virtual]

Destructor.

Definition at line 50 of file TsBuilder.h.

ts::config::Builder::Builder ( Configuration const &  config  )  [inline]

Construct with existing configuration.

Definition at line 97 of file TsBuilder.h.

References init().


Member Function Documentation

Rv< Configuration > ts::config::Builder::build ( Buffer const &  buffer  ) 

Build the table.

Returns:
The configuration or error status.
Parameters:
buffer Input text.

Definition at line 125 of file TsBuilder.cc.

References _config, _errata, _handlers, ts::Buffer::_ptr, ts::Buffer::_size, _v, ts::Errata::clear(), ts::config::Configuration::getRoot(), ts::MakeRv(), and tsconfig_parse_buffer().

void ts::config::Builder::dispatch ( void *  data,
Token token 
) [static, protected]

Static method to handle parser event callbacks.

Definition at line 93 of file TsBuilder.cc.

References ts::config::Builder::Handler::_method, ts::config::Builder::Handler::_ptr, ts::msg::logf(), PRE, and ts::msg::WARN.

void ts::config::Builder::groupClose ( Token const &  token  )  [protected, virtual]

Definition at line 137 of file TsBuilder.cc.

References _v, and ts::config::Value::getParent().

void ts::config::Builder::groupName ( Token const &  token  )  [protected, virtual]

Definition at line 140 of file TsBuilder.cc.

References Token::_n, _name, Token::_s, and ts::Buffer::set().

void ts::config::Builder::groupOpen ( Token const &  token  )  [protected, virtual]
Builder & ts::config::Builder::init ( void   )  [protected]
void ts::config::Builder::invalidToken ( Token const &  token  )  [protected, virtual]

Definition at line 212 of file TsBuilder.cc.

void ts::config::Builder::listClose ( Token const &  token  )  [protected, virtual]

Definition at line 147 of file TsBuilder.cc.

References _v, and ts::config::Value::getParent().

void ts::config::Builder::listOpen ( Token const &  token  )  [protected, virtual]
void ts::config::Builder::literalValue ( Token const &  token  )  [protected, virtual]
void ts::config::Builder::pathClose ( Token const &  token  )  [protected, virtual]
void ts::config::Builder::pathIndex ( Token const &  token  )  [protected, virtual]
void ts::config::Builder::pathOpen ( Token const &  token  )  [protected, virtual]

Definition at line 151 of file TsBuilder.cc.

References _extent, _path, ts::Buffer::reset(), and ts::config::Path::reset().

void ts::config::Builder::pathTag ( Token const &  token  )  [protected, virtual]
int ts::config::Builder::syntaxError ( char const *  text  )  [protected, virtual]

Syntax error handler.

Definition at line 116 of file TsBuilder.cc.

References _errata, ts::msg::logf(), tsconfiglex_current_col(), tsconfiglex_current_line(), and ts::msg::WARN.

Referenced by syntaxErrorDispatch().

int ts::config::Builder::syntaxErrorDispatch ( void *  data,
char const *  text 
) [static, protected]

Static method for syntax errors.

Definition at line 111 of file TsBuilder.cc.

References syntaxError().


Field Documentation

Configuration to update.

Definition at line 83 of file TsBuilder.h.

Referenced by build().

Handler ts::config::Builder::_dispatch[TS_CONFIG_N_EVENT_TYPES] [protected]

Dispatch table for parse events.

Definition at line 60 of file TsBuilder.h.

Referenced by init().

Error accumulator.

Definition at line 84 of file TsBuilder.h.

Referenced by build(), literalValue(), and syntaxError().

Accumulator for multi-token text.

Definition at line 87 of file TsBuilder.h.

Referenced by pathClose(), pathIndex(), pathOpen(), and pathTag().

Event handler table for the parser.

Definition at line 62 of file TsBuilder.h.

Referenced by build(), and init().

Cache for multi-token text.

Definition at line 88 of file TsBuilder.h.

Referenced by pathClose(), and pathTag().

Pending group name, if any.

Definition at line 86 of file TsBuilder.h.

Referenced by groupName(), groupOpen(), listOpen(), literalValue(), and pathClose().

Path accumulator.

Definition at line 89 of file TsBuilder.h.

Referenced by pathClose(), pathIndex(), pathOpen(), and pathTag().

Current value.

Definition at line 85 of file TsBuilder.h.

Referenced by build(), groupClose(), groupOpen(), listClose(), listOpen(), literalValue(), and pathClose().


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