Logo ROOT   6.07/09
Reference Guide
List of all members | Public Member Functions | Protected Attributes | List of all members
RooStreamParser Class Reference

Definition at line 22 of file RooStreamParser.h.

Public Member Functions

 RooStreamParser (std::istream &is)
 Construct parser on given input stream. More...
 
 RooStreamParser (std::istream &is, const TString &errPrefix)
 Construct parser on given input stream. More...
 
virtual ~RooStreamParser ()
 Destructor. More...
 
Bool_t atEOF ()
 
Bool_t atEOL ()
 If true, parser is at end of line in stream. More...
 
Bool_t convertToDouble (const TString &token, Double_t &value)
 Convert given string to a double. Return true if the conversion fails. More...
 
Bool_t convertToInteger (const TString &token, Int_t &value)
 Convert given string to an Int_t. More...
 
Bool_t convertToString (const TString &token, TString &string)
 Convert given token to a string (i.e. remove eventual quotation marks) More...
 
Bool_t expectToken (const TString &expected, Bool_t zapOnError=kFALSE)
 Read the next token and return kTRUE if it is identical to the given 'expected' token. More...
 
TString getPunctuation () const
 
Bool_t isPunctChar (char c) const
 Check if given char is considered punctuation. More...
 
Bool_t readDouble (Double_t &value, Bool_t zapOnError=kFALSE)
 Read the next token and convert it to a Double_t. More...
 
Bool_t readInteger (Int_t &value, Bool_t zapOnError=kFALSE)
 Read a token and convert it to an Int_t. More...
 
TString readLine ()
 Read an entire line from the stream and return as TString This method recognizes the use of '\' in the istream as line continuation token. More...
 
Bool_t readString (TString &value, Bool_t zapOnError=kFALSE)
 Read a string token. More...
 
TString readToken ()
 Read one token separated by any of the know punctuation characters This function recognizes and handles comment lines in the istream (those starting with '#', quoted strings ("") the content of which is not tokenized and '+-. More...
 
void setPunctuation (const TString &punct)
 Change list of characters interpreted as punctuation. More...
 
void zapToEnd (Bool_t inclContLines=kFALSE)
 Eat all characters up to and including then end of the current line. More...
 

Protected Attributes

Bool_t _atEOF
 
Bool_t _atEOL
 
std::istream * _is
 
TString _prefix
 
TString _punct
 

#include <RooStreamParser.h>

Constructor & Destructor Documentation

RooStreamParser::RooStreamParser ( std::istream &  is)

Construct parser on given input stream.

Definition at line 61 of file RooStreamParser.cxx.

RooStreamParser::RooStreamParser ( std::istream &  is,
const TString errorPrefix 
)

Construct parser on given input stream.

Use given errorPrefix to prefix any parsing error messages

Definition at line 71 of file RooStreamParser.cxx.

RooStreamParser::~RooStreamParser ( )
virtual

Destructor.

Definition at line 81 of file RooStreamParser.cxx.

Member Function Documentation

Bool_t RooStreamParser::atEOF ( )
inline

Definition at line 45 of file RooStreamParser.h.

Bool_t RooStreamParser::atEOL ( )

If true, parser is at end of line in stream.

Definition at line 90 of file RooStreamParser.cxx.

Bool_t RooStreamParser::convertToDouble ( const TString token,
Double_t value 
)

Convert given string to a double. Return true if the conversion fails.

Definition at line 424 of file RooStreamParser.cxx.

Bool_t RooStreamParser::convertToInteger ( const TString token,
Int_t value 
)

Convert given string to an Int_t.

Returns true if an error occurred in conversion

Definition at line 464 of file RooStreamParser.cxx.

Bool_t RooStreamParser::convertToString ( const TString token,
TString string 
)

Convert given token to a string (i.e. remove eventual quotation marks)

Definition at line 497 of file RooStreamParser.cxx.

Bool_t RooStreamParser::expectToken ( const TString expected,
Bool_t  zapOnError = kFALSE 
)

Read the next token and return kTRUE if it is identical to the given 'expected' token.

Definition at line 392 of file RooStreamParser.cxx.

TString RooStreamParser::getPunctuation ( ) const
inline

Definition at line 33 of file RooStreamParser.h.

Bool_t RooStreamParser::isPunctChar ( char  c) const

Check if given char is considered punctuation.

Definition at line 111 of file RooStreamParser.cxx.

Bool_t RooStreamParser::readDouble ( Double_t value,
Bool_t  zapOnError = kFALSE 
)

Read the next token and convert it to a Double_t.

Returns true if an error occurred in reading or conversion

Definition at line 411 of file RooStreamParser.cxx.

Bool_t RooStreamParser::readInteger ( Int_t value,
Bool_t  zapOnError = kFALSE 
)

Read a token and convert it to an Int_t.

Returns true if an error occurred in reading or conversion

Definition at line 451 of file RooStreamParser.cxx.

TString RooStreamParser::readLine ( )

Read an entire line from the stream and return as TString This method recognizes the use of '\' in the istream as line continuation token.

Definition at line 309 of file RooStreamParser.cxx.

Bool_t RooStreamParser::readString ( TString value,
Bool_t  zapOnError = kFALSE 
)

Read a string token.

Returns true if an error occurred in reading or conversion. If a the read token is enclosed in quotation marks those are stripped in the returned value

Definition at line 485 of file RooStreamParser.cxx.

TString RooStreamParser::readToken ( )

Read one token separated by any of the know punctuation characters This function recognizes and handles comment lines in the istream (those starting with '#', quoted strings ("") the content of which is not tokenized and '+-.

' characters that are part of a floating point numbers and are exempt from being interpreted as a token separator in case '+-.' are defined as token separators.

Definition at line 131 of file RooStreamParser.cxx.

void RooStreamParser::setPunctuation ( const TString punct)

Change list of characters interpreted as punctuation.

Definition at line 101 of file RooStreamParser.cxx.

void RooStreamParser::zapToEnd ( Bool_t  inclContLines = kFALSE)

Eat all characters up to and including then end of the current line.

If inclContLines is kTRUE, all continuation lines marked by the '\' token are zapped as well

Definition at line 358 of file RooStreamParser.cxx.

Member Data Documentation

Bool_t RooStreamParser::_atEOF
protected

Definition at line 54 of file RooStreamParser.h.

Bool_t RooStreamParser::_atEOL
protected

Definition at line 53 of file RooStreamParser.h.

std::istream* RooStreamParser::_is
protected

Definition at line 52 of file RooStreamParser.h.

TString RooStreamParser::_prefix
protected

Definition at line 55 of file RooStreamParser.h.

TString RooStreamParser::_punct
protected

Definition at line 56 of file RooStreamParser.h.


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