mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 00:47:45 +00:00
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 :^)
This commit is contained in:
parent
f74251606d
commit
6e19ab2bbc
2006 changed files with 11635 additions and 11636 deletions
|
@ -18,8 +18,8 @@ class Block {
|
|||
public:
|
||||
virtual ~Block() = default;
|
||||
|
||||
virtual String render_to_html(bool tight = false) const = 0;
|
||||
virtual String render_for_terminal(size_t view_width = 0) const = 0;
|
||||
virtual DeprecatedString render_to_html(bool tight = false) const = 0;
|
||||
virtual DeprecatedString render_for_terminal(size_t view_width = 0) const = 0;
|
||||
virtual RecursionDecision walk(Visitor&) const = 0;
|
||||
};
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
namespace Markdown {
|
||||
|
||||
String BlockQuote::render_to_html(bool) const
|
||||
DeprecatedString BlockQuote::render_to_html(bool) const
|
||||
{
|
||||
StringBuilder builder;
|
||||
builder.append("<blockquote>\n"sv);
|
||||
|
@ -19,7 +19,7 @@ String BlockQuote::render_to_html(bool) const
|
|||
return builder.build();
|
||||
}
|
||||
|
||||
String BlockQuote::render_for_terminal(size_t view_width) const
|
||||
DeprecatedString BlockQuote::render_for_terminal(size_t view_width) const
|
||||
{
|
||||
// FIXME: Rewrite the whole terminal renderer to make blockquote rendering possible
|
||||
return m_contents->render_for_terminal(view_width);
|
||||
|
|
|
@ -21,8 +21,8 @@ public:
|
|||
}
|
||||
virtual ~BlockQuote() override = default;
|
||||
|
||||
virtual String render_to_html(bool tight = false) const override;
|
||||
virtual String render_for_terminal(size_t view_width = 0) const override;
|
||||
virtual DeprecatedString render_to_html(bool tight = false) const override;
|
||||
virtual DeprecatedString render_for_terminal(size_t view_width = 0) const override;
|
||||
virtual RecursionDecision walk(Visitor&) const override;
|
||||
|
||||
static OwnPtr<BlockQuote> parse(LineIterator& lines);
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
namespace Markdown {
|
||||
|
||||
String CodeBlock::render_to_html(bool) const
|
||||
DeprecatedString CodeBlock::render_to_html(bool) const
|
||||
{
|
||||
StringBuilder builder;
|
||||
|
||||
|
@ -46,7 +46,7 @@ String CodeBlock::render_to_html(bool) const
|
|||
return builder.build();
|
||||
}
|
||||
|
||||
String CodeBlock::render_for_terminal(size_t) const
|
||||
DeprecatedString CodeBlock::render_for_terminal(size_t) const
|
||||
{
|
||||
StringBuilder builder;
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace Markdown {
|
|||
|
||||
class CodeBlock final : public Block {
|
||||
public:
|
||||
CodeBlock(String const& language, String const& style, String const& code, Heading* current_section)
|
||||
CodeBlock(DeprecatedString const& language, DeprecatedString const& style, DeprecatedString const& code, Heading* current_section)
|
||||
: m_code(move(code))
|
||||
, m_language(language)
|
||||
, m_style(style)
|
||||
|
@ -26,15 +26,15 @@ public:
|
|||
}
|
||||
virtual ~CodeBlock() override = default;
|
||||
|
||||
virtual String render_to_html(bool tight = false) const override;
|
||||
virtual String render_for_terminal(size_t view_width = 0) const override;
|
||||
virtual DeprecatedString render_to_html(bool tight = false) const override;
|
||||
virtual DeprecatedString render_for_terminal(size_t view_width = 0) const override;
|
||||
virtual RecursionDecision walk(Visitor&) const override;
|
||||
static OwnPtr<CodeBlock> parse(LineIterator& lines, Heading* current_section);
|
||||
|
||||
private:
|
||||
String m_code;
|
||||
String m_language;
|
||||
String m_style;
|
||||
DeprecatedString m_code;
|
||||
DeprecatedString m_language;
|
||||
DeprecatedString m_style;
|
||||
Heading* m_current_section;
|
||||
|
||||
static OwnPtr<CodeBlock> parse_backticks(LineIterator& lines, Heading* current_section);
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
namespace Markdown {
|
||||
|
||||
String CommentBlock::render_to_html(bool) const
|
||||
DeprecatedString CommentBlock::render_to_html(bool) const
|
||||
{
|
||||
StringBuilder builder;
|
||||
|
||||
|
@ -22,7 +22,7 @@ String CommentBlock::render_to_html(bool) const
|
|||
return builder.build();
|
||||
}
|
||||
|
||||
String CommentBlock::render_for_terminal(size_t) const
|
||||
DeprecatedString CommentBlock::render_for_terminal(size_t) const
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/OwnPtr.h>
|
||||
#include <AK/String.h>
|
||||
#include <LibMarkdown/Block.h>
|
||||
#include <LibMarkdown/LineIterator.h>
|
||||
|
||||
|
@ -16,19 +16,19 @@ namespace Markdown {
|
|||
|
||||
class CommentBlock final : public Block {
|
||||
public:
|
||||
CommentBlock(String const& comment)
|
||||
CommentBlock(DeprecatedString const& comment)
|
||||
: m_comment(comment)
|
||||
{
|
||||
}
|
||||
virtual ~CommentBlock() override = default;
|
||||
|
||||
virtual String render_to_html(bool tight = false) const override;
|
||||
virtual String render_for_terminal(size_t view_width = 0) const override;
|
||||
virtual DeprecatedString render_to_html(bool tight = false) const override;
|
||||
virtual DeprecatedString render_for_terminal(size_t view_width = 0) const override;
|
||||
virtual RecursionDecision walk(Visitor&) const override;
|
||||
static OwnPtr<CommentBlock> parse(LineIterator& lines);
|
||||
|
||||
private:
|
||||
String m_comment;
|
||||
DeprecatedString m_comment;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
namespace Markdown {
|
||||
|
||||
String ContainerBlock::render_to_html(bool tight) const
|
||||
DeprecatedString ContainerBlock::render_to_html(bool tight) const
|
||||
{
|
||||
StringBuilder builder;
|
||||
|
||||
|
@ -39,7 +39,7 @@ String ContainerBlock::render_to_html(bool tight) const
|
|||
return builder.build();
|
||||
}
|
||||
|
||||
String ContainerBlock::render_for_terminal(size_t view_width) const
|
||||
DeprecatedString ContainerBlock::render_for_terminal(size_t view_width) const
|
||||
{
|
||||
StringBuilder builder;
|
||||
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/NonnullOwnPtrVector.h>
|
||||
#include <AK/OwnPtr.h>
|
||||
#include <AK/String.h>
|
||||
#include <LibMarkdown/Block.h>
|
||||
#include <LibMarkdown/LineIterator.h>
|
||||
|
||||
|
@ -26,8 +26,8 @@ public:
|
|||
|
||||
virtual ~ContainerBlock() override = default;
|
||||
|
||||
virtual String render_to_html(bool tight = false) const override;
|
||||
virtual String render_for_terminal(size_t view_width = 0) const override;
|
||||
virtual DeprecatedString render_to_html(bool tight = false) const override;
|
||||
virtual DeprecatedString render_for_terminal(size_t view_width = 0) const override;
|
||||
virtual RecursionDecision walk(Visitor&) const override;
|
||||
|
||||
static OwnPtr<ContainerBlock> parse(LineIterator& lines);
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
namespace Markdown {
|
||||
|
||||
String Document::render_to_html(StringView extra_head_contents) const
|
||||
DeprecatedString Document::render_to_html(StringView extra_head_contents) const
|
||||
{
|
||||
StringBuilder builder;
|
||||
builder.append(R"~~~(<!DOCTYPE html>
|
||||
|
@ -38,12 +38,12 @@ String Document::render_to_html(StringView extra_head_contents) const
|
|||
return builder.build();
|
||||
}
|
||||
|
||||
String Document::render_to_inline_html() const
|
||||
DeprecatedString Document::render_to_inline_html() const
|
||||
{
|
||||
return m_container->render_to_html();
|
||||
}
|
||||
|
||||
String Document::render_for_terminal(size_t view_width) const
|
||||
DeprecatedString Document::render_for_terminal(size_t view_width) const
|
||||
{
|
||||
return m_container->render_for_terminal(view_width);
|
||||
}
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/OwnPtr.h>
|
||||
#include <AK/String.h>
|
||||
#include <LibMarkdown/Block.h>
|
||||
#include <LibMarkdown/ContainerBlock.h>
|
||||
|
||||
|
@ -19,9 +19,9 @@ public:
|
|||
: m_container(move(container))
|
||||
{
|
||||
}
|
||||
String render_to_html(StringView extra_head_contents = ""sv) const;
|
||||
String render_to_inline_html() const;
|
||||
String render_for_terminal(size_t view_width = 0) const;
|
||||
DeprecatedString render_to_html(StringView extra_head_contents = ""sv) const;
|
||||
DeprecatedString render_to_inline_html() const;
|
||||
DeprecatedString render_for_terminal(size_t view_width = 0) const;
|
||||
|
||||
/*
|
||||
* Walk recursively through the document tree. Returning `RecursionDecision::Recurse` from
|
||||
|
|
|
@ -10,12 +10,12 @@
|
|||
|
||||
namespace Markdown {
|
||||
|
||||
String Heading::render_to_html(bool) const
|
||||
DeprecatedString Heading::render_to_html(bool) const
|
||||
{
|
||||
return String::formatted("<h{}>{}</h{}>\n", m_level, m_text.render_to_html(), m_level);
|
||||
return DeprecatedString::formatted("<h{}>{}</h{}>\n", m_level, m_text.render_to_html(), m_level);
|
||||
}
|
||||
|
||||
String Heading::render_for_terminal(size_t) const
|
||||
DeprecatedString Heading::render_for_terminal(size_t) const
|
||||
{
|
||||
StringBuilder builder;
|
||||
|
||||
|
|
|
@ -26,8 +26,8 @@ public:
|
|||
}
|
||||
virtual ~Heading() override = default;
|
||||
|
||||
virtual String render_to_html(bool tight = false) const override;
|
||||
virtual String render_for_terminal(size_t view_width = 0) const override;
|
||||
virtual DeprecatedString render_to_html(bool tight = false) const override;
|
||||
virtual DeprecatedString render_for_terminal(size_t view_width = 0) const override;
|
||||
virtual RecursionDecision walk(Visitor&) const override;
|
||||
static OwnPtr<Heading> parse(LineIterator& lines);
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/String.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <LibMarkdown/HorizontalRule.h>
|
||||
#include <LibMarkdown/Visitor.h>
|
||||
|
@ -12,12 +12,12 @@
|
|||
|
||||
namespace Markdown {
|
||||
|
||||
String HorizontalRule::render_to_html(bool) const
|
||||
DeprecatedString HorizontalRule::render_to_html(bool) const
|
||||
{
|
||||
return "<hr />\n";
|
||||
}
|
||||
|
||||
String HorizontalRule::render_for_terminal(size_t view_width) const
|
||||
DeprecatedString HorizontalRule::render_for_terminal(size_t view_width) const
|
||||
{
|
||||
StringBuilder builder(view_width + 1);
|
||||
for (size_t i = 0; i < view_width; ++i)
|
||||
|
|
|
@ -20,8 +20,8 @@ public:
|
|||
HorizontalRule() = default;
|
||||
virtual ~HorizontalRule() override = default;
|
||||
|
||||
virtual String render_to_html(bool tight = false) const override;
|
||||
virtual String render_for_terminal(size_t view_width = 0) const override;
|
||||
virtual DeprecatedString render_to_html(bool tight = false) const override;
|
||||
virtual DeprecatedString render_for_terminal(size_t view_width = 0) const override;
|
||||
virtual RecursionDecision walk(Visitor&) const override;
|
||||
static OwnPtr<HorizontalRule> parse(LineIterator& lines);
|
||||
};
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
namespace Markdown {
|
||||
|
||||
String List::render_to_html(bool) const
|
||||
DeprecatedString List::render_to_html(bool) const
|
||||
{
|
||||
StringBuilder builder;
|
||||
|
||||
|
@ -37,7 +37,7 @@ String List::render_to_html(bool) const
|
|||
return builder.build();
|
||||
}
|
||||
|
||||
String List::render_for_terminal(size_t) const
|
||||
DeprecatedString List::render_for_terminal(size_t) const
|
||||
{
|
||||
StringBuilder builder;
|
||||
|
||||
|
|
|
@ -25,8 +25,8 @@ public:
|
|||
}
|
||||
virtual ~List() override = default;
|
||||
|
||||
virtual String render_to_html(bool tight = false) const override;
|
||||
virtual String render_for_terminal(size_t view_width = 0) const override;
|
||||
virtual DeprecatedString render_to_html(bool tight = false) const override;
|
||||
virtual DeprecatedString render_for_terminal(size_t view_width = 0) const override;
|
||||
virtual RecursionDecision walk(Visitor&) const override;
|
||||
|
||||
static OwnPtr<List> parse(LineIterator& lines);
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
namespace Markdown {
|
||||
|
||||
String Paragraph::render_to_html(bool tight) const
|
||||
DeprecatedString Paragraph::render_to_html(bool tight) const
|
||||
{
|
||||
StringBuilder builder;
|
||||
|
||||
|
@ -27,7 +27,7 @@ String Paragraph::render_to_html(bool tight) const
|
|||
return builder.build();
|
||||
}
|
||||
|
||||
String Paragraph::render_for_terminal(size_t) const
|
||||
DeprecatedString Paragraph::render_for_terminal(size_t) const
|
||||
{
|
||||
StringBuilder builder;
|
||||
builder.append(" "sv);
|
||||
|
|
|
@ -23,8 +23,8 @@ public:
|
|||
|
||||
virtual ~Paragraph() override = default;
|
||||
|
||||
virtual String render_to_html(bool tight = false) const override;
|
||||
virtual String render_for_terminal(size_t view_width = 0) const override;
|
||||
virtual DeprecatedString render_to_html(bool tight = false) const override;
|
||||
virtual DeprecatedString render_for_terminal(size_t view_width = 0) const override;
|
||||
virtual RecursionDecision walk(Visitor&) const override;
|
||||
|
||||
private:
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
namespace Markdown {
|
||||
|
||||
String Table::render_for_terminal(size_t view_width) const
|
||||
DeprecatedString Table::render_for_terminal(size_t view_width) const
|
||||
{
|
||||
auto unit_width_length = view_width == 0 ? 4 : ((float)(view_width - m_columns.size()) / (float)m_total_width);
|
||||
StringBuilder builder;
|
||||
|
@ -68,7 +68,7 @@ String Table::render_for_terminal(size_t view_width) const
|
|||
return builder.to_string();
|
||||
}
|
||||
|
||||
String Table::render_to_html(bool) const
|
||||
DeprecatedString Table::render_to_html(bool) const
|
||||
{
|
||||
auto alignment_string = [](Alignment alignment) {
|
||||
switch (alignment) {
|
||||
|
|
|
@ -34,8 +34,8 @@ public:
|
|||
Table() = default;
|
||||
virtual ~Table() override = default;
|
||||
|
||||
virtual String render_to_html(bool tight = false) const override;
|
||||
virtual String render_for_terminal(size_t view_width = 0) const override;
|
||||
virtual DeprecatedString render_to_html(bool tight = false) const override;
|
||||
virtual DeprecatedString render_for_terminal(size_t view_width = 0) const override;
|
||||
virtual RecursionDecision walk(Visitor&) const override;
|
||||
static OwnPtr<Table> parse(LineIterator& lines);
|
||||
|
||||
|
|
|
@ -263,14 +263,14 @@ size_t Text::terminal_length() const
|
|||
return m_node->terminal_length();
|
||||
}
|
||||
|
||||
String Text::render_to_html() const
|
||||
DeprecatedString Text::render_to_html() const
|
||||
{
|
||||
StringBuilder builder;
|
||||
m_node->render_to_html(builder);
|
||||
return builder.build().trim(" \n\t"sv);
|
||||
}
|
||||
|
||||
String Text::render_for_terminal() const
|
||||
DeprecatedString Text::render_for_terminal() const
|
||||
{
|
||||
StringBuilder builder;
|
||||
m_node->render_for_terminal(builder);
|
||||
|
|
|
@ -8,11 +8,11 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/Noncopyable.h>
|
||||
#include <AK/NonnullOwnPtrVector.h>
|
||||
#include <AK/OwnPtr.h>
|
||||
#include <AK/RecursionDecision.h>
|
||||
#include <AK/String.h>
|
||||
#include <LibMarkdown/Forward.h>
|
||||
|
||||
namespace Markdown {
|
||||
|
@ -71,7 +71,7 @@ public:
|
|||
|
||||
class TextNode : public Node {
|
||||
public:
|
||||
String text;
|
||||
DeprecatedString text;
|
||||
bool collapsible;
|
||||
|
||||
TextNode(StringView text)
|
||||
|
@ -96,11 +96,11 @@ public:
|
|||
public:
|
||||
bool is_image;
|
||||
NonnullOwnPtr<Node> text;
|
||||
String href;
|
||||
DeprecatedString href;
|
||||
Optional<int> image_width;
|
||||
Optional<int> image_height;
|
||||
|
||||
LinkNode(bool is_image, NonnullOwnPtr<Node> text, String href, Optional<int> image_width, Optional<int> image_height)
|
||||
LinkNode(bool is_image, NonnullOwnPtr<Node> text, DeprecatedString href, Optional<int> image_width, Optional<int> image_height)
|
||||
: is_image(is_image)
|
||||
, text(move(text))
|
||||
, href(move(href))
|
||||
|
@ -146,15 +146,15 @@ public:
|
|||
|
||||
size_t terminal_length() const;
|
||||
|
||||
String render_to_html() const;
|
||||
String render_for_terminal() const;
|
||||
DeprecatedString render_to_html() const;
|
||||
DeprecatedString render_for_terminal() const;
|
||||
RecursionDecision walk(Visitor&) const;
|
||||
|
||||
static Text parse(StringView);
|
||||
|
||||
private:
|
||||
struct Token {
|
||||
String data;
|
||||
DeprecatedString data;
|
||||
// Flanking basically means that a delimiter run has a non-whitespace,
|
||||
// non-punctuation character on the corresponding side. For a more exact
|
||||
// definition, see the CommonMark spec.
|
||||
|
|
|
@ -47,7 +47,7 @@ public:
|
|||
virtual RecursionDecision visit(Text::StrikeThroughNode const&) { return RecursionDecision::Recurse; }
|
||||
virtual RecursionDecision visit(Text::TextNode const&) { return RecursionDecision::Recurse; }
|
||||
|
||||
virtual RecursionDecision visit(String const&) { return RecursionDecision::Recurse; }
|
||||
virtual RecursionDecision visit(DeprecatedString const&) { return RecursionDecision::Recurse; }
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue