//: TDocFile.C /* @(#)root/base:$Name: $:$Id: TDocFile.C,v 1.2 2004-12-05 17:22:05+01 veghj Exp $ */ /* \author (c) János Végh, MTA ATOMKI, Debrecen, Hungary (veghj@users.sf.net) \since May 21, 2005 $Id: TDocFile.C,v 1.2 2004-12-05 17:22:05+01 veghj Exp $ */ #ifndef ewa_rootdocfileh #define ewa_rootdocfileh #if !defined(__CINT__) #include "Riostream.h" #include "TObject.h" #include "TString.h" #include "TObjString.h" #include "TObjArray.h" #endif // Define the document file class class TDocFile : public TObject { protected: TString fFileName; // Name of the file ifstream *fstream; // The input stream int fNoOfTokens; // Tokens in this line int fCurrentTokenNo; // Seq no of current token int fCurrentLineNo; // Seq no of current text line int m_FormError; // Code of form error TString fCurrentLine; // Current text line TObjArray *fTokens; // Token in current line TString fDelimiters; // Delimiters for token reading private: void Reset(TString FName = ""); // Reset internal variables void LoadCurrentLine(char *buf); // Load current line with buffer public: TDocFile(TString FName = ""); ~TDocFile(void); Bool_t eof(void); void EmptyTokenBuffer(void) { LoadCurrentLine("");} Int_t GetASCIIDouble(Double_t &D); Int_t GetASCIILong(Long_t &L); Bool_t GetASCIIString(TString &T, int &length); Bool_t GetBinaryByte(unsigned char &C); Bool_t GetBinaryDouble(double &D); Long_t GetCurrentLineNo(void){ return fCurrentLineNo;} Bool_t GetCurrentLine(TString &T); Bool_t GetCurrentToken(TString &T); TString &GetDelimiters(void){ return fDelimiters; } Int_t GetFileLength(void); TString GetFileName(void){ return fFileName;} Int_t GetFormError(void); Bool_t GetNextToken(TString &T); Int_t GetNoOfLines(void); Bool_t HasMoreTokens(void); Bool_t HasMoreTokensInLine(void); Bool_t IsOpen(void); Bool_t ReadNextLine(void); // Read next text line from stream void SetDelimiters(TString Delim) {fDelimiters = Delim; } // Delimiters for token reading void SetFileName(TString FName); #if !defined(__CINT__) // Define the class for the cint dictionary ClassDef(TDocFile,1); // A general document file class #endif }; /// Define form errors enum TextNumberErrors { feOK = 0, feNoArg = 1, feFloat = 2, feInteger = 3 }; #endif //ewa_rootdocfileh