Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:11:27

0001 /*****************************************************************************
0002  * Project: RooFit                                                           *
0003  * Package: RooFitCore                                                       *
0004  *    File: $Id: RooStreamParser.h,v 1.17 2007/05/11 09:11:30 verkerke Exp $
0005  * Authors:                                                                  *
0006  *   WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu       *
0007  *   DK, David Kirkby,    UC Irvine,         dkirkby@uci.edu                 *
0008  *                                                                           *
0009  * Copyright (c) 2000-2005, Regents of the University of California          *
0010  *                          and Stanford University. All rights reserved.    *
0011  *                                                                           *
0012  * Redistribution and use in source and binary forms,                        *
0013  * with or without modification, are permitted according to the terms        *
0014  * listed in LICENSE (http://roofit.sourceforge.net/license.txt)             *
0015  *****************************************************************************/
0016 #ifndef ROO_STREAM_PARSER
0017 #define ROO_STREAM_PARSER
0018 
0019 #include "TString.h"
0020 
0021 class RooStreamParser {
0022 public:
0023   // Constructors, assignment etc.
0024   RooStreamParser(std::istream& is) ;
0025   RooStreamParser(std::istream& is, const TString& errPrefix) ;
0026   virtual ~RooStreamParser() = default;
0027 
0028   TString readToken() ;
0029   TString readLine() ;
0030   bool expectToken(const TString& expected, bool zapOnError=false) ;
0031   void setPunctuation(const TString& punct) ;
0032   TString getPunctuation() const { return _punct ; }
0033 
0034   bool readDouble(double& value, bool zapOnError=false) ;
0035   bool convertToDouble(const TString& token, double& value) ;
0036 
0037   bool readInteger(Int_t& value, bool zapOnError=false) ;
0038   bool convertToInteger(const TString& token, Int_t& value) ;
0039 
0040   bool readString(TString& value, bool zapOnError=false) ;
0041   bool convertToString(const TString& token, TString& string) ;
0042 
0043   bool atEOL() ;
0044   inline bool atEOF() { return _atEOF ; }
0045   void zapToEnd(bool inclContLines=false) ;
0046 
0047   bool isPunctChar(char c) const ;
0048 
0049 protected:
0050 
0051   std::istream* _is ;
0052   bool _atEOL ;
0053   bool _atEOF ;
0054   TString _prefix ;
0055   TString _punct ;
0056 
0057 
0058   ClassDef(RooStreamParser,0) // Utility class that parses std::iostream data into tokens
0059 };
0060 
0061 #endif