Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
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 
21 class RooStreamParser {
22 public:
23  // Constructors, assignment etc.
24  RooStreamParser(std::istream& is) ;
25  RooStreamParser(std::istream& is, const TString& errPrefix) ;
26  virtual ~RooStreamParser();
27 
28  TString readToken() ;
29  TString readLine() ;
30  Bool_t expectToken(const TString& expected, Bool_t zapOnError=kFALSE) ;
31  void setPunctuation(const TString& punct) ;
32  TString getPunctuation() const { return _punct ; }
33 
34  Bool_t readDouble(Double_t& value, Bool_t zapOnError=kFALSE) ;
35  Bool_t convertToDouble(const TString& token, Double_t& value) ;
36 
37  Bool_t readInteger(Int_t& value, Bool_t zapOnError=kFALSE) ;
38  Bool_t convertToInteger(const TString& token, Int_t& value) ;
39 
40  Bool_t readString(TString& value, Bool_t zapOnError=kFALSE) ;
41  Bool_t convertToString(const TString& token, TString& string) ;
42 
43  Bool_t atEOL() ;
44  inline Bool_t atEOF() { return _atEOF ; }
45  void zapToEnd(Bool_t inclContLines=kFALSE) ;
46 
47  Bool_t isPunctChar(char c) const ;
48 
49 protected:
50 
51  std::istream* _is ;
52  Bool_t _atEOL ;
53  Bool_t _atEOF ;
54  TString _prefix ;
55  TString _punct ;
56 
57 
58  ClassDef(RooStreamParser,0) // Utility class that parses std::iostream data into tokens
59 };
60 
61 #endif