File: MultiFileReader.h

package info (click to toggle)
arb 6.0.6-8
  • links: PTS, VCS
  • area: non-free
  • in suites: sid, trixie
  • size: 66,204 kB
  • sloc: ansic: 394,911; cpp: 250,290; makefile: 19,644; sh: 15,879; perl: 10,473; fortran: 6,019; ruby: 683; xml: 503; python: 53; awk: 32
file content (44 lines) | stat: -rw-r--r-- 1,442 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// ============================================================= //
//                                                               //
//   File      : MultiFileReader.h                               //
//   Purpose   : Read multiple files like one concatenated file  //
//                                                               //
//   Coded by Ralf Westram (coder@reallysoft.de) in March 2014   //
//   http://www.arb-home.de/                                     //
//                                                               //
// ============================================================= //

#ifndef MULTIFILEREADER_H
#define MULTIFILEREADER_H

#ifndef BUFFEREDFILEREADER_H
#include <BufferedFileReader.h>
#endif
#ifndef ARB_STRARRAY_H
#include <arb_strarray.h>
#endif

class MultiFileReader : public LineReader { // derived from Noncopyable
    const CharPtrArray&  files;
    BufferedFileReader  *reader;
    BufferedFileReader  *last_reader;

    string *error;
    size_t  at;    // idx into 'files'

    bool getLine_intern(string& line) OVERRIDE;

    void nextReader();
    FILE *open(int i);

public:
    MultiFileReader(const CharPtrArray& files_);
    ~MultiFileReader();

    GB_ERROR get_error() const { return error ? error->c_str() : NULL; }
    const string& getFilename() const OVERRIDE; // @@@ rename (not necessarily a file)
};

#else
#error MultiFileReader.h included twice
#endif // MULTIFILEREADER_H