1 | // Copyright (c) Microsoft. All rights reserved.
|
---|
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
---|
3 |
|
---|
4 | #ifndef MULTITREE_H
|
---|
5 | #define MULTITREE_H
|
---|
6 |
|
---|
7 | #include "azure_c_shared_utility/strings.h"
|
---|
8 | #include "azure_macro_utils/macro_utils.h"
|
---|
9 |
|
---|
10 | #ifdef __cplusplus
|
---|
11 | #include <cstddef>
|
---|
12 | extern "C"
|
---|
13 | {
|
---|
14 | #else
|
---|
15 | #include <stddef.h>
|
---|
16 | #include <stdbool.h>
|
---|
17 | #endif
|
---|
18 |
|
---|
19 | typedef struct MULTITREE_HANDLE_DATA_TAG* MULTITREE_HANDLE;
|
---|
20 |
|
---|
21 | #define MULTITREE_RESULT_VALUES \
|
---|
22 | MULTITREE_OK, \
|
---|
23 | MULTITREE_INVALID_ARG, \
|
---|
24 | MULTITREE_ALREADY_HAS_A_VALUE, \
|
---|
25 | MULTITREE_EMPTY_CHILD_NAME, \
|
---|
26 | MULTITREE_EMPTY_VALUE, \
|
---|
27 | MULTITREE_OUT_OF_RANGE_INDEX, \
|
---|
28 | MULTITREE_ERROR, \
|
---|
29 | MULTITREE_CHILD_NOT_FOUND \
|
---|
30 |
|
---|
31 | MU_DEFINE_ENUM_WITHOUT_INVALID(MULTITREE_RESULT, MULTITREE_RESULT_VALUES);
|
---|
32 |
|
---|
33 | typedef void (*MULTITREE_FREE_FUNCTION)(void* value);
|
---|
34 | typedef int (*MULTITREE_CLONE_FUNCTION)(void** destination, const void* source);
|
---|
35 |
|
---|
36 | #include "umock_c/umock_c_prod.h"
|
---|
37 | MOCKABLE_FUNCTION(, MULTITREE_HANDLE, MultiTree_Create, MULTITREE_CLONE_FUNCTION, cloneFunction, MULTITREE_FREE_FUNCTION, freeFunction);
|
---|
38 | MOCKABLE_FUNCTION(, MULTITREE_RESULT, MultiTree_AddLeaf, MULTITREE_HANDLE, treeHandle, const char*, destinationPath, const void*, value);
|
---|
39 | MOCKABLE_FUNCTION(, MULTITREE_RESULT, MultiTree_AddChild, MULTITREE_HANDLE, treeHandle, const char*, childName, MULTITREE_HANDLE*, childHandle);
|
---|
40 | MOCKABLE_FUNCTION(, MULTITREE_RESULT, MultiTree_GetChildCount, MULTITREE_HANDLE, treeHandle, size_t*, count);
|
---|
41 | MOCKABLE_FUNCTION(, MULTITREE_RESULT, MultiTree_GetChild, MULTITREE_HANDLE, treeHandle, size_t, index, MULTITREE_HANDLE*, childHandle);
|
---|
42 | MOCKABLE_FUNCTION(, MULTITREE_RESULT, MultiTree_GetChildByName, MULTITREE_HANDLE, treeHandle, const char*, childName, MULTITREE_HANDLE*, childHandle);
|
---|
43 | MOCKABLE_FUNCTION(, MULTITREE_RESULT, MultiTree_GetName, MULTITREE_HANDLE, treeHandle, STRING_HANDLE, destination);
|
---|
44 | MOCKABLE_FUNCTION(, MULTITREE_RESULT, MultiTree_GetValue, MULTITREE_HANDLE, treeHandle, const void**, destination);
|
---|
45 | MOCKABLE_FUNCTION(, MULTITREE_RESULT, MultiTree_GetLeafValue, MULTITREE_HANDLE, treeHandle, const char*, leafPath, const void**, destination);
|
---|
46 | MOCKABLE_FUNCTION(, MULTITREE_RESULT, MultiTree_SetValue, MULTITREE_HANDLE, treeHandle, void*, value);
|
---|
47 | MOCKABLE_FUNCTION(, void, MultiTree_Destroy, MULTITREE_HANDLE, treeHandle);
|
---|
48 | MOCKABLE_FUNCTION(, MULTITREE_RESULT, MultiTree_DeleteChild, MULTITREE_HANDLE, treeHandle, const char*, childName);
|
---|
49 |
|
---|
50 | #ifdef __cplusplus
|
---|
51 | }
|
---|
52 | #endif
|
---|
53 |
|
---|
54 | #endif
|
---|