WvStreams
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
WvErrorBase Class Reference

A class for managing error numbers and strings. More...

#include <wverror.h>

Inheritance diagram for WvErrorBase:
Inheritance graph
[legend]

Public Member Functions

virtual bool isok () const
 By default, returns true if geterr() == 0.
 
virtual int geterr () const
 If isok() is false, return the system error number corresponding to the error, -1 for a special error string (which you can obtain with errstr()) or 0 on end of file.
 
virtual WvString errstr () const
 
virtual void seterr (int _errnum)
 Set the errnum variable – we have an error.
 
void seterr (WvStringParm specialerr)
 
void seterr (WVSTRING_FORMAT_DECL)
 
void seterr_both (int _errnum, WvStringParm specialerr)
 
void seterr_both (int _errnum, WVSTRING_FORMAT_DECL)
 
void seterr (const WvErrorBase &err)
 
void noerr ()
 Reset our error state - there's no error condition anymore.
 
virtual bool isok () const
 By default, returns true if geterr() == 0.
 
virtual int geterr () const
 If isok() is false, return the system error number corresponding to the error, -1 for a special error string (which you can obtain with errstr()) or 0 on end of file.
 
virtual WvString errstr () const
 
virtual void seterr (int _errnum)
 Set the errnum variable – we have an error.
 
void seterr (WvStringParm specialerr)
 
void seterr (WVSTRING_FORMAT_DECL)
 
void seterr_both (int _errnum, WvStringParm specialerr)
 
void seterr_both (int _errnum, WVSTRING_FORMAT_DECL)
 
void seterr (const WvErrorBase &err)
 
void noerr ()
 Reset our error state - there's no error condition anymore.
 

Static Public Member Functions

static WvString strerror (int errnum)
 A replacement for the operating system strerror() function that can map more kinds of error strings (especially in win32).
 
static WvString strerror (int errnum)
 A replacement for the operating system strerror() function that can map more kinds of error strings (especially in win32).
 

Protected Attributes

int errnum
 
WvString errstring
 

Detailed Description

A class for managing error numbers and strings.

It can have either a system error value, like those defined in errno.h, or an arbitrary error string. In either case, it can return a string representation of the error message.

This object is most useful for using as a base class of your own class, for historical/backwards compatibility reasons. Consider using a WvError instead, and making it a member of your class instead of a parent.

Definition at line 23 of file debian/libwvstreams-dev/usr/include/wvstreams/wverror.h.

Constructor & Destructor Documentation

◆ WvErrorBase() [1/2]

WvErrorBase::WvErrorBase ( )
inline

◆ ~WvErrorBase()

WvErrorBase::~WvErrorBase ( )
virtual

Definition at line 83 of file wverror.cc.

◆ WvErrorBase() [2/2]

WvErrorBase::WvErrorBase ( )
inline

Definition at line 30 of file include/wverror.h.

Member Function Documentation

◆ isok() [1/2]

virtual bool WvErrorBase::isok ( ) const
inlinevirtual

◆ geterr() [1/2]

virtual int WvErrorBase::geterr ( ) const
inlinevirtual

If isok() is false, return the system error number corresponding to the error, -1 for a special error string (which you can obtain with errstr()) or 0 on end of file.

If isok() is true, returns an undefined number.

Reimplemented in WvDBusServer, WvStreamClone, WvDBusServer, and WvStreamClone.

Definition at line 48 of file debian/libwvstreams-dev/usr/include/wvstreams/wverror.h.

Referenced by UniIniGen::commit(), UniFileSystemGen::get(), WvDBusServer::geterr(), WvStreamClone::geterr(), WvEncoderStream::isok(), UniConfDaemon::listen(), UniIniGen::refresh(), WvStream::seterr(), and WvMagicCircle::WvMagicCircle().

◆ errstr()

WvString WvErrorBase::errstr ( ) const
virtual

Definition at line 127 of file wverror.cc.

◆ strerror()

WvString WvErrorBase::strerror ( int  errnum)
static

A replacement for the operating system strerror() function that can map more kinds of error strings (especially in win32).

Definition at line 91 of file wverror.cc.

References strerror().

Referenced by WvLog::perror(), strerror(), WvSSLStream::uread(), and WvSSLStream::uwrite().

◆ seterr() [1/6]

void WvErrorBase::seterr ( int  _errnum)
virtual

Set the errnum variable – we have an error.

If called more than once, seterr() doesn't change the error code away from the previous one. That way, we remember the original cause of our problems.

Subclasses may want to override seterr(int) to shut themselves down (eg. WvStream::close()) when an error condition is set.

Note that seterr(WvString) will call seterr(-1).

Reimplemented in WvStream, and WvStream.

Definition at line 144 of file wverror.cc.

Referenced by WvTCPListener::accept(), WvUnixListener::accept(), WvDSAKey::getpem(), WvGlob::set(), WvStream::seterr(), WvMagicCircle::WvMagicCircle(), WvPam::WvPam(), WvPam::WvPam(), WvShmZone::WvShmZone(), and WvTCPListener::WvTCPListener().

◆ seterr() [2/6]

void WvErrorBase::seterr ( WvStringParm  specialerr)

Definition at line 159 of file wverror.cc.

◆ seterr() [3/6]

void WvErrorBase::seterr ( WVSTRING_FORMAT_DECL  )
inline

◆ seterr_both() [1/3]

void WvErrorBase::seterr_both ( int  _errnum,
WvStringParm  specialerr 
)

Definition at line 179 of file wverror.cc.

◆ seterr_both() [2/3]

void WvErrorBase::seterr_both ( int  _errnum,
WVSTRING_FORMAT_DECL   
)
inline

◆ seterr() [4/6]

void WvErrorBase::seterr ( const WvErrorBase err)

Definition at line 170 of file wverror.cc.

◆ noerr() [1/2]

void WvErrorBase::noerr ( )
inline

Reset our error state - there's no error condition anymore.

Definition at line 78 of file debian/libwvstreams-dev/usr/include/wvstreams/wverror.h.

◆ isok() [2/2]

virtual bool WvErrorBase::isok ( ) const
inlinevirtual

◆ geterr() [2/2]

virtual int WvErrorBase::geterr ( ) const
inlinevirtual

If isok() is false, return the system error number corresponding to the error, -1 for a special error string (which you can obtain with errstr()) or 0 on end of file.

If isok() is true, returns an undefined number.

Reimplemented in WvDBusServer, WvStreamClone, WvDBusServer, and WvStreamClone.

Definition at line 48 of file include/wverror.h.

◆ seterr() [5/6]

virtual void WvErrorBase::seterr ( int  _errnum)
virtual

Set the errnum variable – we have an error.

If called more than once, seterr() doesn't change the error code away from the previous one. That way, we remember the original cause of our problems.

Subclasses may want to override seterr(int) to shut themselves down (eg. WvStream::close()) when an error condition is set.

Note that seterr(WvString) will call seterr(-1).

Reimplemented in WvStream, and WvStream.

◆ seterr() [6/6]

void WvErrorBase::seterr ( WVSTRING_FORMAT_DECL  )
inline

Definition at line 70 of file include/wverror.h.

◆ seterr_both() [3/3]

void WvErrorBase::seterr_both ( int  _errnum,
WVSTRING_FORMAT_DECL   
)
inline

Definition at line 73 of file include/wverror.h.

◆ noerr() [2/2]

void WvErrorBase::noerr ( )
inline

Reset our error state - there's no error condition anymore.

Definition at line 78 of file include/wverror.h.

Member Data Documentation

◆ errnum

int WvErrorBase::errnum
protected

◆ errstring

WvString WvErrorBase::errstring
protected

The documentation for this class was generated from the following files: