summaryrefslogtreecommitdiff
path: root/Userland/Utilities/cut.cpp
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2022-12-04 18:02:33 +0000
committerAndreas Kling <kling@serenityos.org>2022-12-06 08:54:33 +0100
commit6e19ab2bbce0b113b628e6f8e9b5c0640053933e (patch)
tree372d21b2f5dcff112f5d0089559c6af5798680d4 /Userland/Utilities/cut.cpp
parentf74251606d74b504a1379ebb893fdb5529054ea5 (diff)
downloadserenity-6e19ab2bbce0b113b628e6f8e9b5c0640053933e.zip
AK+Everywhere: Rename String to DeprecatedString
We have a new, improved string type coming up in AK (OOM aware, no null state), and while it's going to use UTF-8, the name UTF8String is a mouthful - so let's free up the String name by renaming the existing class. Making the old one have an annoying name will hopefully also help with quick adoption :^)
Diffstat (limited to 'Userland/Utilities/cut.cpp')
-rw-r--r--Userland/Utilities/cut.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/Userland/Utilities/cut.cpp b/Userland/Utilities/cut.cpp
index 6d19c9b64c..c0c52b3d89 100644
--- a/Userland/Utilities/cut.cpp
+++ b/Userland/Utilities/cut.cpp
@@ -4,9 +4,9 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
+#include <AK/DeprecatedString.h>
#include <AK/QuickSort.h>
#include <AK/StdLibExtras.h>
-#include <AK/String.h>
#include <AK/Vector.h>
#include <LibCore/ArgsParser.h>
#include <LibMain/Main.h>
@@ -32,9 +32,9 @@ struct Range {
}
};
-static bool expand_list(String& list, Vector<Range>& ranges)
+static bool expand_list(DeprecatedString& list, Vector<Range>& ranges)
{
- Vector<String> tokens = list.split(',');
+ Vector<DeprecatedString> tokens = list.split(',');
for (auto& token : tokens) {
if (token.length() == 0) {
@@ -127,7 +127,7 @@ static void process_line_bytes(char* line, size_t length, Vector<Range> const& r
continue;
auto to = min(i.m_to, length);
- auto sub_string = String(line).substring(i.m_from - 1, to - i.m_from + 1);
+ auto sub_string = DeprecatedString(line).substring(i.m_from - 1, to - i.m_from + 1);
out("{}", sub_string);
}
outln();
@@ -135,8 +135,8 @@ static void process_line_bytes(char* line, size_t length, Vector<Range> const& r
static void process_line_fields(char* line, size_t length, Vector<Range> const& ranges, char delimiter)
{
- auto string_split = String(line, length).split(delimiter);
- Vector<String> output_fields;
+ auto string_split = DeprecatedString(line, length).split(delimiter);
+ Vector<DeprecatedString> output_fields;
for (auto& range : ranges) {
for (size_t i = range.m_from - 1; i < min(range.m_to, string_split.size()); i++) {
@@ -144,14 +144,14 @@ static void process_line_fields(char* line, size_t length, Vector<Range> const&
}
}
- outln("{}", String::join(delimiter, output_fields));
+ outln("{}", DeprecatedString::join(delimiter, output_fields));
}
ErrorOr<int> serenity_main(Main::Arguments arguments)
{
- String byte_list = "";
- String fields_list = "";
- String delimiter = "\t";
+ DeprecatedString byte_list = "";
+ DeprecatedString fields_list = "";
+ DeprecatedString delimiter = "\t";
Vector<StringView> files;
@@ -185,7 +185,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
return 1;
}
- String ranges_list;
+ DeprecatedString ranges_list;
Vector<Range> ranges_vector;
if (selected_bytes) {
@@ -224,13 +224,13 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
}
if (files.is_empty())
- files.append(String());
+ files.append(DeprecatedString());
/* Process each file */
for (auto& file : files) {
FILE* fp = stdin;
if (!file.is_null()) {
- fp = fopen(String(file).characters(), "r");
+ fp = fopen(DeprecatedString(file).characters(), "r");
if (!fp) {
warnln("cut: Could not open file '{}'", file);
continue;