Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
ParseLines.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "Containers/StringFwd.h"
6#include "Containers/StringView.h"
7#include "CoreTypes.h"
8#include "Misc/EnumClassFlags.h"
9#include "Templates/Function.h"
10
11template <typename FuncType> class TFunctionRef;
12
13namespace UE::String
14{
15
17{
18 /** Use the default options when parsing lines. */
19 None = 0,
20 /** Skip lines that are empty or, if trimming, only whitespace. */
21 SkipEmpty = 1 << 0,
22 /** Trim whitespace from each parsed line. */
23 Trim = 1 << 1,
24};
25
27
28/**
29 * Visit every line in the input string as terminated by any of CRLF, CR, LF.
30 *
31 * By default, empty lines are visited.
32 *
33 * @param View A view of the string to split into lines.
34 * @param Visitor A function that is called for each line.
35 * @param Options Flags to modify the default behavior.
36 */
38 FStringView View,
39 TFunctionRef<void (FStringView)> Visitor,
41
42/**
43 * Parse lines in the input string as terminated by any of CRLF, CR, LF.
44 *
45 * Output strings are sub-views of the input view and have the same lifetime as the input view.
46 * By default, empty lines are collected.
47 *
48 * @param View A view of the string to split into lines.
49 * @param Output The output to add parsed lines to by calling Output.Add(FStringView).
50 * @param Options Flags to modify the default behavior.
51 */
52template <typename OutputType>
53inline void ParseLines(
54 const FStringView View,
55 OutputType& Output,
57{
59}
60
61} // UE::String
#define ENUM_CLASS_FLAGS(Enum)
void ParseLines(const FStringView View, OutputType &Output, const EParseLinesOptions Options=EParseLinesOptions::None)
Definition ParseLines.h:53
void ParseLines(FStringView View, TFunctionRef< void(FStringView)> Visitor, EParseLinesOptions Options=EParseLinesOptions::None)
Definition Vector.h:40