Skip to content

Commit

Permalink
release 1.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jagt committed Mar 31, 2024
1 parent 8d4cd7e commit f2bbdc4
Show file tree
Hide file tree
Showing 198 changed files with 4,862 additions and 2,241 deletions.
5 changes: 4 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
root=true

[*.{cpp,h,inl}]
[*]
tab_width = 4

[*.{cpp,h,inl,cs}]
indent_style = tab
trim_trailing_whitespace = true
charset = utf-8
Expand Down
Binary file modified DataConfig/Content/DcFixture/DcTestBlueprintClassAlpha.uasset
Binary file not shown.
Binary file modified DataConfig/Content/DcFixture/DcTestBlueprintClassBeta.uasset
Binary file not shown.
17 changes: 11 additions & 6 deletions DataConfig/DataConfig.uplugin
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,36 @@
"Modules": [
{
"Name": "DataConfigCore",
"Type": "Editor",
"Type": "Runtime",
"LoadingPhase": "None"
},
{
"Name": "DataConfigExtra",
"Type": "Editor",
"Type": "Runtime",
"LoadingPhase": "Default"
},
{
"Name": "DataConfigTests",
"Name": "DataConfigEngineExtra",
"Type": "Runtime",
"LoadingPhase": "Default"
},
{
"Name": "DataConfigEngineExtra5",
"Type": "Editor",
"LoadingPhase": "Default"
},
{
"Name": "DataConfigEditorExtra",
"Name": "DataConfigTests",
"Type": "Editor",
"LoadingPhase": "Default"
},
{
"Name": "DataConfigTests5",
"Name": "DataConfigEditorExtra",
"Type": "Editor",
"LoadingPhase": "Default"
},
{
"Name": "DataConfigEditorExtra5",
"Name": "DataConfigTests5",
"Type": "Editor",
"LoadingPhase": "Default"
}
Expand Down
9 changes: 7 additions & 2 deletions DataConfig/DataConfig4.uplugin
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,17 @@
"Modules": [
{
"Name": "DataConfigCore",
"Type": "Editor",
"Type": "Runtime",
"LoadingPhase": "None"
},
{
"Name": "DataConfigExtra",
"Type": "Editor",
"Type": "Runtime",
"LoadingPhase": "Default"
},
{
"Name": "DataConfigEngineExtra",
"Type": "Runtime",
"LoadingPhase": "Default"
},
{
Expand Down
8 changes: 4 additions & 4 deletions DataConfig/Source/DataConfigCore/DataConfigCore.Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ public class DataConfigCore : ModuleRules
public DataConfigCore(ReadOnlyTargetRules Target) : base(Target)
{
// source type module, pay extra attention to api boundry
bRequiresImplementModule = false;
bRequiresImplementModule = false;

Type = ModuleType.CPlusPlus;
Type = ModuleType.CPlusPlus;
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;

#if UE_5_2_OR_LATER
Expand All @@ -16,7 +16,7 @@ public DataConfigCore(ReadOnlyTargetRules Target) : base(Target)
bEnforceIWYU = true;
#endif

PublicDependencyModuleNames.AddRange(
PublicDependencyModuleNames.AddRange(
new string[] {
"Core",
"CoreUObject",
Expand All @@ -32,6 +32,6 @@ public DataConfigCore(ReadOnlyTargetRules Target) : base(Target)
}

// toggle for debug unity
//bUseUnity = false;
//bUseUnity = false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ bool FDcAutomationBase::TestDiagnosticImpl(const TCHAR* Description, const FDcRe
if (Diag.Code.CategoryID != Category
|| Diag.Code.ErrorID != Code)
{
AddError(FString::Printf(TEXT("%s: Last diag unmatch, Expect: (%d, %d), Actual, (%d, %d)"),
AddError(FString::Printf(TEXT("%s: Last diag unmatch, Expect: (%d, %d), Actual, (%d, %d)"),
Description, Category, Code, Diag.Code.CategoryID, Diag.Code.ErrorID
), 1);
return false;
Expand Down Expand Up @@ -134,7 +134,7 @@ FDcAutomationConsoleRunner::FArgs FDcAutomationConsoleRunner::FromCommandlineTok
{
// default filter
// ends with `.` to filter out DataConfigBenchmark
Args.Filters.Add(TEXT("DataConfig."));
Args.Filters.Add(TEXT("DataConfig."));
}

int ParametersSplitIx = -1;
Expand Down Expand Up @@ -215,10 +215,10 @@ int32 RunTestsBody(FDcAutomationConsoleRunner* Self)

for (const FAutomationTestInfo& TestInfo: Self->SelectedTests)
{
FString TestCommand = FString::Printf(TEXT("%s %s"), *TestInfo.GetTestName(), *Self->ParametersJoined);
FString TestCommand = FString::Printf(TEXT("%s %s"), *TestInfo.GetTestName(), *Self->ParametersJoined);
FAutomationTestExecutionInfo CurExecutionInfo;

int32 RoleIndex = 0;
int32 RoleIndex = 0;
Framework.StartTestByName(TestCommand, RoleIndex);
const bool CurTestSuccessful = Framework.StopTest(CurExecutionInfo);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ int DebugGetEnumPropertyIndex(const FDcPropertyDatum& Datum, const FName& Name)
UEnum* Enum = nullptr;
FNumericProperty* UnderlyingProperty = nullptr;
bool bIsEnum = DcPropertyUtils::IsEnumAndTryUnwrapEnum(EnumProperty, Enum, UnderlyingProperty);
if (!bIsEnum
if (!bIsEnum
|| Enum == nullptr
|| UnderlyingProperty == nullptr)
return INDEX_NONE;
Expand All @@ -734,7 +734,7 @@ double DebugGetRealPropertyValue(const FDcPropertyDatum& Datum, const FName& Nam

FProperty* Property = PropertyAccessUtil::FindPropertyByName(Name, Struct);
if (!Property)
return NaNRet;
return NaNRet;

if (FFloatProperty* FloatProperty = CastField<FFloatProperty>(Property))
return FloatProperty->GetPropertyValue(Property->ContainerPtrToValuePtr<void*>(Datum.DataPtr));
Expand All @@ -745,7 +745,7 @@ double DebugGetRealPropertyValue(const FDcPropertyDatum& Datum, const FName& Nam
}

FDcResult DeserializeFrom(FDcReader* Reader, FDcPropertyDatum Datum,
TFunctionRef<void(FDcDeserializeContext&)> Func, EDefaultSetupType SetupType)
TFunctionRef<void(FDcDeserializeContext&)> Func, EDefaultSetupType SetupType)
{
FDcDeserializer Deserializer;
if (SetupType == EDefaultSetupType::SetupJSONHandlers)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

FDcResult FDcDeserializeContext::Prepare()
{
DC_TRY(DcExpect(State == EState::Uninitialized, [&]{
DC_TRY(DcExpect(State == EState::Uninitialized, [&]{
return DC_FAIL(DcDSerDe, ContextInvalidState) << (int)State;
}));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ FDcResult RecursiveDeserialize(FDcDeserializeContext& Ctx)
EDcDeserializePredicateResult PredicateIsRootProperty(FDcDeserializeContext& Ctx)
{
check(Ctx.Properties.Num() > 0);
return Ctx.TopProperty() == Ctx.Properties[0]
? EDcDeserializePredicateResult::Process
: EDcDeserializePredicateResult::Pass;
return Ctx.TopProperty() == Ctx.Properties[0]
? EDcDeserializePredicateResult::Process
: EDcDeserializePredicateResult::Pass;
}

} // namespace DcDeserializeUtils
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "DataConfig/Diagnostic/DcDiagnosticCommon.h"
#include "DataConfig/Misc/DcTemplateUtils.h"
#include "DataConfig/Property/DcPropertyWriter.h"
#include "DataConfig/Property/DcPropertyUtils.h"
#include "Misc/ScopeExit.h"
#include "Misc/StringBuilder.h"

Expand All @@ -21,36 +22,46 @@ static FORCEINLINE FDcResult ExecuteDeserializeHandler(FDcDeserializeContext& Ct
static FDcResult DeserializeBody(FDcDeserializer* Self, FDcDeserializeContext& Ctx)
{
// use predicated deserializers first, if it's not handled then try direct handlers
for (auto& PredPair : Self->PredicatedDeserializers)
for (auto& PredEntry : Self->PredicatedDeserializers)
{
if (!PredPair.Key.IsBound())
if (!PredEntry.Predicate.IsBound())
return DC_FAIL(DcDCommon, StaleDelegate);

if (PredPair.Key.Execute(Ctx) == EDcDeserializePredicateResult::Process)
return ExecuteDeserializeHandler(Ctx, PredPair.Value);
if (PredEntry.Predicate.Execute(Ctx) == EDcDeserializePredicateResult::Process)
return ExecuteDeserializeHandler(Ctx, PredEntry.Handler);
}

FFieldVariant& Property = Ctx.TopProperty();
FDcDeserializeDelegate* HandlerPtr;
if (Property.IsUObject())
FDcDeserializeDelegate* HandlerPtr = nullptr;

if (!Ctx.bSkipStructHandlers)
{
UObject* Object = CastChecked<UObject>(Property.ToUObjectUnsafe());
check(IsValid(Object));
UClass* Class = Object->GetClass();
HandlerPtr = Self->UClassDeserializerMap.Find(Class);
if (HandlerPtr == nullptr)
return DC_FAIL(DcDSerDe, NoMatchingHandler)
<< Ctx.TopProperty().GetFName() << Class->GetFName();
if (UStruct* Struct = DcPropertyUtils::TryGetStruct(Property))
HandlerPtr = Self->StructDeserializeMap.Find(Struct);
}
else

if (!HandlerPtr)
{
FField* Field = Property.ToFieldUnsafe();
check(Field->IsValidLowLevel());
FFieldClass* FieldClass = Field->GetClass();
HandlerPtr = Self->FieldClassDeserializerMap.Find(FieldClass);
if (HandlerPtr == nullptr)
return DC_FAIL(DcDSerDe, NoMatchingHandler)
<< Ctx.TopProperty().GetFName() << FieldClass->GetFName();
if (Property.IsUObject())
{
UObject* Object = CastChecked<UObject>(Property.ToUObjectUnsafe());
check(IsValid(Object));
UClass* Class = Object->GetClass();
HandlerPtr = Self->UClassDeserializerMap.Find(Class);
if (HandlerPtr == nullptr)
return DC_FAIL(DcDSerDe, NoMatchingHandler)
<< Ctx.TopProperty().GetFName() << Class->GetFName();
}
else
{
FField* Field = Property.ToFieldUnsafe();
check(Field->IsValidLowLevel());
FFieldClass* FieldClass = Field->GetClass();
HandlerPtr = Self->FieldClassDeserializerMap.Find(FieldClass);
if (HandlerPtr == nullptr)
return DC_FAIL(DcDSerDe, NoMatchingHandler)
<< Ctx.TopProperty().GetFName() << FieldClass->GetFName();
}
}

return ExecuteDeserializeHandler(Ctx, *HandlerPtr);
Expand Down Expand Up @@ -102,7 +113,7 @@ static void AmendDiagnostic(FDcDiagnostic& Diag, FDcDeserializeContext& Ctx)

Highlight.Formatted = Sb.ToString();
Diag << MoveTemp(Highlight);

}

} // namespace DcDeserializerDetails
Expand Down Expand Up @@ -150,18 +161,24 @@ FDcResult FDcDeserializer::Deserialize(FDcDeserializeContext& Ctx)

void FDcDeserializer::AddDirectHandler(UClass* PropertyClass, FDcDeserializeDelegate&& Delegate)
{
check(!UClassDeserializerMap.Contains(PropertyClass));
check(PropertyClass && !UClassDeserializerMap.Contains(PropertyClass));
UClassDeserializerMap.Add(PropertyClass, MoveTemp(Delegate));
}

void FDcDeserializer::AddDirectHandler(FFieldClass* PropertyClass, FDcDeserializeDelegate&& Delegate)
{
check(!FieldClassDeserializerMap.Contains(PropertyClass));
check(PropertyClass && !FieldClassDeserializerMap.Contains(PropertyClass));
FieldClassDeserializerMap.Add(PropertyClass, MoveTemp(Delegate));
}

void FDcDeserializer::AddPredicatedHandler(FDcDeserializePredicate&& Predicate, FDcDeserializeDelegate&& Delegate)
void FDcDeserializer::AddPredicatedHandler(FDcDeserializePredicate&& Predicate, FDcDeserializeDelegate&& Delegate, const FName Name)
{
PredicatedDeserializers.Add(FPredicatedHandlerEntry{MoveTemp(Predicate), MoveTemp(Delegate), Name});
}

void FDcDeserializer::AddStructHandler(UStruct* Struct, FDcDeserializeDelegate&& Delegate)
{
PredicatedDeserializers.Add(MakeTuple(MoveTemp(Predicate), MoveTemp(Delegate)));
check(Struct && !StructDeserializeMap.Contains(Struct));
StructDeserializeMap.Add(Struct, Delegate);
}

Loading

0 comments on commit f2bbdc4

Please sign in to comment.