diff options
author | Brad King <brad.king@kitware.com> | 2007-12-11 16:36:57 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2007-12-11 16:36:57 (GMT) |
commit | b0078fd3b4738ed51634f9e720cff3a2cb0032aa (patch) | |
tree | 4a90dbdab72ee13d50f7c3c66bff9df370a11ffe /Source/kwsys/String.h.in | |
parent | 76ef80a931416afe9080b32247125529281a7d0b (diff) | |
download | CMake-b0078fd3b4738ed51634f9e720cff3a2cb0032aa.zip CMake-b0078fd3b4738ed51634f9e720cff3a2cb0032aa.tar.gz CMake-b0078fd3b4738ed51634f9e720cff3a2cb0032aa.tar.bz2 |
ENH: Added C String utilities to KWSys. Implemented strcasecmp and strncasecmp.
Diffstat (limited to 'Source/kwsys/String.h.in')
-rw-r--r-- | Source/kwsys/String.h.in | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/Source/kwsys/String.h.in b/Source/kwsys/String.h.in new file mode 100644 index 0000000..f64c253 --- /dev/null +++ b/Source/kwsys/String.h.in @@ -0,0 +1,65 @@ +/*========================================================================= + + Program: KWSys - Kitware System Library + Module: $RCSfile$ + + Copyright (c) Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.kitware.com/Copyright.htm for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ +#ifndef @KWSYS_NAMESPACE@_String_h +#define @KWSYS_NAMESPACE@_String_h + +#include <@KWSYS_NAMESPACE@/Configure.h> + +#include <stddef.h> /* size_t */ + +/* Redefine all public interface symbol names to be in the proper + namespace. These macros are used internally to kwsys only, and are + not visible to user code. Use kwsysHeaderDump.pl to reproduce + these macros after making changes to the interface. */ +#if !defined(KWSYS_NAMESPACE) +# define kwsys_ns(x) @KWSYS_NAMESPACE@##x +# define kwsysEXPORT @KWSYS_NAMESPACE@_EXPORT +#endif +#define kwsysString_strcasecmp kwsys_ns(String_strcasecmp) +#define kwsysString_strncasecmp kwsys_ns(String_strncasecmp) + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/** + * Compare two strings ignoring the case of the characters. The + * integer returned is negative, zero, or positive if the first string + * is found to be less than, equal to, or greater than the second + * string, respectively. + */ +kwsysEXPORT int kwsysString_strcasecmp(const char* lhs, const char* rhs); + +/** + * Identical to String_strcasecmp except that only the first n + * characters are considered. + */ +kwsysEXPORT int kwsysString_strncasecmp(const char* lhs, const char* rhs, + size_t n); + +#if defined(__cplusplus) +} /* extern "C" */ +#endif + +/* If we are building a kwsys .c or .cxx file, let it use these macros. + Otherwise, undefine them to keep the namespace clean. */ +#if !defined(KWSYS_NAMESPACE) +# undef kwsys_ns +# undef kwsysEXPORT +# undef kwsysString_strcasecmp +# undef kwsysString_strncasecmp +#endif + +#endif |