Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

/ray/src/lib/serror.h

Go to the documentation of this file.
00001 /*
00002  * lib/serror.h
00003  * 
00004  * Standard / System error representation class. 
00005  * 
00006  * Copyright (c) 2004 by Wolfgang Wieser ] wwieser (a) gmx <*> de [ 
00007  * 
00008  * This file may be distributed and/or modified under the terms of the 
00009  * GNU General Public License version 2 as published by the Free Software 
00010  * Foundation. (See COPYING.GPL for details.)
00011  * 
00012  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00013  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00014  * 
00015  */
00016 
00017 #ifndef _SRC_SERROR_H_
00018 #define _SRC_SERROR_H_ 1
00019 
00028 #include <lib/sconfig.h>    /* MUST be first */
00029 
00030 #include <lib/tl/tlstring.h>
00031 #include <glib/gerror.h>
00032 
00033 
00054 class SError
00055 {
00056     private:
00057         TLString errmsg; 
00058         int ecode;       
00059         int edomain;     
00060 
00061         void _assign(GError *&g);
00062     public:
00064         inline SError() : errmsg(),ecode(0),edomain(-1)  { }
00066         inline SError(const SError &e) : errmsg(e.errmsg),ecode(e.ecode),
00067             edomain(e.edomain)  { }
00070         inline SError(GError *&g) : errmsg(),ecode(0),edomain(-1)
00071             {  _assign(g);  }
00073         inline SError(const char *str,int _code,int _domain=-1) : 
00074             errmsg(str),ecode(_code),edomain(_domain)  { }
00076         inline SError(const TLString &str,int _code,int _domain=-1) : 
00077             errmsg(str),ecode(_code),edomain(_domain)  { }
00079         inline ~SError() {}
00080         
00083         inline SError &operator=(GError *&g)
00084             {  _assign(g);  return(*this);  }
00086         inline SError &operator=(const SError &e)
00087         {  errmsg=e.errmsg; ecode=e.ecode; edomain=e.edomain; return(*this);  }
00088         
00090         inline operator bool() const
00091             {  return(ecode);  }
00093         inline bool operator!() const
00094             {  return(!ecode);  }
00095         
00097         inline void clear()
00098             {  errmsg=NULL;  ecode=0;  edomain=-1;  }
00099         
00101         inline const TLString &msg() const
00102             {  return(errmsg);  }
00103         
00105         void AppendMsg(const TLString &str);
00107         void AppendMsg(const char *str);
00108         
00110         inline int code() const
00111             {  return(ecode);  }
00112 };
00113 
00114 #endif  /* _SRC_SERROR_H_ */

Generated on Sat Feb 19 22:33:46 2005 for Ray by doxygen 1.3.5