Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

error.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  $RCSfile: error.h,v $
00003                              -------------------
00004     cvs         : $Id: error.h,v 1.22 2003/06/07 20:22:19 aquamaniac Exp $
00005     begin       : Sun Nov 18 2001
00006     copyright   : (C) 2001 by Martin Preuss
00007     email       : openhbci@aquamaniac.de
00008 
00009  ***************************************************************************
00010  *                                                                         *
00011  *   This library is free software; you can redistribute it and/or         *
00012  *   modify it under the terms of the GNU Lesser General Public            *
00013  *   License as published by the Free Software Foundation; either          *
00014  *   version 2.1 of the License, or (at your option) any later version.    *
00015  *                                                                         *
00016  *   This library is distributed in the hope that it will be useful,       *
00017  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00018  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00019  *   Lesser General Public License for more details.                       *
00020  *                                                                         *
00021  *   You should have received a copy of the GNU Lesser General Public      *
00022  *   License along with this library; if not, write to the Free Software   *
00023  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston,                 *
00024  *   MA  02111-1307  USA                                                   *
00025  *                                                                         *
00026  ***************************************************************************/
00027 
00028 
00029 #ifndef HBCIERROR_H
00030 #define HBCIERROR_H
00031 
00036 #include <openhbci/dllimport.h>
00037 
00038 
00040 typedef enum ErrorLevel {
00042     ERROR_LEVEL_NONE     = 0,
00044     ERROR_LEVEL_EASY,
00046     ERROR_LEVEL_NORMAL,
00048     ERROR_LEVEL_CRITICAL,
00050     ERROR_LEVEL_PANIC,
00052     ERROR_LEVEL_INTERNAL
00053 } ErrorLevel;
00054 
00056 typedef enum ErrorAdvise {
00058     ERROR_ADVISE_DONTKNOW = 0,
00060     ERROR_ADVISE_IGNORE   = 1,
00062     ERROR_ADVISE_RETRY    = 2,
00064     ERROR_ADVISE_ABORT    = 100,
00066     ERROR_ADVISE_SHUTDOWN = 101
00067 } ErrorAdvise;
00068 
00070 enum ErrorCodes {
00072     HBCI_ERROR_CODE_UNKNOWN = 0,
00074     HBCI_ERROR_CODE_PIN_WRONG = 100,
00076     HBCI_ERROR_CODE_PIN_WRONG_0,
00078     HBCI_ERROR_CODE_PIN_WRONG_1,
00080     HBCI_ERROR_CODE_PIN_WRONG_2,
00082     HBCI_ERROR_CODE_PIN_ABORTED,
00084     HBCI_ERROR_CODE_PIN_TOO_SHORT,
00086     HBCI_ERROR_CODE_CARD_DESTROYED,
00088     HBCI_ERROR_CODE_FILE_NOT_FOUND,
00090     HBCI_ERROR_CODE_NO_CARD,
00095     HBCI_ERROR_CODE_JOB_NOT_SUPPORTED,
00098     HBCI_ERROR_CODE_SOCKET_NO_CONNECT,
00100     HBCI_ERROR_CODE_SOCKET_ERROR_TIMEOUT,
00102     HBCI_ERROR_CODE_SOCKET_ERROR_INTERRUPT,
00104     HBCI_ERROR_CODE_SOCKET_ERROR_UNKNOWN,
00106     HBCI_ERROR_CODE_WRONG_MEDIUM,
00108     HBCI_ERROR_CODE_LIBRARY,
00110     HBCI_ERROR_CODE_EXISTS,
00112     HBCI_ERROR_CODE_INEXISTENT,
00114     HBCI_ERROR_CODE_INVALID,
00116     HBCI_ERROR_CODE_MEDIUM,
00118     HBCI_ERROR_CODE_UNSUPPORTED,
00123     HBCI_ERROR_CODE_BAD_MEDIUM,
00125     HBCI_ERROR_CODE_USER_ABORT,
00127     HBCI_ERROR_CODE_UNKNOWN_PROPERTY,
00129     HBCI_ERROR_CODE_INVALID_VALUE,
00131     HBCI_ERROR_CODE_PROPERTY_READONLY
00132 };
00133 
00134 /* Make this header able to be included by both C++ and C. First the
00135    class definition for the C++ library. */
00136 #ifdef __cplusplus
00137 #include <string>
00138 
00139 namespace HBCI {
00140 using namespace std;
00141 class Error;
00142 
00150 class DLLIMPORT Error {
00151 private:
00152     string _where;
00153     ErrorLevel _level;
00154     int _code;
00155     ErrorAdvise _advise;
00156     string _message;
00157     string _info;
00158     string _reportedFrom;
00159 
00160 public:
00168     Error();
00169 
00175     Error(string where,
00176           string message,
00177           int code);
00178 
00212     Error(string where,
00213           ErrorLevel level,
00214           int code,
00215           ErrorAdvise advise,
00216           string message,
00217           string info="");
00218 
00252     Error(const string &where,
00253           const Error &err);
00254 
00255     ~Error();
00256 
00262     bool isOk() const { return _level==ERROR_LEVEL_NONE; };
00263 
00268     const string& where() const {return _where; };
00269 
00277     int code() const { return _code; };
00278 
00283     const string& message() const { return _message;};
00284 
00289     ErrorLevel level() const { return _level; };
00290 
00295     ErrorAdvise advise() const { return _advise; };
00296 
00301     const string& info() const { return _info; };
00302 
00307     string errorString() const;
00308 
00309 
00310 };
00311 
00312 } /* namespace HBCI */
00313 
00314 typedef struct HBCI::Error HBCI_Error;
00315 
00316 /* Now the typedefs and function prototypes for C. */
00317 #else /* __cplusplus */
00318 typedef struct HBCI_Error HBCI_Error;
00319 #endif /* __cplusplus */
00320 
00321 #ifdef __cplusplus
00322 extern "C" {
00323 #endif
00324 
00329     extern HBCI_Error* HBCI_Error_new(const char* where,
00330                                   ErrorLevel level,
00331                                   int code,
00332                                   ErrorAdvise advise,
00333                                   const char* error,
00334                                   const char* info);
00335 
00340     extern void HBCI_Error_delete(HBCI_Error* e);
00341 
00347     extern int HBCI_Error_isOk(const HBCI_Error * );
00348 
00355     extern const char * HBCI_Error_where(const HBCI_Error * );
00356 
00365     extern int HBCI_Error_code(const HBCI_Error * );
00366 
00371     extern ErrorLevel HBCI_Error_level(const HBCI_Error * );
00372 
00377     extern ErrorAdvise HBCI_Error_advise(const HBCI_Error * ); 
00378 
00385     extern const char * HBCI_Error_message(const HBCI_Error * );
00386 
00392     extern const char * HBCI_Error_info(const HBCI_Error * ); 
00393 
00402     extern char * HBCI_Error_errorString(const HBCI_Error * );
00403 
00404 #ifdef __cplusplus
00405 }
00406 #endif
00407 
00408 
00409 #endif

Generated on Mon Jun 23 13:41:07 2003 for openhbci by doxygen1.2.17