1 /*************************************************************************/ 2 /* module: Library for String Functions */ 3 /* */ 4 /* file: libstr.h */ 5 /* target system: ALL */ 6 /* target OS: ALL */ 7 /* */ 8 /* Description: */ 9 /* Header for the implementation of common string-handling functions */ 10 /*************************************************************************/ 11 12 13 14 /* 15 * Copyright Notice 16 * Copyright (c) Ericsson, IBM, Lotus, Matsushita Communication 17 * Industrial Co., Ltd., Motorola, Nokia, Openwave Systems, Inc., 18 * Palm, Inc., Psion, Starfish Software, Symbian, Ltd. (2001). 19 * All Rights Reserved. 20 * Implementation of all or part of any Specification may require 21 * licenses under third party intellectual property rights, 22 * including without limitation, patent rights (such a third party 23 * may or may not be a Supporter). The Sponsors of the Specification 24 * are not responsible and shall not be held responsible in any 25 * manner for identifying or failing to identify any or all such 26 * third party intellectual property rights. 27 * 28 * THIS DOCUMENT AND THE INFORMATION CONTAINED HEREIN ARE PROVIDED 29 * ON AN "AS IS" BASIS WITHOUT WARRANTY OF ANY KIND AND ERICSSON, IBM, 30 * LOTUS, MATSUSHITA COMMUNICATION INDUSTRIAL CO. LTD, MOTOROLA, 31 * NOKIA, PALM INC., PSION, STARFISH SOFTWARE AND ALL OTHER SYNCML 32 * SPONSORS DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING 33 * BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION 34 * HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF 35 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT 36 * SHALL ERICSSON, IBM, LOTUS, MATSUSHITA COMMUNICATION INDUSTRIAL CO., 37 * LTD, MOTOROLA, NOKIA, PALM INC., PSION, STARFISH SOFTWARE OR ANY 38 * OTHER SYNCML SPONSOR BE LIABLE TO ANY PARTY FOR ANY LOSS OF 39 * PROFITS, LOSS OF BUSINESS, LOSS OF USE OF DATA, INTERRUPTION OF 40 * BUSINESS, OR FOR DIRECT, INDIRECT, SPECIAL OR EXEMPLARY, INCIDENTAL, 41 * PUNITIVE OR CONSEQUENTIAL DAMAGES OF ANY KIND IN CONNECTION WITH 42 * THIS DOCUMENT OR THE INFORMATION CONTAINED HEREIN, EVEN IF ADVISED 43 * OF THE POSSIBILITY OF SUCH LOSS OR DAMAGE. 44 * 45 * The above notice and this paragraph must be included on all copies 46 * of this document that are made. 47 * 48 */ 49 50 51 #ifndef __LIB_STR_H 52 #define __LIB_STR_H 53 54 /************************************************************************* 55 * Definitions 56 *************************************************************************/ 57 58 #include "smldef.h" 59 #include "libmem.h" 60 #ifdef __ANSI_C__ 61 #include <string.h> 62 #endif 63 #ifdef __PALM_OS__ 64 #include <StringMgr.h> 65 #endif 66 67 68 /************************************************************************* 69 * External Functions for all Toolkit versions 70 *************************************************************************/ 71 72 73 #ifdef __PALM_OS__ /* we use #define to reduce heap usage */ 74 String_t smlLibStrdup (const char* constStringP); 75 #define smlLibStrcpy(pTarget,pSource) (char*)StrCopy((char*)pTarget,(char*)pSource) 76 #define smlLibStrncpy(pTarget,pSource,count) (char*)StrNCopy((char*)pTarget,(char*)pSource,count) 77 #define smlLibStrcat(pTarget,pSource) (char*)StrCat((char*)pTarget,(char*)pSource) 78 #define smlLibStrcmp(pTarget,pSource) StrCompare((char*)pTarget,(char*)pSource) 79 #define smlLibStrncmp(pTarget,pSource,count) StrNCompare((char*)pTarget,(char*)pSource,count) 80 #define smlLibStrchr(pString,character) (char*)StrChr((String_t)pString,character) 81 #define smlLibStrlen(pString) StrLen((char*)pString) 82 #else /* we use functions, to make the library exportable */ 83 SML_API_DEF String_t smlLibStrdup (const char *constStringP); 84 SML_API_DEF String_t smlLibStrcpy(const char *pTarget, const char *pSource); 85 SML_API_DEF String_t smlLibStrncpy(const char *pTarget, const char *pSource, int count); 86 SML_API_DEF String_t smlLibStrcat(const char *pTarget, const char *pSource); 87 SML_API_DEF int smlLibStrcmp(const char *pTarget, const char *pSource); 88 SML_API_DEF int smlLibStrncmp(const char *pTarget, const char *pSource, int count); 89 SML_API_DEF String_t smlLibStrchr(const char *pString, char character); 90 SML_API_DEF int smlLibStrlen(const char *pString); 91 #endif 92 93 94 95 96 /************************************************************************* 97 * Additional External Functions for Full Sized Toolkit Only 98 *************************************************************************/ 99 100 #ifndef __SML_LITE__ /* these API calls are NOT included in the Toolkit lite version */ 101 #ifdef __PALM_OS__ /* we use define to reduce heap usage */ 102 #define smlLibStrncat(pTarget,pSource,count) (char*)StrNCat((char*)pTarget,(char*)pSource,count) 103 #define smlLibStrstr(pString,pSubstring) (char*)StrStr((char*)pString,(char*)pSubstring) 104 #else /* we use functions, to make the library exportable */ 105 SML_API_DEF String_t smlLibStrncat(const char *pTarget, const char *pSource, int count); 106 SML_API_DEF String_t smlLibStrstr(const char *pString, const char *pSubString); 107 #endif 108 #endif 109 110 111 #endif 112