| 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_MEANINGSFILE_H |
| 23 |
#define INCLUDED_MEANINGSFILE_H |
| 24 |
|
| 25 |
#include <cstdio> |
| 26 |
#include "AiksaurusErrors.h" |
| 27 |
|
| 28 |
namespace AiksaurusImpl |
| 29 |
{ |
| 30 |
// Forward Declaration (See MeaningsFile.cpp) |
| 31 |
class MeaningStream; |
| 32 |
|
| 33 |
class MeaningsFile |
| 34 |
{ |
| 35 |
private: |
| 36 |
|
| 37 |
// Offset information for hash structure. |
| 38 |
static const int s_offsetModulus; |
| 39 |
static const int s_offsetData[]; |
| 40 |
static const int s_dataMaxLineLength; |
| 41 |
|
| 42 |
// No copying or assignment allowed. |
| 43 |
MeaningsFile(const MeaningsFile& rhs); |
| 44 |
MeaningsFile& operator=(const MeaningsFile& rhs); |
| 45 |
|
| 46 |
// Error reporting mechanism. |
| 47 |
AiksaurusError d_error; |
| 48 |
|
| 49 |
// Pointer to the actual meanings file. |
| 50 |
FILE* d_file_ptr; |
| 51 |
|
| 52 |
int _readline(MeaningStream& s, int* buffer); |
| 53 |
|
| 54 |
|
| 55 |
public: |
| 56 |
|
| 57 |
// Creation and Destruction |
| 58 |
MeaningsFile(const char* fname); |
| 59 |
~MeaningsFile(); |
| 60 |
|
| 61 |
// Word Lookup |
| 62 |
int* getWords(int id); |
| 63 |
|
| 64 |
// Error Checking |
| 65 |
const AiksaurusError& getError() const; |
| 66 |
}; |
| 67 |
|
| 68 |
} |
| 69 |
|
| 70 |
#endif // INCLUDED_MEANINGSFILE_H |
| 71 |
|