Skip to content

Commit

Permalink
wrappers new classes
Browse files Browse the repository at this point in the history
  • Loading branch information
pasotee committed May 12, 2024
1 parent a90cedc commit a390945
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 35 deletions.
4 changes: 2 additions & 2 deletions Source/ConfigCat/Private/ConfigCatSubsystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
#include "ConfigCatSettings.h"
#include "Wrapper/ConfigCatSettingsWrapper.h"
#include "Wrapper/ConfigCatEvaluationWrapper.h"
#include "Wrapper/ConfigCatUserWrapper.h"
#include "Wrapper/ConfigCatValueWrapper.h"
#include "Wrappers/ConfigCatUserWrapper.h"
#include "Wrappers/ConfigCatValueWrapper.h"

using namespace configcat;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "Wrapper/ConfigCatEvaluationWrapper.h"

#include "Wrapper/ConfigCatValueWrapper.h"
#include "Wrappers/ConfigCatValueWrapper.h"

using namespace configcat;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (c) ConfigCat 2024. All Rights Reserved.

#include "Wrapper/ConfigCatUserWrapper.h"
#include "Wrappers/ConfigCatUserWrapper.h"

#include <ConfigCatCppSDK/Include/configcatuser.h>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
// Copyright (c) ConfigCat 2024. All Rights Reserved.

#include "Wrappers/ConfigCatValueWrapper.h"

#include "Wrapper/ConfigCatValueWrapper.h"
UConfigCatValueWrapper* UConfigCatValueWrapper::CreateValue(const configcat::SettingValue& InValue)
{
// This leverages the operator std::optional<Value> from configcat::SettingValue
return CreateValue(std::optional<configcat::Value>(InValue));
}

UConfigCatValueWrapper* UConfigCatValueWrapper::CreateValue(configcat::Value InValue)
UConfigCatValueWrapper* UConfigCatValueWrapper::CreateValue(const configcat::Value& InValue)
{
return CreateValue(std::make_optional(InValue));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,59 +8,33 @@

#include "ConfigCatValueWrapper.generated.h"

UCLASS(DisplayName="Config Cat Value", Hidden)
UCLASS(DisplayName="Config Cat SettingValue", Hidden)
class CONFIGCAT_API UConfigCatValueWrapper : public UObject
{
GENERATED_BODY()

public:
static UConfigCatValueWrapper* CreateValue(configcat::Value InValue);
static UConfigCatValueWrapper* CreateValue(const configcat::SettingValue& InValue);
static UConfigCatValueWrapper* CreateValue(const configcat::Value& InValue);
static UConfigCatValueWrapper* CreateValue(const std::optional<configcat::Value>& InValue);

/**
* Checks if the struct holds any type value
*/
UFUNCTION(BlueprintPure, Category = "ConfigCat|Value")
bool HasAnyValue() const;
/**
* Checks if the struct holds a boolean value
*/
UFUNCTION(BlueprintPure, Category = "ConfigCat|Value")
bool HasBooleanValue() const;
/**
* Checks if the struct holds a string value
*/
UFUNCTION(BlueprintPure, Category = "ConfigCat|Value")
bool HasStringValue() const;
/**
* Checks if the struct holds an integer value
*/
UFUNCTION(BlueprintPure, Category = "ConfigCat|Value")
bool HasIntegerValue() const;
/**
* Checks if the struct holds a decimal (double) value
*/
UFUNCTION(BlueprintPure, Category = "ConfigCat|Value")
bool HasDecimalValue() const;

/**
* Returns the boolean value stored in the struct, if it holds one
*/
UFUNCTION(BlueprintPure, Category = "ConfigCat|Value")
bool GetBooleanValue() const;
/**
* Returns the string value stored in the struct, if it holds one
*/
UFUNCTION(BlueprintPure, Category = "ConfigCat|Value")
FString GetStringValue() const;
/**
* Returns the integer value stored in the struct, if it holds one
*/
UFUNCTION(BlueprintPure, Category = "ConfigCat|Value")
int GetIntegerValue() const;
/**
* Returns the decimal (double) value stored in the struct, if it holds one
*/
UFUNCTION(BlueprintPure, Category = "ConfigCat|Value")
double GetDecimalValue() const;

Expand Down

0 comments on commit a390945

Please sign in to comment.