1999-08-16 21:50:52 +00:00
|
|
|
/*
|
|
|
|
*******************************************************************************
|
1999-12-13 22:28:37 +00:00
|
|
|
*
|
|
|
|
* Copyright (C) 1997-1999, International Business Machines
|
|
|
|
* Corporation and others. All Rights Reserved.
|
|
|
|
*
|
1999-08-16 21:50:52 +00:00
|
|
|
*******************************************************************************
|
|
|
|
*
|
|
|
|
* File CSTRING.H
|
|
|
|
*
|
|
|
|
* Contains CString interface
|
|
|
|
*
|
|
|
|
* @author Helena Shih
|
|
|
|
*
|
|
|
|
* Modification History:
|
|
|
|
*
|
|
|
|
* Date Name Description
|
|
|
|
* 6/17/98 hshih Created.
|
|
|
|
* 05/03/99 stephen Changed from functions to macros.
|
|
|
|
* 06/14/99 stephen Added icu_strncat, icu_strncmp, icu_tolower
|
|
|
|
*
|
|
|
|
*******************************************************************************
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef CSTRING_H
|
|
|
|
#define CSTRING_H 1
|
|
|
|
|
|
|
|
#include <string.h>
|
2000-10-09 22:08:05 +00:00
|
|
|
#include <stdlib.h>
|
1999-08-16 21:50:52 +00:00
|
|
|
#include <ctype.h>
|
1999-12-28 23:39:02 +00:00
|
|
|
#include "unicode/utypes.h"
|
1999-08-16 21:50:52 +00:00
|
|
|
|
2000-04-06 23:22:58 +00:00
|
|
|
/* Do this after utypes.h so that we have U_HAVE_WCHAR_H . */
|
|
|
|
#if U_HAVE_WCHAR_H
|
|
|
|
# include <wchar.h>
|
|
|
|
#endif
|
|
|
|
|
1999-12-28 23:39:02 +00:00
|
|
|
#define uprv_strcpy(dst, src) strcpy(dst, src)
|
|
|
|
#define uprv_strcpyWithSize(dst, src, size) strncpy(dst, src, size)
|
|
|
|
#define uprv_strncpy(dst, src, size) strncpy(dst, src, size)
|
|
|
|
#define uprv_strlen(str) strlen(str)
|
|
|
|
#define uprv_strcmp(s1, s2) strcmp(s1, s2)
|
|
|
|
#define uprv_strncmp(s1, s2, n) strncmp(s1, s2, n)
|
|
|
|
#define uprv_strcat(dst, src) strcat(dst, src)
|
|
|
|
#define uprv_strncat(dst, src, n) strncat(dst, src, n)
|
|
|
|
#define uprv_strchr(s, c) strchr(s, c)
|
|
|
|
#define uprv_strstr(s, c) strstr(s, c)
|
|
|
|
#define uprv_strrchr(s, c) strrchr(s, c)
|
|
|
|
#define uprv_toupper(c) toupper(c)
|
|
|
|
#define uprv_tolower(c) tolower(c)
|
|
|
|
#define uprv_strtoul(str, end, base) strtoul(str, end, base)
|
2000-07-13 17:55:26 +00:00
|
|
|
#define uprv_strtol(str, end, base) strtol(str, end, base)
|
1999-11-23 22:52:17 +00:00
|
|
|
#ifdef WIN32
|
1999-12-28 23:39:02 +00:00
|
|
|
# define uprv_stricmp(str1, str2) _stricmp(str1, str2)
|
2000-08-04 04:48:09 +00:00
|
|
|
# define uprv_strnicmp(str1, str2, n) _strnicmp(str1, str2, n)
|
1999-11-23 22:52:17 +00:00
|
|
|
#elif defined(POSIX)
|
1999-12-28 23:39:02 +00:00
|
|
|
# define uprv_stricmp(str1, str2) strcasecmp(str1, str2)
|
2000-08-04 04:48:09 +00:00
|
|
|
# define uprv_strnicmp(str1, str2, n) strncasecmp(str1, str2, n)
|
1999-11-23 22:52:17 +00:00
|
|
|
#else
|
1999-12-28 23:39:02 +00:00
|
|
|
# define uprv_stricmp(str1, str2) T_CString_stricmp(str1, str2)
|
2000-08-04 04:48:09 +00:00
|
|
|
# define uprv_strnicmp(str1, str2, n) T_CString_strnicmp(str1, str2, n)
|
1999-11-23 22:52:17 +00:00
|
|
|
#endif
|
2000-05-15 22:09:42 +00:00
|
|
|
U_CAPI char *uprv_strdup(const char *src);
|
1999-08-16 21:50:52 +00:00
|
|
|
|
1999-10-15 18:09:53 +00:00
|
|
|
/*===========================================================================*/
|
|
|
|
/* Wide-character functions */
|
|
|
|
/*===========================================================================*/
|
2000-04-06 23:06:48 +00:00
|
|
|
|
2000-10-05 19:33:35 +00:00
|
|
|
/* The following are not available on all systems, defined in wchar.h or string.h. */
|
|
|
|
#if U_HAVE_WCSCPY
|
2000-04-07 01:24:48 +00:00
|
|
|
# define uprv_wcscpy wcscpy
|
2000-10-05 19:33:35 +00:00
|
|
|
# define uprv_wcscat wcscat
|
2000-04-07 01:24:48 +00:00
|
|
|
# define uprv_wcslen wcslen
|
2000-04-06 23:06:48 +00:00
|
|
|
#else
|
|
|
|
U_CAPI wchar_t *uprv_wcscpy(wchar_t *dst, const wchar_t *src);
|
2000-10-05 19:33:35 +00:00
|
|
|
U_CAPI wchar_t *uprv_wcscat(wchar_t *dst, const wchar_t *src);
|
2000-04-06 23:06:48 +00:00
|
|
|
U_CAPI size_t uprv_wcslen(const wchar_t *src);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* The following are part of the ANSI C standard, defined in stdlib.h . */
|
1999-12-28 23:39:02 +00:00
|
|
|
#define uprv_wcstombs(mbstr, wcstr, count) wcstombs(mbstr, wcstr, count)
|
|
|
|
#define uprv_mbstowcs(wcstr, mbstr, count) mbstowcs(wcstr, mbstr, count)
|
1999-10-15 18:09:53 +00:00
|
|
|
|
1999-10-18 22:48:32 +00:00
|
|
|
U_CAPI char* U_EXPORT2
|
1999-08-16 21:50:52 +00:00
|
|
|
T_CString_toLowerCase(char* str);
|
|
|
|
|
1999-10-18 22:48:32 +00:00
|
|
|
U_CAPI char* U_EXPORT2
|
1999-08-16 21:50:52 +00:00
|
|
|
T_CString_toUpperCase(char* str);
|
|
|
|
|
1999-10-18 22:48:32 +00:00
|
|
|
U_CAPI void U_EXPORT2
|
1999-08-16 21:50:52 +00:00
|
|
|
T_CString_integerToString(char *buffer, int32_t n, int32_t radix);
|
|
|
|
|
1999-10-18 22:48:32 +00:00
|
|
|
U_CAPI int32_t U_EXPORT2
|
1999-08-16 21:50:52 +00:00
|
|
|
T_CString_stringToInteger(const char *integerString, int32_t radix);
|
|
|
|
|
1999-11-23 22:52:17 +00:00
|
|
|
U_CAPI int U_EXPORT2
|
|
|
|
T_CString_stricmp(const char *str1, const char *str2);
|
|
|
|
|
2000-08-04 04:48:09 +00:00
|
|
|
U_CAPI int U_EXPORT2
|
|
|
|
T_CString_strnicmp(const char *str1, const char *str2, uint32_t n);
|
|
|
|
|
1999-08-16 21:50:52 +00:00
|
|
|
#endif /* ! CSTRING_H */
|