Open SCAP Library

strto.h
1 /*
2 * Copyright 2009 Red Hat Inc., Durham, North Carolina.
3 * All Rights Reserved.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 *
19 * Authors:
20 * "Daniel Kopecek" <dkopecek@redhat.com>
21 */
22
23 #pragma once
24 #ifndef STRTO_H
25 #define STRTO_H
26
27 #include <stddef.h>
28 #include <stdint.h>
29 #include "../../../../common/util.h"
30
31 uint8_t strto_uint8_hex (const char *str, size_t len, char **endptr);
32 uint16_t strto_uint16_hex (const char *str, size_t len, char **endptr);
33 uint32_t strto_uint32_hex (const char *str, size_t len, char **endptr);
34 int64_t strto_int64 (const char *str, size_t len, char **endptr, int base);
35 int64_t strto_int64_bin (const char *str, size_t len, char **endptr);
36 int64_t strto_int64_oct (const char *str, size_t len, char **endptr);
37 int64_t strto_int64_dec (const char *str, size_t len, char **endptr);
38 int64_t strto_int64_hex (const char *str, size_t len, char **endptr);
39
40 uint64_t strto_uint64 (const char *str, size_t len, char **endptr, int base);
41 uint64_t strto_uint64_bin (const char *str, size_t len, char **endptr);
42 uint64_t strto_uint64_oct (const char *str, size_t len, char **endptr);
43 uint64_t strto_uint64_dec (const char *str, size_t len, char **endptr);
44 uint64_t strto_uint64_hex (const char *str, size_t len, char **endptr);
45
46 double strto_double (const char *str, size_t len, char **endptr);
47
48 OSCAP_HIDDEN_START;
49
50 int8_t strto_int8 (const char *str, size_t len, char **endptr, int base);
51 int8_t strto_int8_bin (const char *str, size_t len, char **endptr);
52 int8_t strto_int8_oct (const char *str, size_t len, char **endptr);
53 int8_t strto_int8_dec (const char *str, size_t len, char **endptr);
54 int8_t strto_int8_hex (const char *str, size_t len, char **endptr);
55
56 uint8_t strto_uint8 (const char *str, size_t len, char **endptr, int base);
57 uint8_t strto_uint8_bin (const char *str, size_t len, char **endptr);
58 uint8_t strto_uint8_oct (const char *str, size_t len, char **endptr);
59 uint8_t strto_uint8_dec (const char *str, size_t len, char **endptr);
60
61 int16_t strto_int16 (const char *str, size_t len, char **endptr, int base);
62 int16_t strto_int16_bin (const char *str, size_t len, char **endptr);
63 int16_t strto_int16_oct (const char *str, size_t len, char **endptr);
64 int16_t strto_int16_dec (const char *str, size_t len, char **endptr);
65 int16_t strto_int16_hex (const char *str, size_t len, char **endptr);
66
67 uint16_t strto_uint16 (const char *str, size_t len, char **endptr, int base);
68 uint16_t strto_uint16_bin (const char *str, size_t len, char **endptr);
69 uint16_t strto_uint16_oct (const char *str, size_t len, char **endptr);
70 uint16_t strto_uint16_dec (const char *str, size_t len, char **endptr);
71
72 int32_t strto_int32 (const char *str, size_t len, char **endptr, int base);
73 int32_t strto_int32_bin (const char *str, size_t len, char **endptr);
74 int32_t strto_int32_oct (const char *str, size_t len, char **endptr);
75 int32_t strto_int32_dec (const char *str, size_t len, char **endptr);
76 int32_t strto_int32_hex (const char *str, size_t len, char **endptr);
77
78 uint32_t strto_uint32 (const char *str, size_t len, char **endptr, int base);
79 uint32_t strto_uint32_bin (const char *str, size_t len, char **endptr);
80 uint32_t strto_uint32_oct (const char *str, size_t len, char **endptr);
81 uint32_t strto_uint32_dec (const char *str, size_t len, char **endptr);
82
83 intmax_t strto_intmax (const char *str, size_t len, char **endptr, int base);
84 intmax_t strto_intmax_bin (const char *str, size_t len, char **endptr);
85 intmax_t strto_intmax_oct (const char *str, size_t len, char **endptr);
86 intmax_t strto_intmax_dec (const char *str, size_t len, char **endptr);
87 intmax_t strto_intmax_hex (const char *str, size_t len, char **endptr);
88
89 OSCAP_HIDDEN_END;
90
91 #endif /* STRTO_H */