Make the config API C compatible

This commit is contained in:
Maschell 2023-01-24 21:42:04 +01:00
parent c867b01e4d
commit 98623f15ab

View File

@ -3,41 +3,45 @@
#include "config.h" #include "config.h"
#include "stdint.h" #include "stdint.h"
extern "C" int32_t WUPSConfigItem_Create(WUPSConfigItemHandle *out, const char *configID, const char *displayName, WUPSConfigCallbacks_t callbacks, void *context); #ifdef __cplusplus
extern "C" {
#endif
extern "C" int32_t WUPSConfigItem_Destroy(WUPSConfigItemHandle handle); int32_t WUPSConfigItem_Create(WUPSConfigItemHandle *out, const char *configID, const char *displayName, WUPSConfigCallbacks_t callbacks, void *context);
extern "C" int32_t WUPSConfig_Destroy(WUPSConfigHandle handle); int32_t WUPSConfigItem_Destroy(WUPSConfigItemHandle handle);
extern "C" int32_t WUPSConfigItem_SetDisplayName(WUPSConfigItemHandle handle, const char *displayName); int32_t WUPSConfig_Destroy(WUPSConfigHandle handle);
extern "C" int32_t WUPSConfigItem_GetDisplayName(WUPSConfigItemHandle handle, char *out_buf, int32_t out_len); int32_t WUPSConfigItem_SetDisplayName(WUPSConfigItemHandle handle, const char *displayName);
extern "C" int32_t WUPSConfigItem_SetConfigID(WUPSConfigItemHandle handle, const char *configID); int32_t WUPSConfigItem_GetDisplayName(WUPSConfigItemHandle handle, char *out_buf, int32_t out_len);
extern "C" int32_t WUPSConfigItem_GetConfigID(WUPSConfigItemHandle handle, char *out_buf, int32_t out); int32_t WUPSConfigItem_SetConfigID(WUPSConfigItemHandle handle, const char *configID);
extern "C" int32_t WUPSConfig_Create(WUPSConfigHandle *out, const char *name); int32_t WUPSConfigItem_GetConfigID(WUPSConfigItemHandle handle, char *out_buf, int32_t out);
extern "C" int32_t WUPSConfigCategory_Destroy(WUPSConfigCategoryHandle handle); int32_t WUPSConfig_Create(WUPSConfigHandle *out, const char *name);
extern "C" int32_t WUPSConfig_GetName(WUPSConfigHandle handle, char *out_buf, int32_t out_len); int32_t WUPSConfigCategory_Destroy(WUPSConfigCategoryHandle handle);
extern "C" int32_t WUPSConfig_AddCategoryByName(WUPSConfigHandle handle, const char *categoryName, WUPSConfigCategoryHandle *out); int32_t WUPSConfig_GetName(WUPSConfigHandle handle, char *out_buf, int32_t out_len);
extern "C" int32_t WUPSConfig_AddCategory(WUPSConfigHandle handle, WUPSConfigCategoryHandle category); int32_t WUPSConfig_AddCategoryByName(WUPSConfigHandle handle, const char *categoryName, WUPSConfigCategoryHandle *out);
int32_t WUPSConfig_AddCategory(WUPSConfigHandle handle, WUPSConfigCategoryHandle category);
/* /*
extern "C" int32_t WUPSConfig_GetCategoryCount(WUPSConfigHandle handle, int32_t *category_count); int32_t WUPSConfig_GetCategoryCount(WUPSConfigHandle handle, int32_t *category_count);
extern "C" int32_t WUPSConfig_GetCategories(WUPSConfigHandle handle, WUPSConfigCategoryHandle *categories_out, int32_t categories_out_size); int32_t WUPSConfig_GetCategories(WUPSConfigHandle handle, WUPSConfigCategoryHandle *categories_out, int32_t categories_out_size);
*/ */
extern "C" int32_t WUPSConfigCategory_Create(WUPSConfigCategoryHandle *out, const char *name); int32_t WUPSConfigCategory_Create(WUPSConfigCategoryHandle *out, const char *name);
extern "C" int32_t WUPSConfigCategory_GetName(WUPSConfigCategoryHandle handle, char *out_buf, int32_t out_len); int32_t WUPSConfigCategory_GetName(WUPSConfigCategoryHandle handle, char *out_buf, int32_t out_len);
extern "C" int32_t WUPSConfigCategory_AddItem(WUPSConfigCategoryHandle handle, WUPSConfigItemHandle item_Handle); int32_t WUPSConfigCategory_AddItem(WUPSConfigCategoryHandle handle, WUPSConfigItemHandle item_Handle);
#define WUPSConfig_AddCategoryByNameHandled(__config__, __categoryName__, __out__) \ #define WUPSConfig_AddCategoryByNameHandled(__config__, __categoryName__, __out__) \
do { \ do { \
@ -53,3 +57,7 @@ extern "C" int32_t WUPSConfigCategory_AddItem(WUPSConfigCategoryHandle handle, W
return 0; \ return 0; \
} \ } \
} while (0) } while (0)
#ifdef __cplusplus
}
#endif