OLD | NEW |
| (Empty) |
1 // -*- C++ -*- forwarding header. | |
2 | |
3 // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, | |
4 // 2006, 2007, 2008, 2009 | |
5 // Free Software Foundation, Inc. | |
6 // | |
7 // This file is part of the GNU ISO C++ Library. This library is free | |
8 // software; you can redistribute it and/or modify it under the | |
9 // terms of the GNU General Public License as published by the | |
10 // Free Software Foundation; either version 3, or (at your option) | |
11 // any later version. | |
12 | |
13 // This library is distributed in the hope that it will be useful, | |
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 // GNU General Public License for more details. | |
17 | |
18 // Under Section 7 of GPL version 3, you are granted additional | |
19 // permissions described in the GCC Runtime Library Exception, version | |
20 // 3.1, as published by the Free Software Foundation. | |
21 | |
22 // You should have received a copy of the GNU General Public License and | |
23 // a copy of the GCC Runtime Library Exception along with this program; | |
24 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see | |
25 // <http://www.gnu.org/licenses/>. | |
26 | |
27 /** @file cstring | |
28 * This is a Standard C++ Library file. You should @c #include this file | |
29 * in your programs, rather than any of the "*.h" implementation files. | |
30 * | |
31 * This is the C++ version of the Standard C Library header @c string.h, | |
32 * and its contents are (mostly) the same as that header, but are all | |
33 * contained in the namespace @c std (except for names which are defined | |
34 * as macros in C). | |
35 */ | |
36 | |
37 // | |
38 // ISO C++ 14882: 20.4.6 C library | |
39 // | |
40 | |
41 #pragma GCC system_header | |
42 | |
43 #include <bits/c++config.h> | |
44 #include <cstddef> | |
45 #include <string.h> | |
46 | |
47 #ifndef _GLIBCXX_CSTRING | |
48 #define _GLIBCXX_CSTRING 1 | |
49 | |
50 // Get rid of those macros defined in <string.h> in lieu of real functions. | |
51 #undef memchr | |
52 #undef memcmp | |
53 #undef memcpy | |
54 #undef memmove | |
55 #undef memset | |
56 #undef strcat | |
57 #undef strchr | |
58 #undef strcmp | |
59 #undef strcoll | |
60 #undef strcpy | |
61 #undef strcspn | |
62 #undef strerror | |
63 #undef strlen | |
64 #undef strncat | |
65 #undef strncmp | |
66 #undef strncpy | |
67 #undef strpbrk | |
68 #undef strrchr | |
69 #undef strspn | |
70 #undef strstr | |
71 #undef strtok | |
72 #undef strxfrm | |
73 | |
74 _GLIBCXX_BEGIN_NAMESPACE(std) | |
75 | |
76 using ::memchr; | |
77 using ::memcmp; | |
78 using ::memcpy; | |
79 using ::memmove; | |
80 using ::memset; | |
81 using ::strcat; | |
82 using ::strcmp; | |
83 using ::strcoll; | |
84 using ::strcpy; | |
85 using ::strcspn; | |
86 using ::strerror; | |
87 using ::strlen; | |
88 using ::strncat; | |
89 using ::strncmp; | |
90 using ::strncpy; | |
91 using ::strspn; | |
92 using ::strtok; | |
93 using ::strxfrm; | |
94 using ::strchr; | |
95 using ::strpbrk; | |
96 using ::strrchr; | |
97 using ::strstr; | |
98 | |
99 #ifndef __CORRECT_ISO_CPP_STRING_H_PROTO | |
100 inline void* | |
101 memchr(void* __p, int __c, size_t __n) | |
102 { return memchr(const_cast<const void*>(__p), __c, __n); } | |
103 | |
104 inline char* | |
105 strchr(char* __s1, int __n) | |
106 { return __builtin_strchr(const_cast<const char*>(__s1), __n); } | |
107 | |
108 inline char* | |
109 strpbrk(char* __s1, const char* __s2) | |
110 { return __builtin_strpbrk(const_cast<const char*>(__s1), __s2); } | |
111 | |
112 inline char* | |
113 strrchr(char* __s1, int __n) | |
114 { return __builtin_strrchr(const_cast<const char*>(__s1), __n); } | |
115 | |
116 inline char* | |
117 strstr(char* __s1, const char* __s2) | |
118 { return __builtin_strstr(const_cast<const char*>(__s1), __s2); } | |
119 #endif | |
120 | |
121 _GLIBCXX_END_NAMESPACE | |
122 | |
123 #endif | |
OLD | NEW |