Formatting and cleanup

This commit is contained in:
Maschell
2021-09-25 14:26:18 +02:00
parent 13ed348f43
commit aa90e2478b
38 changed files with 367 additions and 395 deletions

View File

@@ -31,7 +31,7 @@ public:
}
~WUPSConfig() {
for (auto &element : categories) {
for (auto &element: categories) {
delete element;
}
}
@@ -69,7 +69,7 @@ public:
\param category: The category that will be added to this config.
\return On success, the inserted category will be returned.
On error NULL will be returned. In this case the caller still has the responsibility
On error nullptr will be returned. In this case the caller still has the responsibility
for deleting the WUPSConfigCategory instance.
**/
WUPSConfigCategory *addCategory(WUPSConfigCategory *category) {

View File

@@ -29,7 +29,7 @@ public:
}
~WUPSConfigCategory() {
for (auto &element : items) {
for (auto &element: items) {
delete element;
}
}
@@ -53,7 +53,7 @@ public:
for deleting the WUPSConfigItem instance.
**/
[[nodiscard]] bool addItem(WUPSConfigItem *item) {
if(item != nullptr){
if (item != nullptr) {
items.push_back(item);
return true;
}

View File

@@ -44,7 +44,7 @@ int32_t WUPSConfig_AddCategoryByName(WUPSConfigHandle handle, const char *catego
if (res.has_value()) {
if (out != nullptr) {
*out = reinterpret_cast<WUPSConfigCategoryHandle>(res.value());
}else{
} else {
return -3;
}
return 0;

View File

@@ -140,7 +140,7 @@ public:
This function will be called whenever this item should call it's (optional) given
callback with the current value.
Returns true if a valid callback could be called
Returns false if no callback was called (e.g. callback was NULL)
Returns false if no callback was called (e.g. callback was nullptr)
**/
bool callCallback() {
if (this->callbacks.callCallback != nullptr) {

View File

@@ -4,7 +4,7 @@
typedef uint32_t WUPSConfigItemHandle;
int32_t WUPSConfigItem_Create(WUPSConfigItemHandle *out, const char *configID, const char *displayName, WUPSConfigCallbacks_t callbacks, void* context) {
int32_t WUPSConfigItem_Create(WUPSConfigItemHandle *out, const char *configID, const char *displayName, WUPSConfigCallbacks_t callbacks, void *context) {
if (configID == nullptr || displayName == nullptr) {
return -1;
}
@@ -14,7 +14,7 @@ int32_t WUPSConfigItem_Create(WUPSConfigItemHandle *out, const char *configID, c
return 0;
}
return -2;
};
}
int32_t WUPSConfigItem_Destroy(WUPSConfigItemHandle handle) {
if (handle == 0) {
@@ -24,7 +24,7 @@ int32_t WUPSConfigItem_Destroy(WUPSConfigItemHandle handle) {
auto *config = reinterpret_cast<WUPSConfigItem *>(handle);
delete config;
return 0;
};
}
int32_t WUPSConfigItem_SetDisplayName(WUPSConfigItemHandle handle, const char *displayName) {
if (displayName == nullptr) {
@@ -34,7 +34,7 @@ int32_t WUPSConfigItem_SetDisplayName(WUPSConfigItemHandle handle, const char *d
auto *config = reinterpret_cast<WUPSConfigItem *>(handle);
config->setDisplayName(displayName);
return 0;
};
}
int32_t WUPSConfigItem_GetDisplayName(WUPSConfigItemHandle handle, char *out_buf, int32_t out_len) {
if (out_buf == nullptr) {
@@ -53,7 +53,7 @@ int32_t WUPSConfigItem_SetConfigID(WUPSConfigItemHandle handle, const char *conf
auto *config = reinterpret_cast<WUPSConfigItem *>(handle);
config->setConfigID(configID);
return 0;
};
}
int32_t WUPSConfigItem_GetConfigID(WUPSConfigItemHandle handle, char *out_buf, int32_t out_len) {
if (out_buf == nullptr) {