/*******************************************************************

Copyright (c) 2004 Open Mobile Alliance, Ltd.  All Rights Reserved.

This software is made available under the usage and distribution terms 
covered by the Common Public License 1.0 and by using this software you
are bound by the terms and conditions of the same.

EXCEPT AS EXPRESSLY SET FORTH IN THE COMMON PUBLIC LICENSE,
THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, 
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 
EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, 
ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, 
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
   
Each recipient is solely responsible for determining the 
appropriateness of using and distributing this program and assumes 
all risks associated with its exercise of rights under the Common 
Public License, including but not limited to the risks and 
costs of program errors, compliance with applicable laws, 
damage to or loss of data, programs or equipment, and 
unavailability or interruption of operations.

********************************************************************/
/*************************************************************************/
/* module:          Library for String Functions                         */
/*                                                                       */
/* file:            libstr.h                                             */
/* target system:   ALL                                                  */
/* target OS:       ALL                                                  */   
/*                                                                       */
/* Description:                                                          */
/* Header for the implementation of common string-handling functions     */
/*************************************************************************/

#ifndef __LIB_STR_H
#define __LIB_STR_H

/*************************************************************************
 *  Definitions
 *************************************************************************/

#include "smldef.h"
#include "libmem.h"
#ifdef __ANSI_C__
#include <string.h>
#endif
#ifdef __PALM_OS__
#include <StringMgr.h>
#endif


/*************************************************************************
 *  External Functions for all Toolkit versions
 *************************************************************************/


#ifdef __PALM_OS__  /* we use #define to reduce heap usage */
  String_t   smlLibStrdup (const char* constStringP);
  #define		smlLibStrcpy(pTarget,pSource)		 	(char*)StrCopy((char*)pTarget,(char*)pSource)
  #define		smlLibStrncpy(pTarget,pSource,count)	  (char*)StrNCopy((char*)pTarget,(char*)pSource,count)
  #define		smlLibStrcat(pTarget,pSource)	  (char*)StrCat((char*)pTarget,(char*)pSource)
  #define		smlLibStrcmp(pTarget,pSource)	  StrCompare((char*)pTarget,(char*)pSource)
  #define		smlLibStrncmp(pTarget,pSource,count)	 StrNCompare((char*)pTarget,(char*)pSource,count)
  #define		smlLibStrchr(pString,character)		(char*)StrChr((String_t)pString,character)
  #define		smlLibStrlen(pString)	  StrLen((char*)pString)
#else               /* we use functions, to make the library exportable */
  SML_API_DEF String_t 	smlLibStrdup (const char *constStringP);
  SML_API_DEF String_t	smlLibStrcpy(const char *pTarget, const char *pSource);
  SML_API_DEF String_t	smlLibStrncpy(const char *pTarget, const char *pSource, int count);
  SML_API_DEF String_t	smlLibStrcat(const char *pTarget, const char *pSource);
  SML_API_DEF int		smlLibStrcmp(const char *pTarget, const char *pSource);
  SML_API_DEF int		smlLibStrncmp(const char *pTarget, const char *pSource, int count);
  SML_API_DEF String_t	smlLibStrchr(const char *pString, char character);
  SML_API_DEF int		smlLibStrlen(const char *pString);
#endif




/*************************************************************************
 *  Additional External Functions for Full Sized Toolkit Only
 *************************************************************************/

#ifndef __SML_LITE__  /* these API calls are NOT included in the Toolkit lite version */
#ifdef __PALM_OS__  /* we use define to reduce heap usage */
  #define		smlLibStrncat(pTarget,pSource,count)	 (char*)StrNCat((char*)pTarget,(char*)pSource,count)
  #define		smlLibStrstr(pString,pSubstring)	 (char*)StrStr((char*)pString,(char*)pSubstring)
#else               /* we use functions, to make the library exportable */
  SML_API_DEF String_t	smlLibStrncat(const char *pTarget, const char *pSource, int count);
  SML_API_DEF String_t	smlLibStrstr(const char *pString, const char *pSubString);
#endif
#endif


#endif
