123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- <chapter id='oerror'>
- <title>
- Class oerror
- </title>
- <section id="oerror-class" >
- <title>
- Introduction
- </title>
- <para>
- This class implements a standard means of displaying system error messages. Class methods may be replaced or adapted to support either a console or a windowing environment.
- </para>
- <para>
- This class is declared in <ulink url='oerror.hpp.html'>oerror.hpp</ulink> and defined in <ulink url='oerror.cpp.html'>oerror.cpp</ulink>.
- </para>
- <section id="oerror-inheritance">
- <title>
- Inheritance
- </title>
- <para>
- None.
- </para>
- </section>
- <section id="oerror-dependence">
- <title>
- Dependence
- </title>
- <para>
- This references header file <ulink url='types.h.html'>types.h</ulink> to define data type <quote>errno_t</quote>.
- </para>
- <para>
- This classes references external character string <varname>program_name</varname> which must be defined and initialized somewhere in the environment. The simplest method is to define a global constant character pointer to the basename of <varname>argv</varname>[<constant>0</constant>] in function main().
- </para>
- </section>
- </section>
- <section id="oerror-properties">
- <title>
- Properties
- </title>
- <para>
- None.
- </para>
- </section>
- <section id="oerror-methods">
- <title>
- Methods
- </title>
- <para>
- </para>
- <section id="oerror-error">
- <title>
- oerror::error
- </title>
- <funcsynopsis>
- <funcprototype>
- <funcdef>oerror & <function>oerror::error</function></funcdef>
- <paramdef>signed <parameter>status</parameter></paramdef>
- <paramdef>errno_t <parameter>number</parameter></paramdef>
- <paramdef>errno_t <parameter>format</parameter></paramdef>
- <paramdef><parameter>...</parameter></paramdef>
- </funcprototype>
- </funcsynopsis>
- <para>
- Print an error message on <constant>stderr</constant> and optionally terminate the program. The message consists of the program name, system error message and a program error message. This method behaves the same as the <productname>GNU/Linux</productname> <application>error</application> function.
- </para>
- <variablelist>
- <varlistentry>
- <term>
- status
- </term>
- <listitem>
- <para>
- The program exit status. if status is 0 then this method will return to the caller after printing an error message. Otherwise, the program will exit with this value after printing the message.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- errno
- </term>
- <listitem>
- <para>
- The error code. This is normally the value of global variable <varname>errno</varname> set by system functions to indicate the cause of an error condition. If argument <varname>number</varname> is <constant>0</constant> then no system error message is printed. Otherwise, the system error message will appear
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- format
- </term>
- <listitem>
- <para>
- The format string. The content is the same as required by standard library function printf().
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- ...
- </term>
- <listitem>
- <para>
- A variable length argument list. On <productname>GNU/Linux</productname> systems, the <application>gcc</application> compiler checks to ensure the number and type of each argument actually match the corresponding format string specification.
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
- </section>
- </section>
- </chapter>
|