| 1 |
#include "AiksaurusErrors.h" |
| 2 |
#include "config.h" |
| 3 |
#include <cassert> |
| 4 |
|
| 5 |
namespace AiksaurusImpl |
| 6 |
{ |
| 7 |
const char* AiksaurusError::SUCCESS = ""; |
| 8 |
|
| 9 |
const char* AiksaurusError::CANNOT_OPEN_MEANINGS_FILE = |
| 10 |
"Error: Cannot Open Meanings File\n" |
| 11 |
"There has been a problem opening the file \"" |
| 12 |
AIK_DATA_DIR |
| 13 |
"meanings.dat\".\n" |
| 14 |
"This most likely indicates that the file has been " |
| 15 |
"moved or deleted. If you cannot find the file, you " |
| 16 |
"can download a new copy from: \n" |
| 17 |
" http://www.aiksaurus.com/_support/012/meanings.dat\n"; |
| 18 |
|
| 19 |
const char* AiksaurusError::CANNOT_OPEN_WORDS_FILE = |
| 20 |
"Error: Cannot Open Words File\n" |
| 21 |
"There has been a problem opening the file \"" |
| 22 |
AIK_DATA_DIR |
| 23 |
"words.dat\".\n" |
| 24 |
"This most likely indicates that the file has been " |
| 25 |
"moved or deleted. If you cannot find the file, you " |
| 26 |
"can download a new copy from: \n" |
| 27 |
" http://www.aiksaurus.com/_support/012/words.dat\n"; |
| 28 |
|
| 29 |
const char* AiksaurusError::CORRUPT_MEANINGS_FILE = |
| 30 |
"Error: Corrupt Meanings File\n" |
| 31 |
"There has been a problem reading the file \"" |
| 32 |
AIK_DATA_DIR |
| 33 |
"meanings.dat\".\n" |
| 34 |
"The file exists, but was not read correctly. Either " |
| 35 |
"the file has become corrupt or this is a bug. \n" |
| 36 |
"Please download a new copy of the file from: \n" |
| 37 |
" http://www.aiksaurus.com/_support/012/meanings.dat\n" |
| 38 |
"If this does not fix the problem, please contact \n" |
| 39 |
" [email protected]\n"; |
| 40 |
|
| 41 |
const char* AiksaurusError::CORRUPT_WORDS_FILE = |
| 42 |
"Error: Corrupt Words File\n" |
| 43 |
"There has been a problem reading the file \"" |
| 44 |
AIK_DATA_DIR |
| 45 |
"words.dat\".\n" |
| 46 |
"The file exists, but was not read correctly. Either " |
| 47 |
"the file has become corrupt or this is a bug. \n" |
| 48 |
"Please download a new copy of the file from: \n" |
| 49 |
" http://www.aiksaurus.com/_support/012/words.dat\n" |
| 50 |
"If this does not fix the problem, please contact \n" |
| 51 |
" [email protected]\n"; |
| 52 |
|
| 53 |
const char* AiksaurusError::CANNOT_ALLOCATE_MEMORY = |
| 54 |
"Error: Cannot Allocate Memory\n" |
| 55 |
"No memory was available for the Thesaurus. You " |
| 56 |
"could try closing some other programs to make more " |
| 57 |
"memory available.\n"; |
| 58 |
} |
| 59 |
|
| 60 |
AiksaurusImpl::AiksaurusError::AiksaurusError() |
| 61 |
: d_description(SUCCESS) |
| 62 |
{ |
| 63 |
|
| 64 |
} |
| 65 |
|
| 66 |
|
| 67 |
AiksaurusImpl::AiksaurusError::~AiksaurusError() |
| 68 |
{ |
| 69 |
|
| 70 |
} |
| 71 |
|
| 72 |
|
| 73 |
bool |
| 74 |
AiksaurusImpl::AiksaurusError::isError() const |
| 75 |
{ |
| 76 |
return (d_description[0] != 0); |
| 77 |
} |
| 78 |
|
| 79 |
void |
| 80 |
AiksaurusImpl::AiksaurusError::setDescription(const char* str) |
| 81 |
{ |
| 82 |
assert( |
| 83 |
(str == SUCCESS) || |
| 84 |
(str == CANNOT_OPEN_MEANINGS_FILE) || |
| 85 |
(str == CORRUPT_MEANINGS_FILE) || |
| 86 |
(str == CANNOT_OPEN_WORDS_FILE) || |
| 87 |
(str == CORRUPT_WORDS_FILE) || |
| 88 |
(str == CANNOT_ALLOCATE_MEMORY) |
| 89 |
); |
| 90 |
|
| 91 |
d_description = str; |
| 92 |
} |
| 93 |
|
| 94 |
|
| 95 |
const char* |
| 96 |
AiksaurusImpl::AiksaurusError::getDescription() const |
| 97 |
{ |
| 98 |
return d_description; |
| 99 |
} |