#include <xmog_util.h>
Static Public Member Functions | |
| static void * | alloc (size_t len) |
| Allocates the requested number of bytes. | |
| static void | free (void *ptr) |
| Deallocates a pointer that was allocated using alloc(). | |
| static char * | setString (char *&strVar, const char *value, size_t len=(size_t)-1) |
| Sets a string to another string after cleaning up the previous string. | |
| static unsigned short * | setString_u16 (unsigned short *&strVar, const unsigned short *value, size_t len=(size_t)-1) |
| static size_t | strlen_u16 (const unsigned short *str) |
| Returns the length of the given string in 2-byte characters. | |
| static void | strncpy_u16 (unsigned short *dest, const unsigned short *src, size_t len) |
Copies up to len 2-byte characters from the source string to the target location. | |
| static bool | to_bool (const char *strVal) |
Returns the bool value represented by the passed in string. | |
| static void * | to_funptr (const char *strVal) |
| Returns an entry point represented by its string'ized representation. | |
| static char * | concatStrings (const char *str1, const char *str2) |
| Concatenates two strings and returns the result. | |
| static bool | endsWith (const char *str, const char *suffix, bool bCaseSensitive=true) |
Returns true if a given string ends with a given substring. | |
| static int | hasFileAccess (const char *name, xmog_privileges priv) |
| Returns 0 if we have the requested privileges for a given file, -1 otherwise. | |
| static bool | isWindows () |
Returns true if we're running on a Windows platform. | |
| static int | readLine (FILE *file, char *&line) |
| Reads a line from a file. | |
| static void | sleep (int ms) |
| Sleeps for the specified number of milliseconds. | |
| static unsigned short * | utf8_to_u16 (const char *utf8) |
| Converts a UTF8 string to a dynamically allocated 16bit character string. | |
|
|
Allocates the requested number of bytes.
|
|
||||||||||||
|
Concatenates two strings and returns the result.
Both strings must be non-
|
|
||||||||||||||||
|
Returns The comparison can be performed either case sensitive of case insensitive. The default is case sensitive.
|
|
|
Deallocates a pointer that was allocated using alloc().
|
|
||||||||||||
|
Returns 0 if we have the requested privileges for a given file, -1 otherwise.
|
|
||||||||||||||||
|
Sets a string to another string after cleaning up the previous string.
This utility method dynamically allocates a new string and sets it to
|
|
|
Sleeps for the specified number of milliseconds. The time resolution is platform and maybe even host-specific. On Windows systems you can typically expect a 16ms resolution, on Unix systems where we are using the sleep() method, you should assume a 1000ms resolution.
|
|
|
Returns the length of the given string in 2-byte characters.
|
|
||||||||||||||||
|
Copies up to
|
|
|
Returns the
The string |
|
|
Returns an entry point represented by its string'ized representation. An entry point is defined by its module (optional) and its name (required). The two parts are separated by a semicolon. Examples of legal string representations are: Example 1
The following example looks for an entry point named
MyFunction Example 2
The following example looks for an entry point named
myutil;MyFunction
|
|
|
Converts a UTF8 string to a dynamically allocated 16bit character string. The caller is responsible for freeing the string using xmog_util::free().
|
1.4.1