Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

seException.h

Go to the documentation of this file.
00001 /*
00002  *  Copyright (c) 2003 Accent Geographic. All rights reserved.
00003  *  See the license file for licensing information.
00004  *  Created 2003/05/30
00005  */
00006 

00008 

00010 
00011 // $Id: seException.h,v 1.7 2004/06/02 18:17:29 wmacchi Exp $
00012 
00013 #ifndef _seException_h
00014 #define _seException_h
00015 
00021 /*
00022 This file is used for both "implementation" and "interface" (the C++
00023 classes for the DRM), so that one common seException class is used in both.
00024 The master resides in "implementation", and a copy is made for the
00025 "interface" folder.
00026 */
00027 
00028 namespace sedris {
00029 
00039 class seException
00040 {
00041 public:
00042 
00043     enum {
00045         MAX_EXCEPTION_STR_LEN = 2000
00046     };
00047 
00049     enum seExceptionCode
00050     {
00052         NOT_IMPLEMENTED = 0,
00053 
00063         TRANSMITTAL_INACCESSIBLE = 3,
00064 
00071         UNRESOLVED_TRANSMITTAL,
00072 
00094         INVALID_ACCESS_MODE,
00095 
00102         UNSUPPORTED_ENCODING,
00103 
00110         INVALID_TRANSMITTAL_URN,
00111 
00121         UNPUBLISHED_OBJECT,
00122 
00128         UNRESOLVED_OBJECT,
00129 
00139         INVALID_OBJECT_LABEL = 11,
00140 
00145         DELETED_OBJECT = 13,
00146 
00153         INACTIONABLE_FAILURE = 1000,
00154 
00156         OUT_OF_MEMORY,
00157 
00159         INVALID_HANDLE,
00160 
00162         FILE_ERROR,
00163 
00167         INVALID_DRM_CLASS
00168     };
00169 
00171     seException( seExceptionCode code )
00172     {
00173         setCodeAndWhat(code, "No details");
00174     }
00175 
00177     seException( seExceptionCode code, const char *what )
00178     {
00179         setCodeAndWhat(code, what);
00180     }
00181 
00183     seException( const seException &other )
00184     {
00185         setCodeAndWhat(other.getCode(), other.getWhat());
00186     }
00187 
00189     virtual ~seException()
00190     {
00191     }
00192 
00194     seException &operator =( const seException &other )
00195     {
00196         setCodeAndWhat(other.getCode(), other.getWhat());
00197         return *this;
00198     }
00199 
00201     virtual void setCodeAndWhat( seExceptionCode code, const char *what )
00202     {
00203         int i=0;
00204         _code = code;
00205         while (what && *what && i < MAX_EXCEPTION_STR_LEN)
00206             _what[i] = *what, i++, what++;
00207         _what[i] = 0;
00208     }
00209 
00211     virtual seExceptionCode getCode() const
00212     {
00213         return _code;
00214     }
00215 
00217     virtual const char *getWhat() const
00218     {
00219         return _what;
00220     }
00221 
00222 protected:
00223 
00224     seExceptionCode _code; 
00225     char _what[MAX_EXCEPTION_STR_LEN+1]; 
00226 };
00227 
00228 
00238 void EXPORT_DLL SE_ThrowEx( seException::seExceptionCode code,
00239                                 const char *format, ... );
00240 
00244 void EXPORT_DLL SE_ThrowEx( const char *format, ... );
00245 
00246 
00247 } // namespace sedris
00248 
00249 #endif // _seException_h

SEDRIS Transmittal Access C++ API 4.0.0 beta - 14 Jul 2004
Copyright © 2004 SEDRIS Docs by Doxygen 1.3.2