Main Page | Modules | Class Hierarchy | Class List | Directories | File List | Class Members | Related Pages

xmog_util.h

00001 /*
00002  * Copyright 1999-2006 by Codemesh, Inc.  ALL RIGHTS RESERVED.
00003  */
00004 
00005 #ifndef xmog_util_inc
00006 #define xmog_util_inc
00007 
00008 
00009 #include "xmog.h"
00010 
00011 
00012 enum xmog_privileges
00013 {
00014     PrivilegesNone = 0,
00015     Read = 1,
00016     Write = 2,
00017     ReadWrite = 3,
00018     Execute = 4,
00019     List = 4,
00020     All = 7
00021 };
00022 
00023 
00027 class XMOG_DECLSPEC xmog_util
00028 {
00029 public:
00030 
00036     static void *       alloc( size_t len );
00037 
00043     static void         free( void * ptr );
00044 
00058     static char *       setString( char * & strVar, const char * value, size_t len = (size_t)-1 );
00059 
00060 #   if (XMOG_SUPPORTS_WCHAR_T==1)
00074     static XMOG_WCHAR * setString( XMOG_WCHAR * & strVar, const XMOG_WCHAR * value, size_t len = (size_t)-1 );
00075 #   endif
00076 
00077 
00078     static unsigned short * setString_u16( unsigned short * & strVar, const unsigned short * value, size_t len = (size_t)-1 );
00079 
00086     static size_t           strlen_u16( const unsigned short * str );
00087 
00095     static void             strncpy_u16( unsigned short * dest, const unsigned short * src, size_t len );
00096 
00097 #   if (XMOG_REQUIRES_UNSIGNED_SHORT_OVERLOAD==1)
00111     static unsigned short * setString( unsigned short * & strVar, const unsigned short * value, size_t len = (size_t)-1 );
00112 #   endif
00113 
00120     static bool         to_bool( const char * strVal );
00121 
00122 
00123 #   if (XMOG_SUPPORTS_WCHAR_T==1)
00130     static bool         to_bool( const XMOG_WCHAR * strVal );
00131 #   endif
00132 
00133 
00134 #   if (XMOG_REQUIRES_UNSIGNED_SHORT_OVERLOAD==1)
00141     static bool         to_bool( const unsigned short * strVal );
00142 #   endif
00143 
00144 
00168     static void *       to_funptr( const char * strVal );
00169 
00170 
00171 #   if (XMOG_SUPPORTS_WCHAR_T==1)
00195     static void *       to_funptr( const XMOG_WCHAR * strVal );
00196 #   endif
00197 
00198 
00199 #   if (XMOG_REQUIRES_UNSIGNED_SHORT_OVERLOAD==1)
00223     static void *       to_funptr( const unsigned short * strVal );
00224 #   endif
00225 
00235     static char *       concatStrings( const char * str1, const char * str2 );
00236 
00247     static bool         endsWith( const char * str, const char * suffix, bool bCaseSensitive = true );
00248 
00255     static int          hasFileAccess( const char * name, xmog_privileges priv );
00256 
00260     static bool         isWindows();
00261 
00265     static int          readLine( FILE * file, char * & line );
00266 
00277     static void         sleep( int ms );
00278 
00286     static unsigned short * utf8_to_u16( const char * utf8 );
00287 };
00288 
00289 
00290 #endif /* xmog_util_inc */

Generated on Wed May 31 14:01:19 2006 for Shared Codemesh Runtime Library API Reference by  doxygen 1.4.1