Debian Codegraph @

data/0.12-dev/src/FileArray.h

raw
1 /*
2 * AikSaurus - An open source thesaurus library
3 * Copyright (C) 2001 by Jared Davis
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
18 * 02111-1307, USA.
19 *
20 */
21
22 #ifndef INCLUDED_FILEARRAY_H
23 #define INCLUDED_FILEARRAY_H
24
25 #include <cstdio>
26
27 class FileArray
28 {
29 private:
30
31 // Prevent copying and assignment.
32 FileArray(const FileArray& rhs);
33 FileArray& operator=(const FileArray& rhs);
34
35 // Pointer to an ANSI-C file structure
36 mutable FILE* d_file;
37
38 // Size of structures held by the file.
39 const long d_structsize;
40
41 // File size in bytes.
42 mutable bool d_bytes_cached;
43 mutable long d_bytes;
44
45
46 public:
47
48 FileArray(const char* file, long structsize, bool& ok);
49 ~FileArray();
50
51 long getBytes() const;
52 long getStructSize() const;
53
54 bool at(long position, unsigned char* buf) const;
55 };
56
57 #endif // INCLUDED_FILEARRAY_H
58