UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
XmlFile.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "Containers/Array.h"
8#include "CoreMinimal.h"
9#include "HAL/Platform.h"
10#include "XmlNode.h"
11
12class FXmlAttribute;
13class FXmlNode;
14
23
26{
27public:
28
30 FXmlFile() : RootNode(nullptr), bFileLoaded(false) {}
38 ~FXmlFile() { Clear(); };
39
40 FXmlFile(const FXmlFile& rhs) = delete;
41 FXmlFile& operator=(const FXmlFile& rhs) = delete;
42
51 XMLPARSER_API FString GetLastError() const;
53 XMLPARSER_API void Clear();
55 XMLPARSER_API bool IsValid() const;
56
62 XMLPARSER_API const FXmlNode* GetRootNode() const;
63
70
76 XMLPARSER_API bool Save(const FString& Path);
77
86
87private:
88
90 XMLPARSER_API void PreProcessInput(TArray<FString>& Input);
92 XMLPARSER_API void WhiteOut(TArray<FString>& Input, int32 LineStart, int32 LineEnd, int32 IndexStart, int32 IndexEnd);
94 XMLPARSER_API void Tokenize(FStringView Input, TArray<FString>& Tokens);
101 static XMLPARSER_API void AddAttribute(const FString& InToken, TArray<FXmlAttribute>& OutAttributes);
103 XMLPARSER_API FXmlNode* CreateRootNode(TArrayView<const FString> Tokens);
105 XMLPARSER_API void HookUpNextPtrs(FXmlNode* Node);
107 XMLPARSER_API void CreateNodes(const TArray<FString>& Tokens);
109 static XMLPARSER_API void WriteNodeHierarchy(const FXmlNode& Node, const FString& Indent, FString& Output);
110
111private:
112
114 FString LoadedFile;
116 FString ErrorMessage;
118 FXmlNode* RootNode;
120 bool bFileLoaded;
122 bool bCreationFailed;
123
125 bool bHackAttemptToPreserveWhitespace = false;
126};
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
Definition XmlNode.h:13
Definition XmlFile.h:26
XMLPARSER_API FString GetLastError() const
Definition XmlFile.cpp:83
XMLPARSER_API void EnableAttemptToPreserveWhitespaceHack()
Definition XmlFile.cpp:838
FXmlFile(const FXmlFile &rhs)=delete
XMLPARSER_API bool LoadFile(const FString &Path, EConstructMethod::Type ConstructMethod=EConstructMethod::ConstructFromFile)
Definition XmlFile.cpp:14
~FXmlFile()
Definition XmlFile.h:38
XMLPARSER_API const FXmlNode * GetRootNode() const
Definition XmlFile.cpp:109
FXmlFile & operator=(const FXmlFile &rhs)=delete
FXmlFile()
Definition XmlFile.h:30
XMLPARSER_API bool IsValid() const
Definition XmlFile.cpp:103
XMLPARSER_API void Clear()
Definition XmlFile.cpp:88
Definition XmlNode.h:37
Definition ArrayView.h:139
Definition Array.h:670
Definition XmlFile.h:16
Type
Definition XmlFile.h:18
@ ConstructFromBuffer
Definition XmlFile.h:20
@ ConstructFromFile
Definition XmlFile.h:19
@ false
Definition radaudio_common.h:23