onumber.xml 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. <chapter id='onumber'>
  2. <title>
  3. Class onumber
  4. </title>
  5. <section id="onumber-class" >
  6. <title>
  7. Introduction
  8. </title>
  9. <para>
  10. 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.
  11. </para>
  12. <para>
  13. This class is declared in <ulink url='onumber.hpp.html'>onumber.hpp</ulink> and defined in <ulink url='onumber.cpp.html'>onumber.cpp</ulink>.
  14. </para>
  15. <section id="onumber-inheritance">
  16. <title>
  17. Inheritance
  18. </title>
  19. <para>
  20. None.
  21. </para>
  22. </section>
  23. <section id="onumber-dependence">
  24. <title>
  25. Dependence
  26. </title>
  27. <para>
  28. 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>.
  29. </para>
  30. </section>
  31. </section>
  32. <section id="onumber-constants">
  33. <title>
  34. Constants
  35. </title>
  36. <variablelist>
  37. <varlistentry>
  38. <term>
  39. RADIX_BIN
  40. </term>
  41. <listitem>
  42. Radix for string-to-binary and binary-to-string conversion. Value is <constant>2</constant>.
  43. </listitem>
  44. </varlistentry>
  45. <varlistentry>
  46. <term>
  47. RADIX_OCT
  48. </term>
  49. <listitem>
  50. Radix for string-to-octal and octal-to-string conversion. Value is <constant>8</constant>.
  51. </listitem>
  52. </varlistentry>
  53. <varlistentry>
  54. <term>
  55. RADIX_DEC
  56. </term>
  57. <listitem>
  58. Radix for string-to-decimal and decimal-to-string conversion. Value is <constant>10</constant>.
  59. </listitem>
  60. </varlistentry>
  61. <varlistentry>
  62. <term>
  63. RADIX_HEX
  64. </term>
  65. <listitem>
  66. Radix for string-to-hexadecimal and hexadecimal-to-string conversion. Value is <constant>16</constant>.
  67. </listitem>
  68. </varlistentry>
  69. <varlistentry>
  70. <term>
  71. BIN_DIGITS
  72. </term>
  73. <listitem>
  74. The maximum number of binary digits needed to represent one octet. Value is <constant>8</constant>.
  75. </listitem>
  76. </varlistentry>
  77. <varlistentry>
  78. <term>
  79. OCT_DIGITS
  80. </term>
  81. <listitem>
  82. The maximum number of octal digits needed to represent one octet. Value is <constant>3</constant>.
  83. </listitem>
  84. </varlistentry>
  85. <varlistentry>
  86. <term>
  87. DEC_DIGITS
  88. </term>
  89. <listitem>
  90. The maximum number of decimal digits needed to represent one octer. Value is <constant>3</constant>.
  91. </listitem>
  92. </varlistentry>
  93. <varlistentry>
  94. <term>
  95. HEX_DIGITS
  96. </term>
  97. <listitem>
  98. The maximum number of hexadecimal digits needed to represent one octet. Value is <constant>2</constant>.
  99. </listitem>
  100. </varlistentry>
  101. <varlistentry>
  102. <term>
  103. BIN_EXTENDER
  104. </term>
  105. <listitem>
  106. The character used to separate binary octets. Value is <constant>'-'</constant> or hyphen.
  107. </listitem>
  108. </varlistentry>
  109. <varlistentry>
  110. <term>
  111. DEC_EXTENDER
  112. </term>
  113. <listitem>
  114. The character used to separate decimal octets. Value is <constant>'.'</constant> or period.
  115. </listitem>
  116. </varlistentry>
  117. <varlistentry>
  118. <term>
  119. HEX_EXTENDER
  120. </term>
  121. <listitem>
  122. The character used to separate decimal octets. Value is <constant>':'</constant> or colon.
  123. </listitem>
  124. </varlistentry>
  125. <varlistentry>
  126. <term>
  127. IPv4_SIZE
  128. </term>
  129. <listitem>
  130. The size of a binary IPv4 address in bytes. Value is <constant>4</constant>.
  131. </listitem>
  132. </varlistentry>
  133. <varlistentry>
  134. <term>
  135. IPv6_SIZE
  136. </term>
  137. <listitem>
  138. The size of a binary IPv6 address in bytes. Value is <constant>16</constant>.
  139. </listitem>
  140. </varlistentry>
  141. </variablelist>
  142. </section>
  143. <section id="onumber-properties">
  144. <title>
  145. Properties
  146. </title>
  147. <para>
  148. None.
  149. </para>
  150. </section>
  151. <section id="onumber-methods">
  152. <title>
  153. Methods
  154. </title>
  155. <para>
  156. </para>
  157. <section id="onumber-basespec">
  158. <title>
  159. basespec
  160. </title>
  161. <funcsynopsis>
  162. <funcprototype>
  163. <funcdef>huge_t <function>onumber::basespec</function></funcdef>
  164. <paramdef>const char * <parameter>string</parameter></paramdef>
  165. <paramdef>unsigned <parameter>base</parameter></paramdef>
  166. <paramdef>unsigned <parameter>size</parameter></paramdef>
  167. </funcprototype>
  168. </funcsynopsis>
  169. <para>
  170. 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.
  171. </para>
  172. </section>
  173. <section id="onumber-uintspec">
  174. <title>
  175. uintspec
  176. </title>
  177. <funcsynopsis>
  178. <funcprototype>
  179. <funcdef>huge_t <function>onumber::uintspec</function></funcdef>
  180. <paramdef>const char * <parameter>string</parameter></paramdef>
  181. <paramdef>huge_t <parameter>minimum</parameter></paramdef>
  182. <paramdef>huge_t <parameter>maximum</parameter></paramdef>
  183. </funcprototype>
  184. </funcsynopsis>
  185. <para>
  186. 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.
  187. </para>
  188. </section>
  189. <section id="onumber-ipv4spec">
  190. <title>
  191. ipv4spec
  192. </title>
  193. <funcsynopsis>
  194. <funcprototype>
  195. <funcdef>size_t <function>onumber::ipv4spec</function></funcdef>
  196. <paramdef>const char * <parameter>string</parameter></paramdef>
  197. <paramdef>void * <parameter>memory</parameter></paramdef>
  198. </funcprototype>
  199. </funcsynopsis>
  200. <para>
  201. Encode external memory with the binary equivalent of a variable-length <acronym>IPv4</acronym> dotted-decimal string and return the number of bytes encoded.
  202. </para>
  203. </section>
  204. <section id="onumber-ipv6spec">
  205. <title>
  206. ipv6spec
  207. </title>
  208. <funcsynopsis>
  209. <funcprototype>
  210. <funcdef>size_t <function>onumber::ipv6</function></funcdef>
  211. <paramdef>const char * <parameter>string</parameter></paramdef>
  212. <paramdef>void * <parameter>memory</parameter></paramdef>
  213. </funcprototype>
  214. </funcsynopsis>
  215. <para>
  216. Encode external memory with the binary equivalent of a variable-length <acronym>IPv6</acronym> hexadecimal string and return the number of bytes encoded.
  217. </para>
  218. </section>
  219. </section>
  220. </chapter>