UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
VersePath.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3/*=============================================================================
4 VersePath.h: A type which holds a VersePath
5=============================================================================*/
6
7#pragma once
8
9#include "CoreMinimal.h"
10#include "Misc/PathViews.h"
11#include "VersePathFwd.h"
12
14{
15 friend bool operator==(const FVersePath& Lhs, const FVersePath& Rhs);
16 friend bool operator!=(const FVersePath& Lhs, const FVersePath& Rhs);
17
18 friend FArchive& operator<<(FArchive& Ar, FVersePath& VersePath);
19
20public:
21 [[nodiscard]] FVersePath() = default;
23 [[nodiscard]] FVersePath(const FVersePath&) = default;
25 FVersePath& operator=(const FVersePath&) = default;
26 ~FVersePath() = default;
27
28 [[nodiscard]] const TCHAR* operator*() const
29 {
30 return *PathString;
31 }
32
33 [[nodiscard]] bool IsValid() const
34 {
35 return !PathString.IsEmpty();
36 }
37
38 [[nodiscard]] explicit operator bool() const
39 {
40 return !PathString.IsEmpty();
41 }
42
50 {
51 return PathString.Compare(Other.PathString, ESearchCase::CaseSensitive);
52 }
53
68 [[nodiscard]] CORE_API bool IsBaseOf(const FVersePath& Other, FStringView* OutLeafPath = nullptr) const;
69
70 [[nodiscard]] const FString& ToString() const &
71 {
72 return PathString;
73 }
74
75 [[nodiscard]] FString ToString() &&
76 {
77 return MoveTemp(PathString);
78 }
79
81 {
82 return PathString;
83 }
84
85 [[nodiscard]] FText AsText() const &
86 {
88 }
89
91 {
92 return FText::AsCultureInvariant(MoveTemp(PathString));
93 }
94
95 [[nodiscard]] FString GetVerseDomain() const
96 {
97 return FString(FPathViews::GetMountPointNameFromPath(PathString));
98 }
99
104
106 {
108 return PathString.RightChop(VerseDomain.Len()+1);
109 }
110
111 CORE_API static bool TryMake(FVersePath& OutPath, const FString& Path, FText* OutErrorMessage = nullptr);
112 CORE_API static bool TryMake(FVersePath& OutPath, FString&& Path, FText* OutErrorMessage = nullptr);
113
114 [[nodiscard]] CORE_API static bool IsValidFullPath(const TCHAR* String, FText* OutErrorMessage = nullptr);
115 [[nodiscard]] CORE_API static bool IsValidFullPath(const TCHAR* String, int32 Len, FText* OutErrorMessage = nullptr);
116 [[nodiscard]] CORE_API static bool IsValidDomain(const TCHAR* String, FText* OutErrorMessage = nullptr);
117 [[nodiscard]] CORE_API static bool IsValidDomain(const TCHAR* String, int32 Len, FText* OutErrorMessage = nullptr);
118 [[nodiscard]] CORE_API static bool IsValidSubpath(const TCHAR* String, FText* OutErrorMessage = nullptr);
119 [[nodiscard]] CORE_API static bool IsValidSubpath(const TCHAR* String, int32 Len, FText* OutErrorMessage = nullptr);
120 [[nodiscard]] CORE_API static bool IsValidIdent(const TCHAR* String, FText* OutErrorMessage = nullptr, const FText* IdentTermReplacement = nullptr);
121 [[nodiscard]] CORE_API static bool IsValidIdent(const TCHAR* String, int32 Len, FText* OutErrorMessage = nullptr, const FText* IdentTermReplacement = nullptr);
122
123private:
124 FString PathString;
125};
126
128{
129 return Lhs.PathString.Equals(Rhs.PathString, ESearchCase::CaseSensitive);
130}
131
133{
134 return !(Lhs == Rhs);
135}
136
138{
139 return Ar << VersePath.PathString;
140}
141
143{
144 return FCrc::StrCrc32<TCHAR>(*VersePath);
145}
FPlatformTypes::TCHAR TCHAR
Either ANSICHAR or WIDECHAR, depending on whether the platform supports wide characters or the requir...
Definition Platform.h:1135
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
#define UE_FORCEINLINE_HINT
Definition Platform.h:723
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
const bool
Definition NetworkReplayStreaming.h:178
UE_INTRINSIC_CAST UE_REWRITE constexpr std::remove_reference_t< T > && MoveTemp(T &&Obj) noexcept
Definition UnrealTemplate.h:520
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition Archive.h:1208
static CORE_API FStringView GetMountPointNameFromPath(const FStringView InPath, bool *bOutHadClassesPrefix=nullptr, bool bInWithoutSlashes=true)
Definition PathViews.cpp:1115
Definition Text.h:385
static CORE_API FText AsCultureInvariant(const ANSICHAR *String)
Definition Text.cpp:1171
Definition VersePath.h:14
FStringView GetVerseDomainAsStringView() const
Definition VersePath.h:100
FVersePath & operator=(const FVersePath &)=default
FString ToString() &&
Definition VersePath.h:75
const TCHAR * operator*() const
Definition VersePath.h:28
FVersePath & operator=(FVersePath &&)=default
friend bool operator!=(const FVersePath &Lhs, const FVersePath &Rhs)
FText AsText() &&
Definition VersePath.h:90
int32 Compare(const FVersePath &Other) const
Definition VersePath.h:49
FText AsText() const &
Definition VersePath.h:85
FStringView AsStringView() const
Definition VersePath.h:80
friend bool operator==(const FVersePath &Lhs, const FVersePath &Rhs)
static CORE_API bool IsValidFullPath(const TCHAR *String, FText *OutErrorMessage=nullptr)
Definition VersePath.cpp:474
bool IsValid() const
Definition VersePath.h:33
static CORE_API bool IsValidSubpath(const TCHAR *String, FText *OutErrorMessage=nullptr)
Definition VersePath.cpp:494
static CORE_API bool IsValidDomain(const TCHAR *String, FText *OutErrorMessage=nullptr)
Definition VersePath.cpp:484
CORE_API bool IsBaseOf(const FVersePath &Other, FStringView *OutLeafPath=nullptr) const
Definition VersePath.cpp:453
FVersePath(const FVersePath &)=default
friend FArchive & operator<<(FArchive &Ar, FVersePath &VersePath)
FString GetVerseDomain() const
Definition VersePath.h:95
static CORE_API bool TryMake(FVersePath &OutPath, const FString &Path, FText *OutErrorMessage=nullptr)
Definition VersePath.cpp:518
static CORE_API bool IsValidIdent(const TCHAR *String, FText *OutErrorMessage=nullptr, const FText *IdentTermReplacement=nullptr)
Definition VersePath.cpp:504
const FString & ToString() const &
Definition VersePath.h:70
FVersePath(FVersePath &&)=default
FString GetPathExceptVerseDomain() const
Definition VersePath.h:105
@ CaseSensitive
Definition CString.h:23
bool operator!=(const FVersePath &Lhs, const FVersePath &Rhs)
Definition VersePath.h:132
FArchive & operator<<(FArchive &Ar, FVersePath &VersePath)
Definition VersePath.h:137
uint32 GetTypeHash(const UE::Core::FVersePath &VersePath)
Definition VersePath.h:142
bool operator==(const FVersePath &Lhs, const FVersePath &Rhs)
Definition VersePath.h:127