summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibMarkdown
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-11-11 00:55:02 +0100
committerAndreas Kling <kling@serenityos.org>2021-11-11 01:27:46 +0100
commit8b1108e4858f797c9216dc8ae4a3918ad50c73b4 (patch)
treeca64ba25aa735d25013d76c6d83570496c742014 /Userland/Libraries/LibMarkdown
parentad5d217e760c7fb73ffc0c4c827d767d6be8ec80 (diff)
downloadserenity-8b1108e4858f797c9216dc8ae4a3918ad50c73b4.zip
Everywhere: Pass AK::StringView by value
Diffstat (limited to 'Userland/Libraries/LibMarkdown')
-rw-r--r--Userland/Libraries/LibMarkdown/Document.cpp2
-rw-r--r--Userland/Libraries/LibMarkdown/Document.h2
-rw-r--r--Userland/Libraries/LibMarkdown/Heading.cpp2
-rw-r--r--Userland/Libraries/LibMarkdown/HorizontalRule.cpp2
-rw-r--r--Userland/Libraries/LibMarkdown/LineIterator.cpp2
-rw-r--r--Userland/Libraries/LibMarkdown/LineIterator.h2
-rw-r--r--Userland/Libraries/LibMarkdown/List.cpp2
-rw-r--r--Userland/Libraries/LibMarkdown/Text.cpp10
-rw-r--r--Userland/Libraries/LibMarkdown/Text.h10
9 files changed, 17 insertions, 17 deletions
diff --git a/Userland/Libraries/LibMarkdown/Document.cpp b/Userland/Libraries/LibMarkdown/Document.cpp
index ee53bf9686..2d00188ee2 100644
--- a/Userland/Libraries/LibMarkdown/Document.cpp
+++ b/Userland/Libraries/LibMarkdown/Document.cpp
@@ -51,7 +51,7 @@ RecursionDecision Document::walk(Visitor& visitor) const
return m_container->walk(visitor);
}
-OwnPtr<Document> Document::parse(const StringView& str)
+OwnPtr<Document> Document::parse(StringView str)
{
const Vector<StringView> lines_vec = str.lines();
LineIterator lines(lines_vec.begin());
diff --git a/Userland/Libraries/LibMarkdown/Document.h b/Userland/Libraries/LibMarkdown/Document.h
index db3e0fc0d6..1f1ee4b247 100644
--- a/Userland/Libraries/LibMarkdown/Document.h
+++ b/Userland/Libraries/LibMarkdown/Document.h
@@ -34,7 +34,7 @@ public:
*/
RecursionDecision walk(Visitor&) const;
- static OwnPtr<Document> parse(const StringView&);
+ static OwnPtr<Document> parse(StringView);
private:
OwnPtr<ContainerBlock> m_container;
diff --git a/Userland/Libraries/LibMarkdown/Heading.cpp b/Userland/Libraries/LibMarkdown/Heading.cpp
index 1dd321f8e5..21dff3f039 100644
--- a/Userland/Libraries/LibMarkdown/Heading.cpp
+++ b/Userland/Libraries/LibMarkdown/Heading.cpp
@@ -50,7 +50,7 @@ OwnPtr<Heading> Heading::parse(LineIterator& lines)
if (lines.is_end())
return {};
- const StringView& line = *lines;
+ StringView line = *lines;
size_t level;
for (level = 0; level < line.length(); level++) {
diff --git a/Userland/Libraries/LibMarkdown/HorizontalRule.cpp b/Userland/Libraries/LibMarkdown/HorizontalRule.cpp
index 2e696143ed..d18a9a489a 100644
--- a/Userland/Libraries/LibMarkdown/HorizontalRule.cpp
+++ b/Userland/Libraries/LibMarkdown/HorizontalRule.cpp
@@ -39,7 +39,7 @@ OwnPtr<HorizontalRule> HorizontalRule::parse(LineIterator& lines)
if (lines.is_end())
return {};
- const StringView& line = *lines;
+ StringView line = *lines;
if (line.length() < 3)
return {};
diff --git a/Userland/Libraries/LibMarkdown/LineIterator.cpp b/Userland/Libraries/LibMarkdown/LineIterator.cpp
index ec77ca1642..7366716e72 100644
--- a/Userland/Libraries/LibMarkdown/LineIterator.cpp
+++ b/Userland/Libraries/LibMarkdown/LineIterator.cpp
@@ -16,7 +16,7 @@ void LineIterator::reset_ignore_prefix()
}
}
-Optional<StringView> LineIterator::match_context(StringView const& line) const
+Optional<StringView> LineIterator::match_context(StringView line) const
{
bool is_ws = line.is_whitespace();
size_t offset = 0;
diff --git a/Userland/Libraries/LibMarkdown/LineIterator.h b/Userland/Libraries/LibMarkdown/LineIterator.h
index 8109e1d8e4..6fdbfd6922 100644
--- a/Userland/Libraries/LibMarkdown/LineIterator.h
+++ b/Userland/Libraries/LibMarkdown/LineIterator.h
@@ -91,7 +91,7 @@ public:
private:
void reset_ignore_prefix();
- Optional<StringView> match_context(StringView const& line) const;
+ Optional<StringView> match_context(StringView line) const;
Vector<StringView>::ConstIterator m_iterator;
Vector<Context> m_context_stack;
diff --git a/Userland/Libraries/LibMarkdown/List.cpp b/Userland/Libraries/LibMarkdown/List.cpp
index 187a5e5c11..0943234cc6 100644
--- a/Userland/Libraries/LibMarkdown/List.cpp
+++ b/Userland/Libraries/LibMarkdown/List.cpp
@@ -85,7 +85,7 @@ OwnPtr<List> List::parse(LineIterator& lines)
size_t offset = 0;
- const StringView& line = *lines;
+ StringView line = *lines;
bool appears_unordered = false;
diff --git a/Userland/Libraries/LibMarkdown/Text.cpp b/Userland/Libraries/LibMarkdown/Text.cpp
index 94a4456699..faae1d4353 100644
--- a/Userland/Libraries/LibMarkdown/Text.cpp
+++ b/Userland/Libraries/LibMarkdown/Text.cpp
@@ -251,7 +251,7 @@ RecursionDecision Text::walk(Visitor& visitor) const
return m_node->walk(visitor);
}
-Text Text::parse(StringView const& str)
+Text Text::parse(StringView str)
{
Text text;
auto const tokens = tokenize(str);
@@ -260,7 +260,7 @@ Text Text::parse(StringView const& str)
return text;
}
-static bool flanking(StringView const& str, size_t start, size_t end, int dir)
+static bool flanking(StringView str, size_t start, size_t end, int dir)
{
ssize_t next = ((dir > 0) ? end : start) + dir;
if (next < 0 || next >= (ssize_t)str.length())
@@ -279,7 +279,7 @@ static bool flanking(StringView const& str, size_t start, size_t end, int dir)
return isspace(str[prev]) || ispunct(str[prev]);
}
-Vector<Text::Token> Text::tokenize(StringView const& str)
+Vector<Text::Token> Text::tokenize(StringView str)
{
Vector<Token> tokens;
StringBuilder current_token;
@@ -306,14 +306,14 @@ Vector<Text::Token> Text::tokenize(StringView const& str)
bool in_space = false;
for (size_t offset = 0; offset < str.length(); ++offset) {
- auto has = [&](StringView const& seq) {
+ auto has = [&](StringView seq) {
if (offset + seq.length() > str.length())
return false;
return str.substring_view(offset, seq.length()) == seq;
};
- auto expect = [&](StringView const& seq) {
+ auto expect = [&](StringView seq) {
VERIFY(has(seq));
flush_token();
current_token.append(seq);
diff --git a/Userland/Libraries/LibMarkdown/Text.h b/Userland/Libraries/LibMarkdown/Text.h
index 7549fb94eb..7926eab8fc 100644
--- a/Userland/Libraries/LibMarkdown/Text.h
+++ b/Userland/Libraries/LibMarkdown/Text.h
@@ -73,13 +73,13 @@ public:
String text;
bool collapsible;
- TextNode(StringView const& text)
+ TextNode(StringView text)
: text(text)
, collapsible(true)
{
}
- TextNode(StringView const& text, bool collapsible)
+ TextNode(StringView text, bool collapsible)
: text(text)
, collapsible(collapsible)
{
@@ -126,7 +126,7 @@ public:
String render_for_terminal() const;
RecursionDecision walk(Visitor&) const;
- static Text parse(StringView const&);
+ static Text parse(StringView);
private:
struct Token {
@@ -157,10 +157,10 @@ private:
{
return data[0] == ' ';
}
- bool operator==(StringView const& str) const { return str == data; }
+ bool operator==(StringView str) const { return str == data; }
};
- static Vector<Token> tokenize(StringView const&);
+ static Vector<Token> tokenize(StringView);
static bool can_open(Token const& opening);
static bool can_close_for(Token const& opening, Token const& closing);