123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220 |
- <chapter id='onumber'>
- <title>
- Class onumber
- </title>
- <section id="onumber-class" >
- <title>
- Introduction
- </title>
- <para>
- This class implements various types of numeric string conversions. Class methods <link linkend='onumber-basespec'>basespec</link> and <link linkend='onumber-uintspec'>uintspec</link> perform numeric string conversions. Class methods <link linkend='onumber-ipv4spec'>ipv4spec</link> and <link linkend='onumber-ipv6spec'>ipv6spec</link> perform internet address string conversions. The class header file defines numeric string conversion constants that may be referenced by other classes. Such classes may merely include this header file to obtain these constant definitions.
- </para>
- <para>
- This class is declared in <ulink url='onumber.hpp.html'>onumber.hpp</ulink> and defined in <ulink url='onumber.cpp.html'>onumber.cpp</ulink>.
- </para>
- <section id="onumber-inheritance">
- <title>
- Inheritance
- </title>
- <para>
- None.
- </para>
- </section>
- <section id="onumber-dependence">
- <title>
- Dependence
- </title>
- <para>
- This class depends on classes <link linkend='oascii'>oascii</link> and <link linkend='oerror'>oerror</link>. It also needs custom header file <ulink url='types.h.html'>types.h</ulink> to define custom data type <quote>huge_t</quote>.
- </para>
- </section>
- </section>
- <section id="onumber-constants">
- <title>
- Constants
- </title>
- <variablelist>
- <varlistentry>
- <term>
- RADIX_BIN
- </term>
- <listitem>
- Radix for string-to-binary and binary-to-string conversion. Value is <constant>2</constant>.
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- RADIX_OCT
- </term>
- <listitem>
- Radix for string-to-octal and octal-to-string conversion. Value is <constant>8</constant>.
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- RADIX_DEC
- </term>
- <listitem>
- Radix for string-to-decimal and decimal-to-string conversion. Value is <constant>10</constant>.
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- RADIX_HEX
- </term>
- <listitem>
- Radix for string-to-hexadecimal and hexadecimal-to-string conversion. Value is <constant>16</constant>.
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- BIN_DIGITS
- </term>
- <listitem>
- The maximum number of binary digits needed to represent one octet. Value is <constant>8</constant>.
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- OCT_DIGITS
- </term>
- <listitem>
- The maximum number of octal digits needed to represent one octet. Value is <constant>3</constant>.
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- DEC_DIGITS
- </term>
- <listitem>
- The maximum number of decimal digits needed to represent one octer. Value is <constant>3</constant>.
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- HEX_DIGITS
- </term>
- <listitem>
- The maximum number of hexadecimal digits needed to represent one octet. Value is <constant>2</constant>.
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- BIN_EXTENDER
- </term>
- <listitem>
- The character used to separate binary octets. Value is <constant>'-'</constant> or hyphen.
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- DEC_EXTENDER
- </term>
- <listitem>
- The character used to separate decimal octets. Value is <constant>'.'</constant> or period.
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- HEX_EXTENDER
- </term>
- <listitem>
- The character used to separate decimal octets. Value is <constant>':'</constant> or colon.
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- IPv4_SIZE
- </term>
- <listitem>
- The size of a binary IPv4 address in bytes. Value is <constant>4</constant>.
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- IPv6_SIZE
- </term>
- <listitem>
- The size of a binary IPv6 address in bytes. Value is <constant>16</constant>.
- </listitem>
- </varlistentry>
- </variablelist>
- </section>
- <section id="onumber-properties">
- <title>
- Properties
- </title>
- <para>
- None.
- </para>
- </section>
- <section id="onumber-methods">
- <title>
- Methods
- </title>
- <para>
- </para>
- <section id="onumber-basespec">
- <title>
- basespec
- </title>
- <funcsynopsis>
- <funcprototype>
- <funcdef>huge_t <function>onumber::basespec</function></funcdef>
- <paramdef>const char * <parameter>string</parameter></paramdef>
- <paramdef>unsigned <parameter>base</parameter></paramdef>
- <paramdef>unsigned <parameter>size</parameter></paramdef>
- </funcprototype>
- </funcsynopsis>
- <para>
- Return the unsigned integer equivalent of a character string. The <varname>base</varname> argument determines the number base to be used for conversion. If <varname>base</varname> is <constant>0</constant> the number base is determined by the string prefix where <quote>0b</quote> or <quote>0B</quote> means binary format, no prefix or <quote>od</quote> or <quote>0D</quote> means decimal format and <quote>0x</quote> or <quote>0X</quote> means hexadecimal format. Otherwise, the string must conform to the specified number base with, or without, an appropriate prefix. The <varname>size</varname> argument is the maximum number of bits permitted in the resulting integer. This method is useful for converting strings to integers of unusual size.
- </para>
- </section>
- <section id="onumber-uintspec">
- <title>
- uintspec
- </title>
- <funcsynopsis>
- <funcprototype>
- <funcdef>huge_t <function>onumber::uintspec</function></funcdef>
- <paramdef>const char * <parameter>string</parameter></paramdef>
- <paramdef>huge_t <parameter>minimum</parameter></paramdef>
- <paramdef>huge_t <parameter>maximum</parameter></paramdef>
- </funcprototype>
- </funcsynopsis>
- <para>
- Return the unsigned interger equivalent of a character string. An error occurs if the integer value exceeds the specified <varname>maximum</varname> or <varname>minimum</varname> value. Errors are handled by the inherited <link linkend='oerror'>oerror</link> class.
- </para>
- </section>
- <section id="onumber-ipv4spec">
- <title>
- ipv4spec
- </title>
- <funcsynopsis>
- <funcprototype>
- <funcdef>size_t <function>onumber::ipv4spec</function></funcdef>
- <paramdef>const char * <parameter>string</parameter></paramdef>
- <paramdef>void * <parameter>memory</parameter></paramdef>
- </funcprototype>
- </funcsynopsis>
- <para>
- Encode external memory with the binary equivalent of a variable-length <acronym>IPv4</acronym> dotted-decimal string and return the number of bytes encoded.
- </para>
- </section>
- <section id="onumber-ipv6spec">
- <title>
- ipv6spec
- </title>
- <funcsynopsis>
- <funcprototype>
- <funcdef>size_t <function>onumber::ipv6</function></funcdef>
- <paramdef>const char * <parameter>string</parameter></paramdef>
- <paramdef>void * <parameter>memory</parameter></paramdef>
- </funcprototype>
- </funcsynopsis>
- <para>
- Encode external memory with the binary equivalent of a variable-length <acronym>IPv6</acronym> hexadecimal string and return the number of bytes encoded.
- </para>
- </section>
- </section>
- </chapter>
|