Skip to content
This repository was archived by the owner on Nov 1, 2024. It is now read-only.

Commit cbbe78f

Browse files
committed
Finish v1.1-r28
2 parents 2c7c7ef + 0696a08 commit cbbe78f

19 files changed

Lines changed: 323 additions & 280 deletions

Config/FilterPlugin.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
[FilterPlugin]
2+
/Config/BaseVaRest.ini
3+
/Config/DefaultVaRest.ini

Source/.clang-format

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
---
1+
---
22
Language: Cpp
33
BasedOnStyle: LLVM
44
IndentWidth: 4
55
TabWidth: 4
6-
UseTab: Always
6+
UseTab: ForContinuationAndIndentation
77
Standard: Cpp11
88
AccessModifierOffset: -4
99
AlignAfterOpenBracket: DontAlign
@@ -17,5 +17,6 @@ ColumnLimit: 0
1717
PointerAlignment: Left
1818
SpacesInAngles: false
1919
---
20-
Language: ObjC
20+
Language: ObjC
21+
DisableFormat: true
2122
...

Source/VaRest/Private/VaRest.cpp

Lines changed: 0 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -3,94 +3,7 @@
33
#include "VaRest.h"
44

55
#include "VaRestDefines.h"
6-
#include "VaRestJsonObject.h"
7-
#include "VaRestJsonValue.h"
8-
#include "VaRestRequestController.h"
9-
#include "VaRestRequestJSON.h"
10-
#include "VaRestSettings.h"
11-
12-
#include "Developer/Settings/Public/ISettingsModule.h"
13-
14-
#define LOCTEXT_NAMESPACE "FVaRestModule"
15-
16-
void FVaRestModule::StartupModule()
17-
{
18-
// @HACK Force classes to be compiled on shipping build
19-
UVaRestJsonObject::StaticClass();
20-
UVaRestJsonValue::StaticClass();
21-
UVaRestRequestJSON::StaticClass();
22-
23-
VaRestSettings = NewObject<UVaRestSettings>(GetTransientPackage(), "VaRestSettings", RF_Standalone);
24-
VaRestSettings->AddToRoot();
25-
26-
// Register settings
27-
if (ISettingsModule* SettingsModule = FModuleManager::GetModulePtr<ISettingsModule>("Settings"))
28-
{
29-
SettingsModule->RegisterSettings("Project", "Plugins", "VaRest",
30-
LOCTEXT("RuntimeSettingsName", "VaRest"),
31-
LOCTEXT("RuntimeSettingsDescription", "Configure VaRest plugin settings"),
32-
VaRestSettings);
33-
}
34-
35-
FWorldDelegates::OnWorldCleanup.AddLambda([this](UWorld* World, bool bSessionEnded, bool bCleanupResources) {
36-
RequestControllers.Remove(World);
37-
38-
UE_LOG(LogVaRest, Log, TEXT("%s: Request Controller is removed for: %s"), *VA_FUNC_LINE, *World->GetName());
39-
});
40-
41-
FWorldDelegates::OnPostWorldInitialization.AddLambda([this](UWorld* World, const UWorld::InitializationValues IVS) {
42-
auto Controller = NewObject<UVaRestRequestController>(GetTransientPackage());
43-
Controller->SetFlags(RF_Standalone);
44-
Controller->AddToRoot();
45-
46-
Controller->Initialize();
47-
48-
RequestControllers.Add(World, Controller);
49-
50-
UE_LOG(LogVaRest, Log, TEXT("%s: Request Controller is created for: %s"), *VA_FUNC_LINE, *World->GetName());
51-
});
52-
53-
UE_LOG(LogVaRest, Log, TEXT("%s: VaRest module started"), *VA_FUNC_LINE);
54-
}
55-
56-
void FVaRestModule::ShutdownModule()
57-
{
58-
if (ISettingsModule* SettingsModule = FModuleManager::GetModulePtr<ISettingsModule>("Settings"))
59-
{
60-
SettingsModule->UnregisterSettings("Project", "Plugins", "VaRest");
61-
}
62-
63-
if (!GExitPurge)
64-
{
65-
VaRestSettings->RemoveFromRoot();
66-
67-
// If we're in exit purge, this object has already been destroyed
68-
for (auto Controller : RequestControllers)
69-
{
70-
Controller.Value->RemoveFromRoot();
71-
}
72-
}
73-
else
74-
{
75-
VaRestSettings = nullptr;
76-
}
77-
78-
RequestControllers.Empty();
79-
}
80-
81-
UVaRestSettings* FVaRestModule::GetSettings() const
82-
{
83-
check(VaRestSettings);
84-
return VaRestSettings;
85-
}
86-
87-
UVaRestRequestController* FVaRestModule::GetRequestController(UWorld* World) const
88-
{
89-
return RequestControllers.FindChecked(World);
90-
}
916

927
IMPLEMENT_MODULE(FVaRestModule, VaRest)
938

949
DEFINE_LOG_CATEGORY(LogVaRest);
95-
96-
#undef LOCTEXT_NAMESPACE

Source/VaRest/Private/VaRestJsonObject.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@ UVaRestJsonObject::UVaRestJsonObject(const FObjectInitializer& ObjectInitializer
1717
{
1818
}
1919

20-
UVaRestJsonObject* UVaRestJsonObject::ConstructVaRestJsonObject(UObject* WorldContextObject)
21-
{
22-
return NewObject<UVaRestJsonObject>();
23-
}
24-
2520
void UVaRestJsonObject::Reset()
2621
{
2722
JsonObj = MakeShared<FJsonObject>();
@@ -675,11 +670,7 @@ bool UVaRestJsonObject::WriteToFile(const FString& Path)
675670
for (int i = 0; i < JsonObjectValuePair.Key.Len(); ++i)
676671
{
677672
Str = FString(1, &BufferPtr[i]);
678-
#if PLATFORM_WINDOWS
679-
WriteStringToArchive(Ar, *Str, Str.Len() - 1);
680-
#else
681673
WriteStringToArchive(Ar, *Str, Str.Len());
682-
#endif
683674
}
684675

685676
Str = FString(TEXT("\""));

Source/VaRest/Private/VaRestJsonParser.cpp

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ uint32 FUtf8Helper::CodepointFromUtf8(const ANSICHAR*& SourceString, const uint3
230230
return UNICODE_BOGUS_CHAR_CODEPOINT;
231231
}
232232

233-
++SourceString; // Sequence was not valid UTF-8. Skip the first byte and continue.
233+
++SourceString; // Sequence was not valid UTF-8. Skip the first byte and continue.
234234
return UNICODE_BOGUS_CHAR_CODEPOINT; // catch everything else.
235235
}
236236

@@ -739,9 +739,9 @@ void FJSONReader::UpdateNotation()
739739
{
740740
if (State.CheckTokens(EJSONToken::SQUARE_BEGIN, EJSONToken::SQUARE_END)) // Close array "[]"
741741
{
742-
State.PopToken(2); // remove token "[]"
742+
State.PopToken(2); // remove token "[]"
743743
State.PopValue(false); // remove value if exists
744-
State.PopArray(); // remove array
744+
State.PopArray(); // remove array
745745

746746
if (State.CheckTokens(EJSONToken::COLON)) // Array in object ":"
747747
{
@@ -761,7 +761,7 @@ void FJSONReader::UpdateNotation()
761761
{
762762
if (State.CheckTokens(EJSONToken::CURLY_BEGIN, EJSONToken::COLON, EJSONToken::COMMA)) // Next record in object "{:,"
763763
{
764-
State.PopToken(2); // remove token ":,"
764+
State.PopToken(2); // remove token ":,"
765765
State.PopValue(false); // remove value
766766
State.Notation = EJSONNotation::OBJECT;
767767
}
@@ -772,7 +772,7 @@ void FJSONReader::UpdateNotation()
772772
}
773773
else if (State.CheckTokens(EJSONToken::SQUARE_BEGIN, EJSONToken::COMMA)) // Next record in array "[,"
774774
{
775-
State.PopToken(1); // remove token ","
775+
State.PopToken(1); // remove token ","
776776
State.PopValue(false); // remove value
777777
State.Notation = EJSONNotation::ARRAY;
778778
}
@@ -1071,11 +1071,7 @@ void FJSONWriter::Write(TSharedPtr<FJsonValue> JsonValue, FArchive* Writer, bool
10711071
for (int i = 0; i < ChildJsonPair.Key.Len(); ++i)
10721072
{
10731073
Str = FString(1, &ChildJsonPair.Key[i]);
1074-
#if PLATFORM_WINDOWS
1075-
UVaRestJsonObject::WriteStringToArchive(Ar, *Str, Str.Len() - 1);
1076-
#else
10771074
UVaRestJsonObject::WriteStringToArchive(Ar, *Str, Str.Len());
1078-
#endif
10791075
}
10801076

10811077
Str = FString(TEXT("\""));
@@ -1134,11 +1130,7 @@ void FJSONWriter::Write(TSharedPtr<FJsonValue> JsonValue, FArchive* Writer, bool
11341130
}
11351131
else
11361132
{
1137-
#if PLATFORM_WINDOWS
1138-
UVaRestJsonObject::WriteStringToArchive(Ar, *Str, Str.Len() - 1);
1139-
#else
11401133
UVaRestJsonObject::WriteStringToArchive(Ar, *Str, Str.Len());
1141-
#endif
11421134
}
11431135
}
11441136

Source/VaRest/Private/VaRestLibrary.cpp

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
#include "VaRestRequestJSON.h"
88

99
#include "Misc/Base64.h"
10-
#include "Misc/FileHelper.h"
11-
#include "Misc/Paths.h"
1210

1311
//////////////////////////////////////////////////////////////////////////
1412
// Helpers
@@ -43,30 +41,3 @@ bool UVaRestLibrary::Base64DecodeData(const FString& Source, TArray<uint8>& Dest
4341
{
4442
return FBase64::Decode(Source, Dest);
4543
}
46-
47-
//////////////////////////////////////////////////////////////////////////
48-
// File system integration
49-
50-
class UVaRestJsonObject* UVaRestLibrary::LoadJsonFromFile(UObject* WorldContextObject, const FString& Path, const bool bIsRelativeToContentDir)
51-
{
52-
UVaRestJsonObject* Json = UVaRestJsonObject::ConstructVaRestJsonObject(WorldContextObject);
53-
54-
FString JSONString;
55-
if (FFileHelper::LoadFileToString(JSONString, *(bIsRelativeToContentDir ? FPaths::ProjectContentDir() / Path : Path)))
56-
{
57-
if (Json->DecodeJson(JSONString))
58-
{
59-
return Json;
60-
}
61-
else
62-
{
63-
UE_LOG(LogVaRest, Error, TEXT("%s: Can't decode json from file %s"), *VA_FUNC_LINE, *Path);
64-
}
65-
}
66-
else
67-
{
68-
UE_LOG(LogVaRest, Error, TEXT("%s: Can't open file %s"), *VA_FUNC_LINE, *Path);
69-
}
70-
71-
return nullptr;
72-
}

Source/VaRest/Private/VaRestRequestController.cpp

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)