Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooStreamParser.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitCore *
4 * File: $Id: RooStreamParser.h,v 1.17 2007/05/11 09:11:30 verkerke Exp $
5 * Authors: *
6 * WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
7 * DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
8 * *
9 * Copyright (c) 2000-2005, Regents of the University of California *
10 * and Stanford University. All rights reserved. *
11 * *
12 * Redistribution and use in source and binary forms, *
13 * with or without modification, are permitted according to the terms *
14 * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
15 *****************************************************************************/
16#ifndef ROO_STREAM_PARSER
17#define ROO_STREAM_PARSER
18
19#include "TString.h"
20
22public:
23 // Constructors, assignment etc.
24 RooStreamParser(std::istream& is) ;
25 RooStreamParser(std::istream& is, const TString& errPrefix) ;
26 virtual ~RooStreamParser();
27
30 bool expectToken(const TString& expected, bool zapOnError=false) ;
31 void setPunctuation(const TString& punct) ;
32 TString getPunctuation() const { return _punct ; }
33
34 bool readDouble(double& value, bool zapOnError=false) ;
35 bool convertToDouble(const TString& token, double& value) ;
36
37 bool readInteger(Int_t& value, bool zapOnError=false) ;
38 bool convertToInteger(const TString& token, Int_t& value) ;
39
40 bool readString(TString& value, bool zapOnError=false) ;
41 bool convertToString(const TString& token, TString& string) ;
42
43 bool atEOL() ;
44 inline bool atEOF() { return _atEOF ; }
45 void zapToEnd(bool inclContLines=false) ;
46
47 bool isPunctChar(char c) const ;
48
49protected:
50
51 std::istream* _is ;
52 bool _atEOL ;
53 bool _atEOF ;
56
57
58 ClassDef(RooStreamParser,0) // Utility class that parses std::iostream data into tokens
59};
60
61#endif
#define c(i)
Definition RSha256.hxx:101
int Int_t
Definition RtypesCore.h:45
#define ClassDef(name, id)
Definition Rtypes.h:337
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
bool convertToInteger(const TString &token, Int_t &value)
Convert given string to an Int_t.
bool readString(TString &value, bool zapOnError=false)
Read a string token.
void setPunctuation(const TString &punct)
Change list of characters interpreted as punctuation.
bool isPunctChar(char c) const
Check if given char is considered punctuation.
virtual ~RooStreamParser()
Destructor.
bool expectToken(const TString &expected, bool zapOnError=false)
Read the next token and return true if it is identical to the given 'expected' token.
bool convertToDouble(const TString &token, double &value)
Convert given string to a double. Return true if the conversion fails.
bool atEOL()
If true, parser is at end of line in stream.
std::istream * _is
TString readLine()
Read an entire line from the stream and return as TString This method recognizes the use of '\' in th...
bool readDouble(double &value, bool zapOnError=false)
Read the next token and convert it to a double.
TString readToken()
Read one token separated by any of the know punctuation characters This function recognizes and handl...
TString getPunctuation() const
bool readInteger(Int_t &value, bool zapOnError=false)
Read a token and convert it to an Int_t.
void zapToEnd(bool inclContLines=false)
Eat all characters up to and including then end of the current line.
bool convertToString(const TString &token, TString &string)
Convert given token to a string (i.e. remove eventual quotation marks)
Basic string class.
Definition TString.h:139