/usr/include/presageException.h is in libpresage-dev 0.9-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | /******************************************************
* Presage, an extensible predictive text entry system
* ---------------------------------------------------
*
* Copyright (C) 2008 Matteo Vescovi <matteo.vescovi@yahoo.co.uk>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
**********(*)*/
#ifndef PRESAGE_EXCEPTION
#define PRESAGE_EXCEPTION
#ifdef __cplusplus
extern "C" {
#endif
typedef enum
{
PRESAGE_OK = 0, /* successful result */
PRESAGE_ERROR, /* generic/unknown presage error */
PRESAGE_TOKEN_PREFIX_MISMATCH_ERROR,
PRESAGE_SMOOTHED_NGRAM_PREDICTOR_LEARN_ERROR,
PRESAGE_CONFIG_VARIABLE_ERROR,
PRESAGE_INVALID_CALLBACK_ERROR,
PRESAGE_INVALID_SUGGESTION_ERROR,
PRESAGE_INIT_PREDICTOR_ERROR,
PRESAGE_SQLITE_OPEN_DATABASE_ERROR,
PRESAGE_SQLITE_EXECUTE_SQL_ERROR
} presage_error_code_t;
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
#ifndef _MSC_VER
#include <exception>
#include <string>
/** When thrown, provides information about an error that has occurred within presage.
*
* If an error occurs within presage, an exception is thrown, and
* this is the object that encapsulates the details of the problem.
*
* Application using presage should always ensure that exceptions
* are caught by enclosing all presage methods within a try{}
* catch(PresageException& e) {} block.
*
*/
class PresageException : public std::exception {
public:
PresageException(presage_error_code_t code, const std::string& msg) throw()
: m_details (msg),
m_code (code)
{
// intentionally empty
}
virtual ~PresageException() throw()
{
// intentionally empty
}
virtual const char* what() const throw()
{
return m_details.c_str();
}
virtual const presage_error_code_t code() const throw()
{
return m_code;
}
private:
std::string m_details;
presage_error_code_t m_code;
};
#endif /* _MSC_VER */
#endif /* __cplusplus */
#endif /* PRESAGE_EXCEPTION */
|