Public Types | Public Member Functions | Protected Attributes

ts::config::Path::Parser Class Reference

Parser for path text. More...

#include <TsValue.h>

Collaboration diagram for ts::config::Path::Parser:
Collaboration graph
[legend]

Public Types

enum  Result { ERROR, TAG, INDEX, EOP }
 

Parsing result.

More...
typedef Parser self
 Self reference type.

Public Member Functions

 Parser ()
 Default constructor.
 Parser (ConstBuffer const &text)
 Construct with input.
selfsetInput (ConstBuffer const &text)
 Set the input text.
Rv< Resultparse (ConstBuffer *cbuff=0)
 Parse the next element in the path.
bool hasInput () const
 Check if input is available.

Protected Attributes

ConstBuffer _input
 Current input buffer.
char const * _c
 Next input character.

Detailed Description

Parser for path text.

This is restartable so a path can be parsed in pieces.

Definition at line 115 of file TsValue.h.


Member Typedef Documentation

Self reference type.

Definition at line 117 of file TsValue.h.


Member Enumeration Documentation

Parsing result.

Enumerator:
ERROR 

Bad input.

TAG 

Path tag.

INDEX 

Path index.

EOP 

End Of Path.

Definition at line 141 of file TsValue.h.


Constructor & Destructor Documentation

ts::config::Path::Parser::Parser (  )  [inline]

Default constructor.

Definition at line 725 of file TsValue.h.

ts::config::Path::Parser::Parser ( ConstBuffer const &  text  )  [inline]

Construct with input.

This default constructs the Parser then calls setInput with text. It is provided as a convenience as that will be the common use case.

See also:
setInput.
Parameters:
text Input text.

Definition at line 726 of file TsValue.h.


Member Function Documentation

bool ts::config::Path::Parser::hasInput (  )  const [inline]

Check if input is available.

Definition at line 727 of file TsValue.h.

References _c, _input, ts::ConstBuffer::_ptr, and ts::ConstBuffer::_size.

Referenced by parse().

Rv< Path::Parser::Result > ts::config::Path::Parser::parse ( ConstBuffer cbuff = 0  ) 

Parse the next element in the path.

cbuff may be NULL in which case no data about elements is available. In general this should be called until EOP or ERROR is returned, each call returning the next element.

Returns:
A parse Result.
  • TAG: A tag was found. The start and length are stored in cbuff.
  • INDEX: An index was found. The value is in cbuff._size.
  • EOP: No more path elements were found. Do not continue parsing.
  • ERROR: A syntax error was encountered. See the errata for detail. Do not continue parsing.
Parameters:
[out] cbuff Parsed path element.

Definition at line 227 of file TsValue.cc.

References _c, _input, ts::ConstBuffer::_size, hasInput(), ts::RvBase::isOK(), ts::msg::log(), ts::msg::logf(), ts::ConstBuffer::reset(), ts::ConstBuffer::set(), start, and ts::msg::WARN.

Referenced by ts::config::Value::find().

self& ts::config::Path::Parser::setInput ( ConstBuffer const &  text  ) 

Set the input text.

Parsing state is reset and the next parsing call will start at the beginning of text.

Parameters:
text Input buffer.

Field Documentation

char const* ts::config::Path::Parser::_c [protected]

Next input character.

Definition at line 169 of file TsValue.h.

Referenced by hasInput(), and parse().

Current input buffer.

Definition at line 168 of file TsValue.h.

Referenced by hasInput(), and parse().


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