Several utility functions that make interfacing managed and unmanaged DLLs easier. More...
Public Member Functions | |
delegate TRes | StringQuery< TRes, TSize > (StringBuilder s, ref TSize size) |
String query function. More... | |
delegate TRes | StringsQuery< TRes, TSize > (StringBuilder s1, ref TSize size1, StringBuilder s2, ref TSize size2) |
String query function. More... | |
delegate TRes | StringQueryFixedLength< TRes > (StringBuilder s, int size) |
String query functions for string queries that do not support the initial query for the string's length, but operate with a maximum length instead (which has been set on the string builder passed as the first argument). More... | |
delegate bool | Succeeded< TRes > (TRes value) |
Result value verification function. More... | |
delegate void | OnFailure< TRes > (TRes value) |
Delegate to be called when an unmanaged call failed. More... | |
Static Public Member Functions | |
static string | GetUnmanagedString< TRes, TSize > (StringQuery< TRes, TSize >[] queries, Succeeded< TRes > succeeded, OnFailure< TRes > onFailure=null, bool assertNoError=true) |
Retrieves an unmanaged string from a function that follows the convention that a size query is possible by passing a null pointer first. More... | |
static string[] | GetUnmanagedStrings< TRes, TSize > (StringsQuery< TRes, TSize >[] queries, Succeeded< TRes > succeeded, OnFailure< TRes > onFailure=null) |
Retrieves two unmanaged strings from a function that follows the convention that a size query is possible by passing a null pointer first. More... | |
static string | GetUnmanagedString< TRes > (StringQueryFixedLength< TRes >[] queries, int capacity, Succeeded< TRes > succeeded) |
Retrieves an unmanaged string from a function that follows the convention that a size query is possible by passing a null pointer first. More... | |
static TRes | UnmanagedStringCall< TRes > (Func< TRes >[] functions) |
Call helper that receives the operating-system-dependent unmanaged functions to be called as an array. Element 0 in the array is assumed to be the correct function to call on Windows, element 1 is the function to be called on Linux. More... | |
static void | UnmanagedStringCall (Action[] functions) |
Call helper that receives the operating-system-dependent unmanaged functions to be called as an array. Element 0 in the array is assumed to be the correct function to call on Windows, element 1 is the function to be called on Linux. More... | |
Several utility functions that make interfacing managed and unmanaged DLLs easier.
|
static |
Retrieves an unmanaged string from a function that follows the convention that a size query is possible by passing a null pointer first.
TRes | Return type of the query function. |
queries | Query functions (element 0: to be called on Windows, element 1: to be called on Linux) |
succeeded | verification function that checks the result returned by the query function. |
capacity | Capacity to use on the string builder. |
|
static |
Retrieves an unmanaged string from a function that follows the convention that a size query is possible by passing a null pointer first.
TRes | Return type of the query function. |
TSize | Size type used by the query function. |
queries | Query functions (element 0: to be called on Windows, element 1: to be called on Linux) |
succeeded | verification function that checks the result returned by the query function. |
onFailure | Action to be taken when the unmanaged call failed. |
assertNoError | If true is set, it assert that there was no error on any query call. If false is set and any query call ended up with an error, then null will be returned. |
|
static |
Retrieves two unmanaged strings from a function that follows the convention that a size query is possible by passing a null pointer first.
TRes | Return type of the query function. |
TSize | Size type used by the query function. |
queries | Query functions (element 0: to be called on Windows, element 1: to be called on Linux) |
succeeded | verification function that checks the result returned by the query function. |
onFailure | Action to be taken when the unmanaged call failed. |
delegate void OnFailure< TRes > | ( | TRes | value | ) |
Delegate to be called when an unmanaged call failed.
TRes | Type of result to be communicated. |
delegate TRes StringQuery< TRes, TSize > | ( | StringBuilder | s, |
ref TSize | size | ||
) |
String query function.
TRes | Result type of the query function. |
TSize | Size type used by the query function. |
s | String builder passed to the query function. |
size | Size passed to the query function. |
delegate TRes StringQueryFixedLength< TRes > | ( | StringBuilder | s, |
int | size | ||
) |
String query functions for string queries that do not support the initial query for the string's length, but operate with a maximum length instead (which has been set on the string builder passed as the first argument).
TRes | return type of the query function |
s | String builder to receive the string. |
size | Size of the buffer allocated in the string builder. |
delegate TRes StringsQuery< TRes, TSize > | ( | StringBuilder | s1, |
ref TSize | size1, | ||
StringBuilder | s2, | ||
ref TSize | size2 | ||
) |
String query function.
TRes | Result type of the query function. |
TSize | Size type used by the query function. |
s1 | The first string builder passed to the query function. |
size1 | The first string Size passed to the query function. |
s2 | The second string builder passed to the query function. |
size2 | The second string Size passed to the query function. |
delegate bool Succeeded< TRes > | ( | TRes | value | ) |
Result value verification function.
TRes | Type of result to be verified. |
value | Value to be verified. |
|
static |
Call helper that receives the operating-system-dependent unmanaged functions to be called as an array. Element 0 in the array is assumed to be the correct function to call on Windows, element 1 is the function to be called on Linux.
functions | List of operating-system-dependent functions. |
|
static |
Call helper that receives the operating-system-dependent unmanaged functions to be called as an array. Element 0 in the array is assumed to be the correct function to call on Windows, element 1 is the function to be called on Linux.
TRes | Return type of the function called. |
functions | List of operating-system-dependent functions. |