25 err.SetDescription(
"");
26 std::string fname = filename;
28 bool isReader =
false;
34 err.SetDescription(
"No files being read by the reader in this sequence");
51 size_t dotpos = fname.find_last_of(
".");
52 std::string fileExtension =
"";
53 if(dotpos != std::string::npos)
54 fileExtension = fname.substr( dotpos );
57 std::list<const QGlobalReaderFactory*>::iterator iter;
58 for(iter = readerFactories.begin(); iter!= readerFactories.end(); iter++)
59 if((*iter)->GetExt() == fileExtension)
63 if(fileExtension ==
".root") {
67 else if(fileExtension ==
".txt") {
71 else if(fileExtension ==
".hdr") {
76 else if(fileExtension ==
".gui") {
81 for(iter = readerFactories.begin(); iter!= readerFactories.end(); iter++)
82 if((*iter)->GetExt() == fileExtension)
89 err.SetDescription(
GetName(),__LINE__, std::string(
"No reader found for extension: \"") + fileExtension +
"\"" +
" (file: "+ fname +
")");
114 std::map<std::string, QGlobalReader*>::iterator iter;
116 (*iter).second->Close();
117 if((*iter).second)
delete (*iter).second;
error class with error type and description
std::list< const QGlobalReaderFactory * > GetListOfGlobalReaders() const
QGlobalReader * CreateGlobalReader(const std::string &name)
static QGlobalRWFactory & GetInstance()
void LoadPlugin(const std::string &name)
Class that returns a pointer to the reader matching the given input filename.
std::map< std::string, QGlobalReader * > fReaders
QGlobalReader * GetReader(const std::string &filename, QError &err)
get reader
QGlobalReaderDispatcher()
~QGlobalReaderDispatcher()
std::string fCurrentReaderFilename
static QGlobalReaderDispatcher & GetInstance()
QGlobalReader * fLastReader
Abstract class for global readers.
virtual QError Open(const std::string &filename, const std::string &opt="")=0
Open file, called by QGlobalReaderDispatcher.
static void Info(const std::string &sender, const std::string &msg)
base class for anything that has a name
const std::string & GetName() const
the Diana namespace is needed because sometimes we use Qt libraries, that use same class names of our...