/** SGX

The   sss    gggg x   x   
     s      g      x x    Engine
      sss   g  gg   x
         s  g   g  x x          Copyright 1995-2008.
     ssss    gggg x   x         Steven Goodwin. All Rights Reserved.
    
This version has been released under the GNU Public License v2.0.

Please see the license files for details.

File: include/sgx/core/sgxlib/string.hpp

*/

#ifndef SGX_CORE_SGXLIB_STRING_HPP
#define SGX_CORE_SGXLIB_STRING_HPP


//
// Individual character handlers
//
tCHAR sgxLower(tCHAR c);
tCHAR sgxUpper(tCHAR c);

//
// C string wrappers
//
#define sgxSprintf  sprintf			// but try not to use this! sgxStringFormat is better

tSIZET  sgxStrlen(const tCHAR *pString);
tCHAR * sgxStrcpy(tCHAR *pDest, const tCHAR *pSrc);
tCHAR * sgxStrncpy(tCHAR *pDest, const tCHAR *pSrc, tMEM_SIZE maxChars);
tCHAR * sgxStrcat(tCHAR *pDest, const tCHAR *pSrc);
int     sgxStrcmp(const tCHAR *pStr1, const tCHAR *pStr2);
int		sgxStrncmp(const tCHAR *pSrc1, const tCHAR *pSrc2, const tMEM_SIZE iMaxCount);
int     sgxStricmp(const tCHAR *pStr1, const tCHAR *pStr2);
tCHAR * sgxStrchr(const tCHAR *pStr1, int c);
tCHAR * sgxStrdup(tCHAR *pStr);
tCHAR * sgxStrupr(tCHAR *pStr);
tCHAR * sgxStrlwr(tCHAR *pStr);
tINT32 	sgxAtoi(const tCHAR *pStr);
tLONG 	sgxAtol(const tCHAR *pStr);
tREAL32	sgxAtof(const tCHAR *pStr);
tBOOL 	sgxBoolean(const tCHAR *pStr);
tBOOL 	sgxIsTrue(const tCHAR *pStr);
tBOOL 	sgxIsFalse(const tCHAR *pStr);


//
// C++ versions for completeness.
//
tSIZET  sgxStrlen(const sgxString &str);
void	sgxStrcpy(sgxString &dest, const sgxString &src);
void	sgxStrcat(sgxString &dest, const sgxString &src);
int     sgxStrcmp(const sgxString &str1, const sgxString &str2);
int     sgxStrncmp(const sgxString &str1, const sgxString &str2, const tMEM_SIZE iMaxCount);
int     sgxStricmp(const sgxString &str1, const sgxString &str2);
sgxString sgxStrupr(const sgxString &str);
sgxString sgxStrlwr(const sgxString &str);
tCHAR * sgxStrchr(const sgxString &str, int c);
tINT32 	sgxAtoi(const sgxString &str);
tLONG 	sgxAtol(const sgxString &str);
tREAL32	sgxAtof(const sgxString &str);
tBOOL 	sgxBoolean(const sgxString &str);
tBOOL 	sgxIsTrue(const sgxString &str);
tBOOL 	sgxIsFalse(const sgxString &str);

//
// Misc. String functions
//
typedef enum {
	eSmallestPossible,
	eMinutesColonSeconds,
} tTimeFormat;
void	sgxFormatStringTime(sgxString &str, const tUINT32 secs, const tTimeFormat fmt = eMinutesColonSeconds);
void	sgxFormatStringTime(sgxString &str, const tUINT32 mins, const tUINT32 secs, const tTimeFormat fmt = eMinutesColonSeconds);
void	sgxFormatStringTime(sgxString &str, const tUINT32 hrs, const tUINT32 mins, const tUINT32 secs, const tTimeFormat fmt = eMinutesColonSeconds);
void	sgxStringFormat(sgxString &result, const char *pText, ...);

#endif /* SGX_CORE_SGXLIB_STRING_HPP */

