source: tags/ms_r18q1/CORE/MultiFileReader.h

Last change on this file was 16763, checked in by westram, 6 years ago
File size: 1.4 KB
Line 
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
21class 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
34public:
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
Note: See TracBrowser for help on using the repository browser.