Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

wverror.h

00001 /* -*- Mode: C++ -*-
00002  * Worldvisions Weaver Software:
00003  *   Copyright (C) 1997-2002 Net Integration Technologies, Inc.
00004  *
00005  * A class for managing error numbers and strings.
00006  */ 
00007 #ifndef __WVERROR_H
00008 #define __WVERROR_H
00009 
00010 #include "wvstring.h"
00011 
00023 class WvErrorBase
00024 {
00025 protected:
00026     int errnum;
00027     WvString errstring;
00028 
00029 public:
00030     WvErrorBase()
00031         { noerr(); }
00032     virtual ~WvErrorBase();
00033 
00039     virtual bool isok() const
00040         { return errnum == 0; }
00041 
00048     virtual int geterr() const
00049         { return errnum; }
00050     virtual WvString errstr() const;
00051     
00062     virtual void seterr(int _errnum);
00063     void seterr(WvStringParm specialerr);
00064     void seterr(WVSTRING_FORMAT_DECL)
00065         { seterr(WvString(WVSTRING_FORMAT_CALL)); }
00066     void seterr(const WvErrorBase &err);
00067     
00069     void noerr()
00070         { errnum = 0; errstring = WvString::null; }
00071 };
00072 
00073 
00080 class WvError : public WvErrorBase
00081 {
00082 public:
00083     int get() const
00084         { return geterr(); }
00085     WvString str() const
00086         { return errstr(); }
00087     
00088     void set(int _errnum)
00089         { seterr(_errnum); }
00090     void set(WvStringParm specialerr)
00091         { seterr(specialerr); }
00092     void set(WVSTRING_FORMAT_DECL)
00093         { seterr(WvString(WVSTRING_FORMAT_CALL)); }
00094     void set(const WvErrorBase &err)
00095         { seterr(err); }
00096 
00097     void reset()
00098         { noerr(); }
00099 };
00100 
00101 
00102 #endif // __WVERROR_H

Generated on Sun Jul 10 16:27:04 2005 for WvStreams by  doxygen 1.4.0