libstdc++
cstring
Go to the documentation of this file.
00001 // -*- C++ -*- forwarding header.
00002 
00003 // Copyright (C) 1997-2013 Free Software Foundation, Inc.
00004 //
00005 // This file is part of the GNU ISO C++ Library.  This library is free
00006 // software; you can redistribute it and/or modify it under the
00007 // terms of the GNU General Public License as published by the
00008 // Free Software Foundation; either version 3, or (at your option)
00009 // any later version.
00010 
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 // GNU General Public License for more details.
00015 
00016 // Under Section 7 of GPL version 3, you are granted additional
00017 // permissions described in the GCC Runtime Library Exception, version
00018 // 3.1, as published by the Free Software Foundation.
00019 
00020 // You should have received a copy of the GNU General Public License and
00021 // a copy of the GCC Runtime Library Exception along with this program;
00022 // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
00023 // <http://www.gnu.org/licenses/>.
00024 
00025 /** @file cstring
00026  *  This is a Standard C++ Library file.  You should @c \#include this file
00027  *  in your programs, rather than any of the @a *.h implementation files.
00028  *
00029  *  This is the C++ version of the Standard C Library header @c string.h,
00030  *  and its contents are (mostly) the same as that header, but are all
00031  *  contained in the namespace @c std (except for names which are defined
00032  *  as macros in C).
00033  */
00034 
00035 //
00036 // ISO C++ 14882: 20.4.6  C library
00037 //
00038 
00039 #pragma GCC system_header
00040 
00041 #include <bits/c++config.h>
00042 #include <string.h>
00043 
00044 #ifndef _GLIBCXX_CSTRING
00045 #define _GLIBCXX_CSTRING 1
00046 
00047 // Get rid of those macros defined in <string.h> in lieu of real functions.
00048 #undef memchr
00049 #undef memcmp
00050 #undef memcpy
00051 #undef memmove
00052 #undef memset
00053 #undef strcat
00054 #undef strchr
00055 #undef strcmp
00056 #undef strcoll
00057 #undef strcpy
00058 #undef strcspn
00059 #undef strerror
00060 #undef strlen
00061 #undef strncat
00062 #undef strncmp
00063 #undef strncpy
00064 #undef strpbrk
00065 #undef strrchr
00066 #undef strspn
00067 #undef strstr
00068 #undef strtok
00069 #undef strxfrm
00070 
00071 namespace std _GLIBCXX_VISIBILITY(default)
00072 {
00073 _GLIBCXX_BEGIN_NAMESPACE_VERSION
00074 
00075   using ::memchr;
00076   using ::memcmp;
00077   using ::memcpy;
00078   using ::memmove;
00079   using ::memset;
00080   using ::strcat;
00081   using ::strcmp;
00082   using ::strcoll;
00083   using ::strcpy;
00084   using ::strcspn;
00085   using ::strerror;
00086   using ::strlen;
00087   using ::strncat;
00088   using ::strncmp;
00089   using ::strncpy;
00090   using ::strspn;
00091   using ::strtok;
00092   using ::strxfrm;
00093   using ::strchr;
00094   using ::strpbrk;
00095   using ::strrchr;
00096   using ::strstr;
00097 
00098 #ifndef __CORRECT_ISO_CPP_STRING_H_PROTO
00099   inline void*
00100   memchr(void* __s, int __c, size_t __n)
00101   { return __builtin_memchr(__s, __c, __n); }
00102 
00103   inline char*
00104   strchr(char* __s, int __n)
00105   { return __builtin_strchr(__s, __n); }
00106 
00107   inline char*
00108   strpbrk(char* __s1, const char* __s2)
00109   { return __builtin_strpbrk(__s1, __s2); }
00110 
00111   inline char*
00112   strrchr(char* __s, int __n)
00113   { return __builtin_strrchr(__s, __n); }
00114 
00115   inline char*
00116   strstr(char* __s1, const char* __s2)
00117   { return __builtin_strstr(__s1, __s2); }
00118 #endif
00119 
00120 _GLIBCXX_END_NAMESPACE_VERSION
00121 } // namespace
00122 
00123 #endif