Imported Upstream version 1.0beta3
[platform/upstream/syncevolution.git] / src / synthesis / src / sysync_SDK / Sources / syncexception.h
1 /*
2  *  File:         SyncException.cpp
3  *
4  *  Author:       Lukas Zeller (luz@synthesis.ch)
5  *
6  *  TSyncException...
7  *    SySync Exception classes
8  *
9  *  Copyright (c) 2001-2009 by Synthesis AG (www.synthesis.ch)
10  *
11  *  2001-05-28 : luz : created
12  *
13  */
14
15 #ifndef SyncException_H
16 #define SyncException_H
17
18 using namespace std;
19
20
21 namespace sysync {
22
23 #if defined(WINCE) || defined(__EPOC_OS__) || defined(ANDROID)
24 // eVC + EPOC cannot process throw() qualifier
25 #define NOTHROW
26 // eVC + EPOC has no exception base class
27 class exception
28 {
29 public:
30     exception() {};
31     exception(const exception&) {};
32     exception& operator= (const exception&) {return *this;};
33     virtual ~exception() {};
34     virtual const char* what() const {return "exception";};
35 };
36 #else
37 #define NOTHROW throw()
38 #endif
39
40 class TSyncException : public exception
41 {
42   typedef exception inherited;
43 public:
44   TSyncException(const char *aMsg1, localstatus aLocalStatus=LOCERR_EXCEPTION) NOTHROW;
45   TSyncException(localstatus aLocalStatus) NOTHROW;
46   TSyncException() NOTHROW { fLocalStatus=LOCERR_EXCEPTION; };
47   virtual ~TSyncException() NOTHROW;
48   virtual const char * what() const NOTHROW;
49   localstatus status(void) NOTHROW { return fLocalStatus; }
50 protected:
51   void setMsg(const char *p);
52   string fMessage;
53 private:
54   localstatus fLocalStatus;
55 }; // TSyncException
56
57
58 class TSmlException : public TSyncException
59 {
60   typedef TSyncException inherited;
61 public:
62   TSmlException(const char *aMsg, Ret_t aSmlError) NOTHROW;
63   Ret_t getSmlError(void) { return fSmlError; };
64 private:
65   Ret_t fSmlError;
66 }; // TSmlException
67
68
69
70 class TStructException : public TSyncException
71 {
72   typedef TSyncException inherited;
73 public:
74   TStructException(const char *aMsg)  NOTHROW: TSyncException (aMsg) {};
75 }; // TStructException
76
77
78 class TMemException : public TSyncException
79 {
80   typedef TSyncException inherited;
81 public:
82   TMemException(const char *aMsg)  NOTHROW: TSyncException (aMsg) {};
83 }; // TMemException
84
85
86 } // namespace sysync
87
88 #endif  // SyncException_H
89
90 // eof