Several utility functions that make interfacing managed and unmanaged DLLs easier.
More...
|
delegate TRes | StringQuery< TRes, TSize > (StringBuilder s, ref TSize size) |
| String query function.
|
|
delegate TRes | StringsQuery< TRes, TSize > (StringBuilder s1, ref TSize size1, StringBuilder s2, ref TSize size2) |
| String 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).
|
|
delegate bool | Succeeded< TRes > (TRes value) |
| Result value verification function.
|
|
delegate void | OnFailure< TRes > (TRes value) |
| Delegate to be called when an unmanaged call failed.
|
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
Several utility functions that make interfacing managed and unmanaged DLLs easier.
◆ GetUnmanagedString< TRes >()
static string GetUnmanagedString< TRes > |
( |
StringQueryFixedLength< TRes >[] | queries, |
|
|
int | capacity, |
|
|
Succeeded< TRes > | succeeded ) |
|
static |
Retrieves an unmanaged string from a function that follows the convention that a size query is possible by passing a null pointer first.
- Template Parameters
-
TRes | Return type of the query function. |
- Parameters
-
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. |
- Returns
- Retrieved string or null if retrieval failed.
◆ GetUnmanagedString< TRes, TSize >()
static string GetUnmanagedString< TRes, TSize > |
( |
StringQuery< TRes, TSize >[] | queries, |
|
|
Succeeded< TRes > | succeeded, |
|
|
OnFailure< TRes > | onFailure = null, |
|
|
bool | assertNoError = true ) |
|
static |
Retrieves an unmanaged string from a function that follows the convention that a size query is possible by passing a null pointer first.
- Template Parameters
-
TRes | Return type of the query function. |
TSize | Size type used by the query function. |
- Parameters
-
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. |
- Returns
- Retrieved string or null if retrieval failed.
◆ GetUnmanagedStrings< TRes, TSize >()
static string[] GetUnmanagedStrings< TRes, TSize > |
( |
StringsQuery< TRes, TSize >[] | queries, |
|
|
Succeeded< TRes > | succeeded, |
|
|
OnFailure< TRes > | onFailure = null ) |
|
static |
Retrieves two unmanaged strings from a function that follows the convention that a size query is possible by passing a null pointer first.
- Template Parameters
-
TRes | Return type of the query function. |
TSize | Size type used by the query function. |
- Parameters
-
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. |
- Returns
- An array of retrieved strings or null if retrieval failed.
◆ OnFailure< TRes >()
delegate void OnFailure< TRes > |
( |
TRes | value | ) |
|
Delegate to be called when an unmanaged call failed.
- Template Parameters
-
TRes | Type of result to be communicated. |
◆ StringQuery< TRes, TSize >()
delegate TRes StringQuery< TRes, TSize > |
( |
StringBuilder | s, |
|
|
ref TSize | size ) |
String query function.
- Template Parameters
-
TRes | Result type of the query function. |
TSize | Size type used by the query function. |
- Parameters
-
s | String builder passed to the query function. |
size | Size passed to the query function. |
- Returns
- Return value.
◆ StringQueryFixedLength< TRes >()
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).
- Template Parameters
-
TRes | return type of the query function |
- Parameters
-
s | String builder to receive the string. |
size | Size of the buffer allocated in the string builder. |
- Returns
◆ StringsQuery< TRes, TSize >()
delegate TRes StringsQuery< TRes, TSize > |
( |
StringBuilder | s1, |
|
|
ref TSize | size1, |
|
|
StringBuilder | s2, |
|
|
ref TSize | size2 ) |
String query function.
- Template Parameters
-
TRes | Result type of the query function. |
TSize | Size type used by the query function. |
- Parameters
-
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. |
- Returns
- Return value.
◆ Succeeded< TRes >()
delegate bool Succeeded< TRes > |
( |
TRes | value | ) |
|
Result value verification function.
- Template Parameters
-
TRes | Type of result to be verified. |
- Parameters
-
value | Value to be verified. |
- Returns
- Bool value, indicating success or failure.
◆ UnmanagedStringCall()
static void UnmanagedStringCall |
( |
Action[] | 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.
- Parameters
-
functions | List of operating-system-dependent functions. |
◆ UnmanagedStringCall< TRes >()
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.
- Template Parameters
-
TRes | Return type of the function called. |
- Parameters
-
functions | List of operating-system-dependent functions. |
- Returns
- Return value from the function call.