Codemesh Runtime v3 C++ API Reference  3.9.205
xmog_util.h
1 //
2 // Copyright (c) 1999-2020 by Codemesh, Inc.. ALL RIGHTS RESERVED.
3 //
4 
5 
6 #ifndef xmog_util_inc
7 #define xmog_util_inc
8 
9 
10 #include "xmog.h"
11 #if (XMOG_SUPPORTS_CLR_HOSTING==1)
12 # include <guiddef.h>
13 #endif
14 
15 
16 enum xmog_privileges
17 {
18  PrivilegesNone = 0,
19  Read = 1,
20  Write = 2,
21  ReadWrite = 3,
22  Execute = 4,
23  List = 4,
24  All = 7
25 };
26 
27 
31 class XMOG_DECLSPEC xmog_util
32 {
33 public:
34 
40  static void * alloc( size_t len );
41 
47  static void free( void * ptr );
48 
62  static char * setString( char * & strVar, const char * value, size_t len = (size_t)-1 );
63 
64 # if (XMOG_SUPPORTS_WCHAR_T==1)
65  static XMOG_WCHAR * setString( XMOG_WCHAR * & strVar, const XMOG_WCHAR * value, size_t len = (size_t)-1 );
79 # endif
80 
81 
82  static unsigned short * setString_u16( unsigned short * & strVar, const unsigned short * value, size_t len = (size_t)-1 );
83 
90  static size_t strlen_u16( const unsigned short * str );
91 
98  static size_t strlen_XMOG_WCHAR( const XMOG_WCHAR * str );
99 
107  static void strncpy_u16( unsigned short * dest, const unsigned short * src, size_t len );
108 
109 # if (XMOG_REQUIRES_UNSIGNED_SHORT_OVERLOAD==1)
110  static unsigned short * setString( unsigned short * & strVar, const unsigned short * value, size_t len = (size_t)-1 );
124 # endif
125 
132  static bool to_bool( const char * strVal );
133 
134 
135 # if (XMOG_SUPPORTS_WCHAR_T==1)
136  static bool to_bool( const XMOG_WCHAR * strVal );
143 # endif
144 
145 
146 # if (XMOG_REQUIRES_UNSIGNED_SHORT_OVERLOAD==1)
147  static bool to_bool( const unsigned short * strVal );
154 # endif
155 
156 
180  static void * to_funptr( const char * strVal );
181 
182 
183 # if (XMOG_SUPPORTS_WCHAR_T==1)
184  static void * to_funptr( const XMOG_WCHAR * strVal );
208 # endif
209 
210 
211 # if (XMOG_REQUIRES_UNSIGNED_SHORT_OVERLOAD==1)
212  static void * to_funptr( const unsigned short * strVal );
236 # endif
237 
247  static char * concatStrings( const char * str1, const char * str2 );
248 
259  static bool endsWith( const char * str, const char * suffix, bool bCaseSensitive = true );
260 
267  static int hasFileAccess( const char * name, xmog_privileges priv );
268 
283  static bool hasProperType( const char * name );
284 
288  static bool isWindows();
289 
293  static int readLine( FILE * file, char * & line );
294 
305  static void sleep( int ms );
306 
314  static unsigned short * utf8_to_u16( const char * utf8 );
315 
323  static unsigned char * utf16_to_u8( const unsigned short * utf16 );
324 
325 # if (XMOG_SUPPORTS_CLR_HOSTING==1)
326 
334  static char * guid_to_utf8( char * dest, REFGUID src );
335 
342  static void utf8_to_guid( GUID & dest, const char * src );
343 
350  static void utf16_to_guid( GUID & dest, const unsigned short * src );
351 
352 # endif
353 
354 };
355 
356 
357 #endif /* xmog_util_inc */
xmog_util
A utility class providing several commonly useful methods.
Definition: xmog_util.h:31

Copyright (c) 1999-2020 by Codemesh, Inc., ALL RIGHTS RESERVED.