ARB
MultiFileReader.h
Go to the documentation of this file.
1 // ============================================================= //
2 // //
3 // File : MultiFileReader.h //
4 // Purpose : Read multiple files like one concatenated file //
5 // //
6 // Coded by Ralf Westram (coder@reallysoft.de) in March 2014 //
7 // http://www.arb-home.de/ //
8 // //
9 // ============================================================= //
10 
11 #ifndef MULTIFILEREADER_H
12 #define MULTIFILEREADER_H
13 
14 #ifndef BUFFEREDFILEREADER_H
15 #include <BufferedFileReader.h>
16 #endif
17 #ifndef ARB_STRARRAY_H
18 #include <arb_strarray.h>
19 #endif
20 
21 class MultiFileReader FINAL_TYPE : public LineReader { // derived from Noncopyable
22  const CharPtrArray& files;
23  BufferedFileReader *reader;
24  BufferedFileReader *last_reader;
25 
26  string *error;
27  size_t at; // idx into 'files'
28 
29  bool getLine_intern(string& line) OVERRIDE;
30 
31  void nextReader();
32  FILE *open(int i);
33 
34 public:
35  MultiFileReader(const CharPtrArray& files_);
36  ~MultiFileReader();
37 
38  GB_ERROR get_error() const { return error ? error->c_str() : NULp; }
39  const string& getFilename() const OVERRIDE; // @@@ rename (not necessarily a file)
40 };
41 
42 #else
43 #error MultiFileReader.h included twice
44 #endif // MULTIFILEREADER_H
GB_ERROR get_error() const
static void error(const char *msg)
Definition: mkptypes.cxx:96
virtual const string & getFilename() const =0
xml element
#define OVERRIDE
Definition: cxxforward.h:93
static int line
Definition: arb_a2ps.c:296
#define NULp
Definition: cxxforward.h:97