FBB::Errno(3) Throwable objects handling error conditions

SYNOPSIS

#include <bobcat/errno>
Linking option: -lbobcat

DESCRIPTION

FBB::Errno objects may be thrown in exceptions. As they are also std::ostringstream objects, information may be inserted into them. Facilitities are offered to insert information into, and to throw anonymous FBB::Errno objects.

NAMESPACE

FBB
All constructors, members, operators and manipulators, mentioned in this man-page, are defined in the namespace FBB.

INHERITS FROM

std::ostringstream, std::exception

CONSTRUCTORS

  • Errno():
    This constructor stores the current system errno value and its textual interpretation. No textual errno conversion is stored if errno equals 0.
  • Errno(char const *prefix):
    This constructor stores the current system errno value. To this, the textual interpretation of errno is added unless errno equals 0. If, in this situation, prefix is a non-empty string, the text : is first appended to the prefix.
  • Errno(int errnr, char const *text = 0):
    This constructor stores the provided errnr value, and the text text. The text argument may be omitted or empty, in which case no text will be prefixed to any additionally inserted information. With this version of FBB::Errno, no : is added to a non-empty text argument. The copy constructor is available.

MEMBER FUNCTIONS

All members of std::ostringstream and std::exception are available, as FBB::Errno inherits from these classes.
  • virtual char const *what() const:
    Returns the initialized and inserted text. No separators are inserted by the FBB::Errno object between the initializatin text and any text inserted later. If separators are required, the user of the FBB::Errno object must insert these explicitly.
  • int which() const:
    Returns the internally stored errno value: either the system-errno value, or the value provided by the third constructor.
  • int which() const:
    Returns the internally stored errno value: either the system-errno value, or the value provided by the third constructor.

OVERLOADED OPERATORS

  • Errno const &operator<<(Errno const &in, Type const &t):
    This overloaded insertion operator can be used to insert values of any type that can also be inserted into an ostringstream object. It is implemented as a template, with the generic Type representing the type of the value to be inserted. The overloaded assignment operator is not available.

OBSOLETED MANIPULATORS

The manipulators listed here are obsoleted and should no longer be used. They will be removed from Bobcat in some future version.

The following manipulators (which are not part of the FBB::Errno, class, but are defined in the FBB namespace) can be inserted into the FBB::Errno object:

  • FBB::insertable:
    (OBSOLETED) If inserted immediately after the construction of an anonymous FBB::Errno object, information may be inserted into the anonymous object immediately thereafter. The manipulator is not required for named Errno objects into which information is inserted after their construction.
  • FBB::throwable:
    (OBSOLETED) If placed at the end of a series of insertions into the FBB::Errno object, it allows the object to be thrown as an exception in one expression.

EXAMPLE

The following example shows the normal use of the manipulators:
    if (exceptionalCondition)
        throw FBB::Errno(1, "Failure") << ": Exceptional condition occurred";
        

FILES

bobcat/errno - defines the class interface

BUGS

None Reported.

DISTRIBUTION FILES

  • bobcat_2.08.01-x.dsc: detached signature;
  • bobcat_2.08.01-x.tar.gz: source archive;
  • bobcat_2.08.01-x_i386.changes: change log;
  • libbobcat1_2.08.01-x_*.deb: debian package holding the libraries;
  • libbobcat1-dev_2.08.01-x_*.deb: debian package holding the libraries, headers and manual pages;
  • http://sourceforge.net/projects/bobcat: public archive location;

BOBCAT

Bobcat is an acronym of `Brokken's Own Base Classes And Templates'.

COPYRIGHT

This is free software, distributed under the terms of the GNU General Public License (GPL).

AUTHOR

Frank B. Brokken ([email protected]).