/************************************************************************** * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * * * Author: The ALICE Off-line Project. * * Contributors are mentioned in the code where appropriate. * * * * Permission to use, copy, modify and distribute this software and its * * documentation strictly for non-commercial purposes is hereby granted * * without fee, provided that the above copyright notice appears in all * * copies and that both the copyright notice and this permission notice * * appear in the supporting documentation. The authors make no claims * * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ /* $Id$ */ // Authors: David Guez, Ivana Hrivnacova, Marion MacCormick; IPN Orsay // // Class AliMUONIniReader // ---------------------- // General class to read data in ASCII file format, // similar to the Windows ".ini" files (a set of sections tagged by a // [ sectionName ] // and values defined in the way: // parameterName = value // // comment lines can be introduced if the first non-blank character // is either ';' or '#' // Included in AliRoot 2003/01/28 #if !defined(__HP_aCC) && !defined(__alpha) #include #endif #include #include #include "AliMUONSt1IniReader.h" //______________________________________________________________________ AliMUONSt1IniReader::AliMUONSt1IniReader() :fFile(),fCurrentType(kUndef),fEndOfFile(true) { // default constructor // --- } //______________________________________________________________________ AliMUONSt1IniReader::AliMUONSt1IniReader(string fileName) { // normal constructor // --- fFile.open(fileName.c_str()); if (!fFile) {cerr<<"Unable to open file "<>c; if ( (c==';') || (c=='#') ) { // this is a comment return ReadNextLine(); } if (c=='[') { // this is a chapter name getline(l,fCurrentName,']'); fCurrentName=Trail(fCurrentName); fCurrentType=kChapter; return true; } else { if (line.find_first_of("=") != string::npos ) { l.putback(c); getline(l,fCurrentName,'='); fCurrentName = Trail(fCurrentName); getline(l,fCurrentValue); fCurrentValue = Trail(fCurrentValue); fCurrentType=kValue; return true; } else { cerr<<"Warning, badly formated line..."< // --- string::size_type p1=s.find_first_not_of(" "); if (p1==string::npos) return ""; string::size_type p2=s.find_last_not_of(" "); return s.substr(p1,p2-p1+1); }