Skip to content

Commit e1bf09a

Browse files
committed
release 1.7.1
1 parent d7a7a85 commit e1bf09a

6 files changed

Lines changed: 96 additions & 2 deletions

File tree

DataConfig/Source/DataConfigCore/Private/DataConfig/Property/DcPropertyWriteStates.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,7 @@ FDcResult FDcWriteStateMap::WriteMapRoot(FDcPropertyWriter* Parent)
628628
if (State == EState::ExpectRoot)
629629
{
630630
State = EState::ExpectKeyOrEnd;
631+
MapHelper.EmptyValues();
631632
return DcOk();
632633
}
633634
else
@@ -764,6 +765,7 @@ FDcResult FDcWriteStateArray::WriteArrayRoot(FDcPropertyWriter* Parent)
764765
if (State == EState::ExpectRoot)
765766
{
766767
State = EState::ExpectItemOrEnd;
768+
ArrayHelper.EmptyValues();
767769
return DcOk();
768770
}
769771
else
@@ -893,6 +895,7 @@ FDcResult FDcWriteStateSet::WriteSetRoot(FDcPropertyWriter* Parent)
893895
if (State == EState::ExpectRoot)
894896
{
895897
State = EState::ExpectItemOrEnd;
898+
SetHelper.EmptyElements();
896899
return DcOk();
897900
}
898901
else
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#pragma once
22

3-
#define DATA_CONFIG_CORE_VERSION "1.7.0"
4-
#define DATA_CONFIG_CORE_VERSION_NUMBER 10700
3+
#define DATA_CONFIG_CORE_VERSION "1.7.1"
4+
#define DATA_CONFIG_CORE_VERSION_NUMBER 10701
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#include "DcTestProperty5.h"
2+
3+
#include "DataConfig/Automation/DcAutomation.h"
4+
#include "DataConfig/Automation/DcAutomationUtils.h"
5+
#include "DataConfig/Extra/Misc/DcTestCommon.h"
6+
#include "DataConfig/Json/DcJsonReader.h"
7+
8+
DC_TEST("DataConfig.Core.Property.Defaults")
9+
{
10+
FString Str = TEXT(R"(
11+
{
12+
"StrFieldWithDefault" : "Bar",
13+
"IntFieldWithDefault" : 123,
14+
15+
"StrArrFieldWithDefault" : ["One", "Two", "Three", "Four"],
16+
"StrSetFieldWithDefault" : ["Foo", "Bar"],
17+
"StringIntMapFieldWithDefault" : {
18+
"Five" : 5,
19+
"Ten" : 10
20+
}
21+
}
22+
)");
23+
24+
FDcJsonReader Reader(Str);
25+
FDcTestStructWithDefaults Dest;
26+
27+
UTEST_OK("Deserialize With Defaults", DcAutomationUtils::DeserializeFrom(&Reader, FDcPropertyDatum(&Dest)));
28+
29+
FDcTestStructWithDefaults Expect;
30+
Expect.StrFieldWithDefault = "Bar";
31+
Expect.IntFieldWithDefault = 123;
32+
33+
Expect.StrArrFieldWithDefault = {"One", "Two", "Three", "Four"};
34+
Expect.StrSetFieldWithDefault = {"Foo", "Bar"};
35+
Expect.StringIntMapFieldWithDefault = {
36+
{"Five", 5},
37+
{"Ten", 10},
38+
};
39+
40+
UTEST_OK("Deserialize With Defaults", DcAutomationUtils::TestReadDatumEqual(FDcPropertyDatum(&Dest), FDcPropertyDatum(&Expect)));
41+
42+
return true;
43+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#pragma once
2+
3+
#include "CoreMinimal.h"
4+
#include "DcTestProperty5.generated.h"
5+
6+
USTRUCT()
7+
struct FDcTestStructWithDefaults
8+
{
9+
GENERATED_BODY()
10+
11+
enum { _DEFAULT_INT = 254 };
12+
13+
UPROPERTY() FString StrFieldWithDefault = "Foo";
14+
UPROPERTY() int IntFieldWithDefault = _DEFAULT_INT;
15+
16+
UPROPERTY() TArray<FString> StrArrFieldWithDefault = {"Foo", "Bar", "Baz"};
17+
UPROPERTY() TSet<FString> StrSetFieldWithDefault = {"One", "Two", "Three"};
18+
UPROPERTY() TMap<FString, int> StringIntMapFieldWithDefault = {
19+
{"One", 1},
20+
{"Two", 2},
21+
{"Three", 1+1+1*1},
22+
};
23+
};
24+

Misc/Docs/Source/Advanced/Breaking.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,24 @@
22

33
On this page we'll document breaking changes across versions.
44

5+
# 1.7.1
6+
7+
- `FDcPropertyWriter` will now empty `TArray/TSet/TMap` on write.
8+
9+
Previously when running into container property with default values DataConfig will thrash the defaults also leaving the container with incorrect elements count. Now the containers will be properly emptied on write.
10+
11+
```c++
12+
// Example of TArray property with default values.
13+
USTRUCT()
14+
struct FDcTestStructWithDefaults
15+
{
16+
// ...
17+
UPROPERTY() TArray<FString> StrArrFieldWithDefault = {"Foo", "Bar", "Baz"};
18+
};
19+
```
20+
21+
Though this is a behavior change but it should have minimal impact. See `DataConfig.Core.Property.Defaults` test for details.
22+
523
# 1.7.0
624
725
- UE 5.5 deprecated `StructUtils` plugin, thus we'll need to setup multiple uplugins for UE5. See: [DataConfigXX.uplugin](../Integration.md#dataconfigxxuplugin)

Misc/Docs/Source/Changes.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## 1.7.1 - 2024-11-20
6+
7+
- **BREAKING** Empty `TArray/TSet/TMap` properties on write.
8+
- See: [Breaking - 1.7.1](Advanced/Breaking.md#171)
9+
10+
511
## 1.7.0 - 2024-10-2
612

713
- Initial UE 5.5 support.

0 commit comments

Comments
 (0)