source: rtems/cpukit/libmisc/stringto/stringto.h @ f5f2676

4.115
Last change on this file since f5f2676 was f5f2676, checked in by Mathew Kallada <matkallada@…>, on 12/21/12 at 17:13:06

libmisc: Doxygen Enhancement Task #1

  • Property mode set to 100644
File size: 7.9 KB
Line 
1/**
2 * @file rtems/stringto.h
3 *
4 * This file defines the interface to a set of string conversion helpers.
5 */
6
7/*
8 *  COPYRIGHT (c) 2009-2011.
9 *  On-Line Applications Research Corporation (OAR).
10 *
11 *  The license and distribution terms for this file may be
12 *  found in the file LICENSE in this distribution or at
13 *  http://www.rtems.com/license/LICENSE.
14 */
15
16#ifndef _RTEMS_STRINGTO_H
17#define _RTEMS_STRINGTO_H
18/**
19 *  @defgroup libmisc_conv_help Conversion Helpers
20 *
21 *  @ingroup libmisc
22 */
23/**@{*/
24
25#include <rtems.h>
26
27/**
28 *  @brief Convert String to Pointer (with validation).
29 *
30 *  This method converts a string to a pointer (void *) with
31 *  basic numeric validation.
32 *
33 *  @param[in] s is the string to convert
34 *  @param[in] n points to the variable to place the converted output in
35 *  @param[in] endptr is used to keep track of the position in the string
36 *
37 *  @return This method returns RTEMS_SUCCESSFUL on successful conversion
38 *          and *n is filled in.  Otherwise, the status indicates the
39 *          source of the error.
40 */
41rtems_status_code rtems_string_to_pointer(
42  const char     *s,
43  void          **n,
44  char          **endptr
45);
46
47/**
48 *  @brief Convert String to Unsigned Character (with validation).
49 *
50 *  This method converts a string to an unsigned character with
51 *  range validation.
52 *
53 *  @param[in] s is the string to convert
54 *  @param[in] n points to the variable to place the converted output in
55 *  @param[in] endptr is used to keep track of the position in the string
56 *  @param[in] base is the expected base of the number
57 *
58 *  @return This method returns RTEMS_SUCCESSFUL on successful conversion
59 *          and *n is filled in.  Otherwise, the status indicates the
60 *          source of the error.
61 */
62rtems_status_code rtems_string_to_unsigned_char(
63  const char     *s,
64  unsigned char  *n,
65  char          **endptr,
66  int             base
67);
68
69/**
70 *  @brief Convert String to Int (with validation).
71 *
72 *  This method converts a string to an int with range validation.
73 *
74 *  @param[in] s is the string to convert
75 *  @param[in] n points to the variable to place the converted output in
76 *  @param[in] endptr is used to keep track of the position in the string
77 *  @param[in] base is the expected base of the number
78 *
79 *  @return This method returns RTEMS_SUCCESSFUL on successful conversion
80 *          and *n is filled in.  Otherwise, the status indicates the
81 *          source of the error.
82 */
83rtems_status_code rtems_string_to_int(
84  const char  *s,
85  int         *n,
86  char       **endptr,
87  int          base
88);
89
90/**
91 *  @brief Convert String to Unsigned Int (with validation).
92 *
93 *  This method converts a string to an unsigned int with range validation.
94 *
95 *  @param[in] s is the string to convert
96 *  @param[in] n points to the variable to place the converted output in
97 *  @param[in] endptr is used to keep track of the position in the string
98 *  @param[in] base is the expected base of the number
99 *
100 *  @return This method returns RTEMS_SUCCESSFUL on successful conversion
101 *          and *n is filled in.  Otherwise, the status indicates the
102 *          source of the error.
103 */
104rtems_status_code rtems_string_to_unsigned_int(
105  const char    *s,
106  unsigned int  *n,
107  char         **endptr,
108  int            base
109);
110
111/**
112 *  @brief Convert String to Long (with validation).
113 *
114 *  This method converts a string to a long with
115 *  range validation.
116 *
117 *  @param[in] s is the string to convert
118 *  @param[in] n points to the variable to place the converted output in
119 *  @param[in] endptr is used to keep track of the position in the string
120 *  @param[in] base is the expected base of the number
121 *
122 *  @return This method returns RTEMS_SUCCESSFUL on successful conversion
123 *          and *n is filled in.  Otherwise, the status indicates the
124 *          source of the error.
125 */
126rtems_status_code rtems_string_to_long(
127  const char  *s,
128  long        *n,
129  char       **endptr,
130  int          base
131);
132
133/**
134 *  @brief Convert String to Unsigned Long (with validation).
135 *
136 *  This method converts a string to an unsigned long with
137 *  range validation.
138 *
139 *  @param[in] s is the string to convert
140 *  @param[in] n points to the variable to place the converted output in
141 *  @param[in] endptr is used to keep track of the position in the string
142 *  @param[in] base is the expected base of the number
143 *
144 *  @return This method returns RTEMS_SUCCESSFUL on successful conversion
145 *          and *n is filled in.  Otherwise, the status indicates the
146 *          source of the error.
147 */
148rtems_status_code rtems_string_to_unsigned_long(
149  const char     *s,
150  unsigned long  *n,
151  char          **endptr,
152  int             base
153);
154
155/**
156 *  @brief Convert String to Long Long (with validation).
157 *
158 *  This method converts a string to a long long with
159 *  range validation.
160 *
161 *  @param[in] s is the string to convert
162 *  @param[in] n points to the variable to place the converted output in
163 *  @param[in] endptr is used to keep track of the position in the string
164 *  @param[in] base is the expected base of the number
165 *
166 *  @return This method returns RTEMS_SUCCESSFUL on successful conversion
167 *          and *n is filled in.  Otherwise, the status indicates the
168 *          source of the error.
169 */
170rtems_status_code rtems_string_to_long_long(
171  const char  *s,
172  long long   *n,
173  char       **endptr,
174  int          base
175);
176
177/**
178 *  @brief Convert String to Unsigned Long Long (with validation).
179 *
180 *  This method converts a string to an unsigned character with
181 *  range validation.
182 *
183 *  @param[in] s is the string to convert
184 *  @param[in] n points to the variable to place the converted output in
185 *  @param[in] endptr is used to keep track of the position in the string
186 *  @param[in] base is the expected base of the number
187 *
188 *  @return This method returns RTEMS_SUCCESSFUL on successful conversion
189 *          and *n is filled in.  Otherwise, the status indicates the
190 *          source of the error.
191 */
192rtems_status_code rtems_string_to_unsigned_long_long(
193  const char           *s,
194  unsigned long long   *n,
195  char                **endptr,
196  int                   base
197);
198
199/**
200 *  @brief Convert String to Float (with validation).
201 *
202 *  This method converts a string to a float with range validation.
203 *
204 *  @param[in] s is the string to convert
205 *  @param[in] n points to the variable to place the converted output in
206 *  @param[in] endptr is used to keep track of the position in the string
207 *
208 *  @return This method returns RTEMS_SUCCESSFUL on successful conversion
209 *          and *n is filled in.  Otherwise, the status indicates the
210 *          source of the error.
211 */
212rtems_status_code rtems_string_to_float(
213  const char   *s,
214  float        *n,
215  char        **endptr
216);
217
218/**
219 *  @brief Convert String to Double (with validation).
220 *
221 *  This method converts a string to a double with range validation.
222 *
223 *  @param[in] s is the string to convert
224 *  @param[in] n points to the variable to place the converted output in
225 *  @param[in] endptr is used to keep track of the position in the string
226 *
227 *  @return This method returns RTEMS_SUCCESSFUL on successful conversion
228 *          and *n is filled in.  Otherwise, the status indicates the
229 *          source of the error.
230 */
231rtems_status_code rtems_string_to_double(
232  const char   *s,
233  double       *n,
234  char        **endptr
235);
236
237/**
238 *  @brief Convert String to long double (with validation).
239 *
240 *  This method converts a string to a long double with range validation.
241 *
242 *  @param[in] s is the string to convert
243 *  @param[in] n points to the variable to place the converted output in
244 *  @param[in] endptr is used to keep track of the position in the string
245 *
246 *  @return This method returns RTEMS_SUCCESSFUL on successful conversion
247 *          and *n is filled in.  Otherwise, the status indicates the
248 *          source of the error.
249 */
250rtems_status_code rtems_string_to_long_double(
251  const char   *s,
252  long double  *n,
253  char        **endptr
254);
255
256#endif
257/**@}*/
Note: See TracBrowser for help on using the repository browser.