Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
FPathViews Class Reference

#include <PathViews.h>

Public Member Functions

 UE_DEPRECATED (4.25, "FPathViews::GetBaseFilename(InPath, bRemovePath) has been superseded by " "FPathViews::GetBaseFilename(InPath) and FPathViews::GetBaseFilenameWithPath(InPath).") static FStringView GetBaseFilename(const FStringView &InPath
 

Static Public Member Functions

static FStringView GetCleanFilename (const FStringView &InPath)
 
static FStringView GetBaseFilename (const FStringView &InPath)
 
static FStringView GetBaseFilenameWithPath (const FStringView &InPath)
 
static FStringView GetPath (const FStringView &InPath)
 
static FStringView GetExtension (const FStringView &InPath, bool bIncludeDot=false)
 
static FStringView GetPathLeaf (const FStringView &InPath)
 
static bool IsPathLeaf (FStringView InPath)
 
static void IterateComponents (FStringView InPath, TFunctionRef< void(FStringView)> ComponentVisitor)
 
static void Split (const FStringView &InPath, FStringView &OutPath, FStringView &OutName, FStringView &OutExt)
 
template<typename CharType , typename... ArgTypes>
static void Append (TStringBuilderBase< CharType > &Builder, ArgTypes &&... Args)
 
static FString ChangeExtension (const FStringView &InPath, const FStringView &InNewExtension)
 
static bool IsSeparator (TCHAR c)
 
static bool Equals (FStringView A, FStringView B)
 
static bool Less (FStringView A, FStringView B)
 
static bool TryMakeChildPathRelativeTo (FStringView Child, FStringView Parent, FStringView &OutRelPath)
 
static bool IsParentPathOf (FStringView Parent, FStringView Child)
 
static bool IsRelativePath (FStringView InPath)
 
static void ToAbsolutePath (FStringView InPath, FStringBuilderBase &OutPath)
 
static void ToAbsolutePath (FStringView BasePath, FStringView InPath, FStringBuilderBase &OutPath)
 
static void ToAbsolutePathInline (FStringBuilderBase &InOutPath)
 
static void ToAbsolutePathInline (FStringView BasePath, FStringBuilderBase &InOutPath)
 
static void NormalizeFilename (FStringBuilderBase &InOutPath)
 
static void NormalizeDirectoryName (FStringBuilderBase &InOutPath)
 
static bool CollapseRelativeDirectories (FStringBuilderBase &InOutPath)
 
static void RemoveDuplicateSlashes (FStringBuilderBase &InOutPath)
 
static void SplitFirstComponent (FStringView InPath, FStringView &OutFirstComponent, FStringView &OutRemainder)
 
static void AppendPath (FStringBuilderBase &InOutPath, FStringView AppendPath)
 
static FStringView GetMountPointNameFromPath (const FStringView InPath, bool *bOutHadClassesPrefix=nullptr, bool bInWithoutSlashes=true)
 

Public Attributes

bool bRemovePath
 

Detailed Description

Definition at line 13 of file PathViews.h.

Member Function Documentation

◆ Append()

template<typename CharType , typename... ArgTypes>
static void FPathViews::Append ( TStringBuilderBase< CharType > & Builder,
ArgTypes &&... Args )
inlinestatic

Appends each suffix argument to the path in the builder and ensures that there is a separator between them.

Examples: ("", "") -> "" ("A", "") -> "A/" ("", "B") -> "B" ("/", "B") -> "/B" ("A", "B") -> "A/B" ("A/", "B") -> "A/B" ("A\\", "B") -> "A\B" ("A/B", "C/D") -> "A/B/C/D" ("A/", "B", "C/", "D") -> "A/B/C/D"

Parameters
BuilderA possibly-empty path that may end in a separator.
ArgsArguments that can write to a string builder and do not start with a separator.

Definition at line 167 of file PathViews.h.

◆ AppendPath()

static void FPathViews::AppendPath ( FStringBuilderBase & InOutPath,
FStringView AppendPath )
static

If AppendPath is a relative path, append it as a relative path onto InOutPath. If AppendPath is absolute, reset InOutPath and replace it with RelPath. Handles presence or absence of terminating separator in BasePath. Does not interpret . or ..; each occurrence of these in either path will remain in the combined InOutPath.

◆ ChangeExtension()

static FString FPathViews::ChangeExtension ( const FStringView & InPath,
const FStringView & InNewExtension )
static

Replaces the pre-existing file extension of a filename.

Parameters
InPathA valid file path with a pre-existing extension.
InNewExtensionThe new extension to use (prefixing with a '.' is optional)
Returns
The new file path complete with the new extension unless InPath is not valid in which case a copy of InPath will be returned instead.

◆ CollapseRelativeDirectories()

static bool FPathViews::CollapseRelativeDirectories ( FStringBuilderBase & InOutPath)
static

Collapses redundant paths like "/./" and "SkipDir/..". FPaths::CollapseRelativeDirectories() equivalent.

◆ Equals()

static bool FPathViews::Equals ( FStringView A,
FStringView B )
static

Return true if the given paths are the same path (with exceptions noted below). Case-insensitive / is treated as equal to \ Presence or absence of terminating separator (/) is ignored in the comparison. Directory elements of . and .. are currently not interpreted and are treated as literal characters. Callers should not rely on this behavior as it may be corrected in the future. callers should instead conform the paths before calling. Relative paths and absolute paths are not resolved, and relative paths will never equal absolute paths. Callers should not rely on this behavior as it may be corrected in the future; callers should instead conform the paths before calling. Examples: ("../A/B.C", "../A/B.C") -> true ("../A/B", "../A/B.C") -> false ("../A/", "../A/") -> true ("../A/", "../A") -> true ("d:/root/Engine/", "d:\root\Engine") -> true (../../../Engine/Content", "d:/root/Engine/Content") -> false (d:/root/Engine/..", "d:/root") -> false (d:/root/Engine/./Content", "d:/root/Engine/Content") -> false

◆ GetBaseFilename()

static FStringView FPathViews::GetBaseFilename ( const FStringView & InPath)
static

Returns the portion of the path after the last separator and before the last dot.

Examples: (Using '/' but '\' is valid too.) "A/B/C.D" -> "C" "A/B/C" -> "C" "A/B/" -> "" "A" -> "A"

Returns
The portion of the path after the last separator and before the last dot.

◆ GetBaseFilenameWithPath()

static FStringView FPathViews::GetBaseFilenameWithPath ( const FStringView & InPath)
static

Returns the portion of the path before the last dot.

Examples: (Using '/' but '\' is valid too.) "A/B/C.D" -> "A/B/C" "A/B/C" -> "A/B/C" "A/B/" -> "A/B/" "A" -> "A"

Returns
The portion of the path before the last dot.

◆ GetCleanFilename()

static FStringView FPathViews::GetCleanFilename ( const FStringView & InPath)
static

Returns the portion of the path after the last separator.

Examples: (Using '/' but '\' is valid too.) "A/B/C.D" -> "C.D" "A/B/C" -> "C" "A/B/" -> "" "A" -> "A"

Returns
The portion of the path after the last separator.

◆ GetExtension()

static FStringView FPathViews::GetExtension ( const FStringView & InPath,
bool bIncludeDot = false )
static

Returns the portion of the path after the last dot following the last separator, optionally including the dot.

Examples: (Using '/' but '\' is valid too.) "A/B.C.D" -> "D" (bIncludeDot=false) or ".D" (bIncludeDot=true) "A/B/C.D" -> "D" (bIncludeDot=false) or ".D" (bIncludeDot=true) "A/B/.D" -> "D" (bIncludeDot=false) or ".D" (bIncludeDot=true) ".D" -> "D" (bIncludeDot=false) or ".D" (bIncludeDot=true) "A/B/C" -> "" "A.B/C" -> "" "A.B/" -> "" "A" -> ""

Parameters
bIncludeDotWhether to include the leading dot in the returned view.
Returns
The portion of the path after the last dot following the last separator, optionally including the dot.

◆ GetMountPointNameFromPath()

static FStringView FPathViews::GetMountPointNameFromPath ( const FStringView InPath,
bool * bOutHadClassesPrefix = nullptr,
bool bInWithoutSlashes = true )
static

Returns the name of the mount point in a path Removes starting forward slash and Classes_ prefix if bInWithoutSlashes is true Example: "/Classes_A/Textures" returns "A" and sets bOutHadClassesPrefix=true if bInWithoutSlashes is true returns "/Classes_A" otherwise and sets bOutHadClassesPrefix=false

◆ GetPath()

static FStringView FPathViews::GetPath ( const FStringView & InPath)
static

Returns the portion of the path before the last separator.

Examples: (Using '/' but '\' is valid too.) "A/B/C.D" -> "A/B" "A/B/C" -> "A/B" "A/B/" -> "A/B" "A" -> ""

Returns
The portion of the path before the last separator.

◆ GetPathLeaf()

static FStringView FPathViews::GetPathLeaf ( const FStringView & InPath)
static

Returns the last non-empty path component.

Examples: (Using '/' but '\' is valid too.) "A/B/C.D" -> "C.D" "A/B/C" -> "C" "A/B/" -> "B" "A" -> "A"

Returns
The last non-empty path component.

◆ IsParentPathOf()

static bool FPathViews::IsParentPathOf ( FStringView Parent,
FStringView Child )
static

Return whether Parent is a parent path of (or is equal to) Child. Case-insensitive / is treated as equal to \ Presence or absence of terminating separator (/) is ignored in the comparison. Directory elements of . and .. are currently not interpreted and are treated as literal characters. Callers should not rely on this behavior as it may be corrected in the future. callers should instead conform the paths before calling. Relative paths and absolute paths are not resolved, and relative paths will never equal absolute paths. Callers should not rely on this behavior as it may be corrected in the future; callers should instead conform the paths before calling. Examples: ("../A", "../A/B") -> true ("../A/", "../A\B") -> true ("../A", "../A/") -> true ("../A", ".././A/") -> false ("d:/root/Engine", "../../../Engine") -> false

Parameters
ParentAn absolute path that may be a parent path of Child.
ChildAn absolute path that may be a child path of Parent.
Returns
True if and only if Child is a child path of Parent (or is equal to it).

◆ IsPathLeaf()

static bool FPathViews::IsPathLeaf ( FStringView InPath)
static

Return whether the given relative or absolute path is a leaf path - has no separators.

Examples: (Using '/' but '\' functions the same way) A -> true A/ -> true D:/ -> true / -> true // -> true A/B -> false D:/A -> false //A -> false

◆ IsRelativePath()

static bool FPathViews::IsRelativePath ( FStringView InPath)
static

Return whether the given path is a relativepath - does not start with a separator or volume:. Returns true for empty paths.

◆ IsSeparator()

static bool FPathViews::IsSeparator ( TCHAR c)
static

Return whether the given character is a path-separator character (/ or )

◆ IterateComponents()

static void FPathViews::IterateComponents ( FStringView InPath,
TFunctionRef< void(FStringView)> ComponentVisitor )
static

Splits InPath into individual directory components, and calls ComponentVisitor on each.

Examples: "A/B.C" -> {"A", "B.C"} "A/B/C" -> {"A", "B", "C"} "../../A/B/C.D" -> {"..", "..", "A", "B", "C.D" }

◆ Less()

static bool FPathViews::Less ( FStringView A,
FStringView B )
static

Return true if the the first path is lexicographically less than the second path (with caveats noted below). Case-insensitive / is treated as equal to \ Presence or absence of terminating separator (/) is ignored in the comparison. Directory elements of . and .. are currently not interpreted and are treated as literal characters. Callers should not rely on this behavior as it may be corrected in the future. callers should instead conform the paths before calling. Relative paths and absolute paths are not resolved, and relative paths will never equal absolute paths. Callers should not rely on this behavior as it may be corrected in the future; callers should instead conform the paths before calling. Examples: ("../A/B.C", "../A/B.C") -> false (they are equal) ("../A/B", "../A/B.C") -> true (a string is greater than any prefix of itself) ("../A/", "../A/") -> false (they are equal) ("../A/", "../A") -> false (they are equal) ("../A", "../A/") -> false (they are equal) ("d:/root/Engine/", "d:\root\Engine") -> false (they are equal) (../../../Engine/Content", "d:/root/Engine/Content") -> true ('.' is less than 'd') (d:/root/Engine/..", "d:/root") -> false (A string is greater than any prefix of itself) (d:/root/Engine/./Content", "d:/root/Engine/Content") -> false

◆ NormalizeDirectoryName()

static void FPathViews::NormalizeDirectoryName ( FStringBuilderBase & InOutPath)
static

Normalize and remove trailing slash unless the preceding character is '/' or ':'

◆ NormalizeFilename()

static void FPathViews::NormalizeFilename ( FStringBuilderBase & InOutPath)
static

Convert \ to / and do platform-specific normalization

◆ RemoveDuplicateSlashes()

static void FPathViews::RemoveDuplicateSlashes ( FStringBuilderBase & InOutPath)
static

Removes duplicate forward slashes, e.g. "a/b//c////f.e" -> "a/b/c/f.e"

◆ Split()

static void FPathViews::Split ( const FStringView & InPath,
FStringView & OutPath,
FStringView & OutName,
FStringView & OutExt )
static

Splits a path into three parts, any of which may be empty: the path, the clean name, and the extension.

Examples: (Using '/' but '\' is valid too.) "A/B/C.D" -> ("A/B", "C", "D") "A/B/C" -> ("A/B", "C", "") "A/B/" -> ("A/B", "", "") "A/B/.D" -> ("A/B", "", "D") "A/B.C.D" -> ("A", "B.C", "D") "A" -> ("", "A", "") "A.D" -> ("", "A", "D") ".D" -> ("", "", "D")

Parameters
OutPath[out] Receives the path portion of the input string, excluding the trailing separator.
OutName[out] Receives the name portion of the input string.
OutExt[out] Receives the extension portion of the input string, excluding the dot.

◆ SplitFirstComponent()

static void FPathViews::SplitFirstComponent ( FStringView InPath,
FStringView & OutFirstComponent,
FStringView & OutRemainder )
static

Split the given absolute or relative path into its topmost directory and the relative path from that directory. Directory elements of . and .. are currently not interpreted and are treated as literal characters. Callers should not rely on this behavior as it may be corrected in the future. callers should instead conform the paths before calling.

Parameters
InPathThe path to split.
OutFirstComponentReceives the first directory element in the path, or InPath if it is a leaf path.
OutRemainderReceives the relative path from OutFirstComponent to InPath, or empty if InPath is a leaf path.

◆ ToAbsolutePath() [1/2]

static void FPathViews::ToAbsolutePath ( FStringView BasePath,
FStringView InPath,
FStringBuilderBase & OutPath )
static

Convert to absolute using explicit BasePath, normalize and append. FPaths::ConvertRelativePathToFull() equivalent.

◆ ToAbsolutePath() [2/2]

static void FPathViews::ToAbsolutePath ( FStringView InPath,
FStringBuilderBase & OutPath )
static

Convert to absolute using process BaseDir(), normalize and append. FPaths::ConvertRelativePathToFull() equivalent.

◆ ToAbsolutePathInline() [1/2]

static void FPathViews::ToAbsolutePathInline ( FStringBuilderBase & InOutPath)
static

Convert to absolute using process BaseDir() and normalize inlined. FPaths::ConvertRelativePathToFull() equivalent.

◆ ToAbsolutePathInline() [2/2]

static void FPathViews::ToAbsolutePathInline ( FStringView BasePath,
FStringBuilderBase & InOutPath )
static

Convert to absolute using explicit BasePath and normalize inlined. FPaths::ConvertRelativePathToFull() equivalent.

◆ TryMakeChildPathRelativeTo()

static bool FPathViews::TryMakeChildPathRelativeTo ( FStringView Child,
FStringView Parent,
FStringView & OutRelPath )
static

Check whether Parent is a parent path of Child and report the relative path if so. Case-insensitive / is treated as equal to \ Presence or absence of terminating separator (/) is ignored in the comparison. Directory elements of . and .. are currently not interpreted and are treated as literal characters. Callers should not rely on this behavior as it may be corrected in the future. callers should instead conform the paths before calling. Relative paths and absolute paths are not resolved, and relative paths will never equal absolute paths. Callers should not rely on this behavior as it may be corrected in the future; callers should instead conform the paths before calling. Examples: ("../A/B", "../A") -> (true, "B") ("../A\B", "../A/") -> (true, "B") ("../A/", "../A") -> (true, "") (".././A/", "../A") -> (false, "") ("../../../Engine", "d:/root/Engine") -> (false, "")

Parameters
ChildAn absolute path that may be a child path of Parent.
ParentAn absolute path that may be a parent path of Child.
OutRelPathReceives the relative path from Parent to Child, or empty if Parent is not a parent of Child.
Returns
True if and only if Child is a child path of Parent (or is equal to it).

◆ UE_DEPRECATED()

FPathViews::UE_DEPRECATED ( 4. 25,
"FPathViews::GetBaseFilename(InPath, bRemovePath) has been superseded by " "FPathViews::GetBaseFilename(InPath) and FPathViews::GetBaseFilenameWithPath(InPath)."  ) const &

Returns the portion of the path before the last dot and optionally after the last separator.

Member Data Documentation

◆ bRemovePath

bool FPathViews::bRemovePath

Definition at line 58 of file PathViews.h.


The documentation for this class was generated from the following file: