#include <unixstl/system/system_traits.hpp>
system_traits is a traits class for determining the correct system structures and functions for a given character type.
C | The character type (e.g. char , wchar_t ) |
Public Types | |
Types | |
typedef C | char_type |
The character type. | |
typedef size_t | size_type |
The size type. | |
typedef us_ptrdiff_t | difference_type |
The difference type. | |
typedef system_traits< C > | class_type |
The current instantion of the type. | |
typedef int | int_type |
The (signed) integer type. | |
typedef bool | bool_type |
The Boolean type. | |
typedef void * | module_type |
The type of a handle to a dynamically loaded module. | |
typedef int | handle_type |
The type of a handle to a kernel object. | |
typedef int | error_type |
The type of system error codes. | |
Static Public Member Functions | |
General string handling | |
static char_type * | char_copy (char_type *dest, char_type const *src, size_type n) |
Copies a specific number of characters from the source to the destination. | |
static char_type * | str_copy (char_type *dest, char_type const *src) |
Copies the contents of src to dest . | |
static char_type * | str_n_copy (char_type *dest, char_type const *src, size_type cch) |
Copies the contents of src to dest , up to cch characters . | |
static char_type * | str_cat (char_type *dest, char_type const *src) |
Appends the contents of src to dest . | |
static char_type * | str_n_cat (char_type *dest, char_type const *src, size_type cch) |
Appends the contents of src to dest , up to cch characters . | |
static int_type | str_compare (char_type const *s1, char_type const *s2) |
Comparies the contents of src and dest . | |
static int_type | str_compare_no_case (char_type const *s1, char_type const *s2) |
Comparies the contents of src and dest in a case-insensitive fashion. | |
static int_type | str_n_compare (char_type const *s1, char_type const *s2, size_type cch) |
Comparies the contents of src and dest up to cch characters. | |
static size_type | str_len (char_type const *src) |
Evaluates the length of src . | |
static char_type * | str_chr (char_type const *s, char_type ch) |
Finds the given character ch in s . | |
static char_type * | str_rchr (char_type const *s, char_type ch) |
Finds the rightmost instance ch in s . | |
static char_type * | str_str (char_type const *s, char_type const *sub) |
Finds the given substring sub in s . | |
static char_type * | str_pbrk (char_type const *s, char_type const *charSet) |
Finds one of a set of characters in s . | |
static char_type * | str_end (char_type const *s) |
Returns a pointer to the end of the string. | |
static char_type * | str_set (char_type *s, size_type n, char_type c) |
Sets each character in s to the character c . | |
Dynamic Loading | |
static module_type | load_library (char_type const *name) |
Loads the given executable module. | |
static bool_type | free_library (module_type hModule) |
Closes the given executable module. | |
static void * | find_symbol (module_type hModule, char const *symbolName) |
Retrieves the given symbol from the library. | |
Kernel object control | |
static bool_type | close_handle (handle_type h) |
Closes the given operating system handle. | |
Error | |
static error_type | get_last_error () |
Gives the last error. | |
static void | set_last_error (error_type er=error_type()) |
Sets the last error. | |
Environment | |
static size_type | get_environment_variable (char_type const *name, char_type *buffer, size_type cchBuffer) |
Gets an environment variable into the given buffer. | |
static size_type | expand_environment_strings (char_type const *src, char_type *buffer, size_type cchBuffer) |
Expands environment strings in src into buffer , up to a maximum cchDest characters. |
typedef C char_type |
typedef size_t size_type |
typedef us_ptrdiff_t difference_type |
typedef system_traits<C> class_type |
typedef int int_type |
typedef bool bool_type |
typedef void* module_type |
typedef int handle_type |
The type of a handle to a kernel object.
typedef int error_type |
Copies a specific number of characters from the source to the destination.
Copies the contents of src
to dest
.
Copies the contents of src
to dest
, up to cch characters
.
Appends the contents of src
to dest
.
Appends the contents of src
to dest
, up to cch characters
.
Comparies the contents of src
and dest
.
Comparies the contents of src
and dest
in a case-insensitive fashion.
static int_type str_n_compare | ( | char_type const * | s1, | |
char_type const * | s2, | |||
size_type | cch | |||
) | [static] |
Comparies the contents of src
and dest
up to cch
characters.
Finds the given character ch
in s
.
Finds the rightmost instance ch
in s
.
Finds the given substring sub
in s
.
Finds one of a set of characters in s
.
Returns a pointer to the end of the string.
Sets each character in s
to the character c
.
static module_type load_library | ( | char_type const * | name | ) | [static] |
Loads the given executable module.
static bool_type free_library | ( | module_type | hModule | ) | [static] |
Closes the given executable module.
static void* find_symbol | ( | module_type | hModule, | |
char const * | symbolName | |||
) | [static] |
Retrieves the given symbol from the library.
static bool_type close_handle | ( | handle_type | h | ) | [static] |
Closes the given operating system handle.
static error_type get_last_error | ( | ) | [static] |
Gives the last error.
static void set_last_error | ( | error_type | er = error_type() |
) | [static] |
Sets the last error.
static size_type get_environment_variable | ( | char_type const * | name, | |
char_type * | buffer, | |||
size_type | cchBuffer | |||
) | [static] |
Gets an environment variable into the given buffer.
name | The name of the variable to find | |
buffer | The buffer in which to write the variable. If this is NULL, then the required length is returned | |
cchBuffer | The size of the buffer, in characters |
static size_type expand_environment_strings | ( | char_type const * | src, | |
char_type * | buffer, | |||
size_type | cchBuffer | |||
) | [static] |
Expands environment strings in src
into buffer
, up to a maximum cchDest
characters.