diff --git a/libaegisub/ass/karaoke.cpp b/libaegisub/ass/karaoke.cpp index e1795f7105..30099a9228 100644 --- a/libaegisub/ass/karaoke.cpp +++ b/libaegisub/ass/karaoke.cpp @@ -19,7 +19,6 @@ #include #include -#include #include namespace agi::ass { diff --git a/src/ass_dialogue.cpp b/src/ass_dialogue.cpp index 490d352866..093be7b7b0 100644 --- a/src/ass_dialogue.cpp +++ b/src/ass_dialogue.cpp @@ -85,11 +85,11 @@ class tokenizer { void AssDialogue::Parse(std::string const& raw) { std::string_view str = raw; - if (boost::starts_with(raw, "Dialogue:")) { + if (raw.starts_with("Dialogue:")) { Comment = false; str.remove_prefix(10); } - else if (boost::starts_with(raw, "Comment:")) { + else if (raw.starts_with("Comment:")) { Comment = true; str.remove_prefix(9); } diff --git a/src/ass_override.cpp b/src/ass_override.cpp index 998b9b1789..07f2ffeaf5 100644 --- a/src/ass_override.cpp +++ b/src/ass_override.cpp @@ -38,7 +38,6 @@ #include #include -#include #include #include #include @@ -57,8 +56,8 @@ template<> std::string AssOverrideParameter::Get() const { if (omitted) throw agi::InternalError("AssOverrideParameter::Get() called on omitted parameter"); if (block.get()) { std::string str(block->GetText()); - if (boost::starts_with(str, "{")) str.erase(begin(str)); - if (boost::ends_with(str, "}")) str.erase(end(str) - 1); + if (str.starts_with("{")) str.erase(begin(str)); + if (str.starts_with("}")) str.erase(end(str) - 1); return str; } return value; @@ -442,7 +441,7 @@ void AssOverrideTag::Clear() { void AssOverrideTag::SetText(const std::string &text) { load_protos(); for (auto cur = proto.begin(); cur != proto.end(); ++cur) { - if (boost::starts_with(text, cur->name)) { + if (text.starts_with(cur->name)) { Name = cur->name; parse_parameters(this, text.substr(Name.size()), cur); valid = true; diff --git a/src/ass_parser.cpp b/src/ass_parser.cpp index ebbd6211b2..d999c2cd75 100644 --- a/src/ass_parser.cpp +++ b/src/ass_parser.cpp @@ -27,7 +27,6 @@ #include #include -#include #include #include #include @@ -84,7 +83,7 @@ class AssParser::HeaderToProperty { return true; } - if (boost::starts_with(key, "Automation Settings ")) { + if (key.starts_with("Automation Settings ")) { target->Properties.automation_settings[key.substr(strlen("Automation Settings"))] = value; return true; } @@ -104,7 +103,7 @@ AssParser::AssParser(AssFile *target, int version) AssParser::~AssParser() = default; void AssParser::ParseAttachmentLine(std::string const& data) { - bool is_filename = boost::starts_with(data, "fontname: ") || boost::starts_with(data, "filename: "); + bool is_filename = data.starts_with("fontname: ") || data.starts_with("filename: "); bool valid_data = data.size() > 0 && data.size() <= 80; for (auto byte : data) { @@ -129,13 +128,13 @@ void AssParser::ParseAttachmentLine(std::string const& data) { } void AssParser::ParseScriptInfoLine(std::string const& data) { - if (boost::starts_with(data, ";")) { + if (data.starts_with(";")) { // Skip stupid comments added by other programs // Of course, we'll add our own in place later... ;) return; } - if (boost::starts_with(data, "ScriptType:")) { + if (data.starts_with("ScriptType:")) { std::string version_str = data.substr(11); boost::trim(version_str); boost::to_lower(version_str); @@ -149,7 +148,7 @@ void AssParser::ParseScriptInfoLine(std::string const& data) { // Nothing actually supports the Collisions property and malformed values // crash VSFilter, so just remove it entirely - if (boost::starts_with(data, "Collisions:")) + if (data.starts_with("Collisions:")) return; size_t pos = data.find(':'); @@ -175,22 +174,22 @@ void AssParser::ParseMetadataLine(std::string const& data) { } void AssParser::ParseEventLine(std::string const& data) { - if (boost::starts_with(data, "Dialogue:") || boost::starts_with(data, "Comment:")) + if (data.starts_with("Dialogue:") || data.starts_with("Comment:")) target->Events.push_back(*new AssDialogue(data)); } void AssParser::ParseStyleLine(std::string const& data) { - if (boost::starts_with(data, "Style:")) + if (data.starts_with("Style:")) target->Styles.push_back(*new AssStyle(data, version)); } void AssParser::ParseFontLine(std::string const& data) { - if (boost::starts_with(data, "fontname: ")) + if (data.starts_with("fontname: ")) attach = std::make_unique(data, AssEntryGroup::FONT); } void AssParser::ParseGraphicsLine(std::string const& data) { - if (boost::starts_with(data, "filename: ")) + if (data.starts_with("filename: ")) attach = std::make_unique(data, AssEntryGroup::GRAPHIC); } diff --git a/src/command/edit.cpp b/src/command/edit.cpp index c1778bd8fd..bd32e36442 100644 --- a/src/command/edit.cpp +++ b/src/command/edit.cpp @@ -819,7 +819,7 @@ struct edit_line_join_keep_first final : public validate_sel_multiple { static bool try_paste_lines(agi::Context *c) { std::string data = GetClipboard(); boost::trim_left(data); - if (!boost::starts_with(data, "Dialogue:")) return false; + if (!data.starts_with("Dialogue:")) return false; EntryList parsed; boost::char_separator sep("\r\n"); @@ -944,7 +944,7 @@ void expand_times(AssDialogue *src, AssDialogue *dst) { } bool check_start(AssDialogue *d1, AssDialogue *d2) { - if (boost::starts_with(d1->Text.get(), d2->Text.get())) { + if (d1->Text.get().starts_with(d2->Text.get())) { d1->Text = trim_text(d1->Text.get().substr(d2->Text.get().size())); expand_times(d1, d2); return true; @@ -953,7 +953,7 @@ bool check_start(AssDialogue *d1, AssDialogue *d2) { } bool check_end(AssDialogue *d1, AssDialogue *d2) { - if (boost::ends_with(d1->Text.get(), d2->Text.get())) { + if (d1->Text.get().ends_with(d2->Text.get())) { d1->Text = trim_text(d1->Text.get().substr(0, d1->Text.get().size() - d2->Text.get().size())); expand_times(d1, d2); return true; diff --git a/src/command/video.cpp b/src/command/video.cpp index d60777afb1..f1133628ca 100644 --- a/src/command/video.cpp +++ b/src/command/video.cpp @@ -56,7 +56,6 @@ #include #include -#include #include #include #include @@ -475,12 +474,12 @@ static void save_snapshot(agi::Context *c, bool raw, bool subsonly = false) { agi::fs::path basepath; auto videoname = c->project->VideoName(); - bool is_dummy = boost::starts_with(videoname.string(), "?dummy"); + bool is_dummy = videoname.string().starts_with("?dummy"); // Is it a path specifier and not an actual fixed path? if (option[0] == '?') { // If dummy video is loaded, we can't save to the video location - if (boost::starts_with(option, "?video") && is_dummy) { + if (option.starts_with("?video") && is_dummy) { // So try the script location instead option = "?script"; } diff --git a/src/resolution_resampler.cpp b/src/resolution_resampler.cpp index b71f3a6575..f08c6124d8 100644 --- a/src/resolution_resampler.cpp +++ b/src/resolution_resampler.cpp @@ -28,7 +28,6 @@ #include #include -#include #include #include @@ -157,7 +156,7 @@ namespace { } void resample_line(resample_state *state, AssDialogue &diag) { - if (diag.Comment && (boost::starts_with(diag.Effect.get(), "template") || boost::starts_with(diag.Effect.get(), "code"))) + if (diag.Comment && (diag.Effect.get().starts_with("template") || diag.Effect.get().starts_with("code"))) return; auto blocks = diag.ParseTags(); diff --git a/src/subtitle_format_txt.cpp b/src/subtitle_format_txt.cpp index ec89de929f..569ae5831f 100644 --- a/src/subtitle_format_txt.cpp +++ b/src/subtitle_format_txt.cpp @@ -80,12 +80,12 @@ void TXTSubtitleFormat::ReadFile(AssFile *target, agi::fs::path const& filename, if (value.empty() && !OPT_GET("Tool/Import/Text/Include Blank")->GetBool()) continue; // Check if this isn't a timecodes file - if (boost::starts_with(value, "# timecode")) + if (value.starts_with("# timecode")) throw SubtitleFormatParseError("File is a timecode file, cannot load as subtitles."); // Read comment data bool isComment = false; - if (!comment.empty() && boost::starts_with(value, comment)) { + if (!comment.empty() && value.starts_with(comment)) { isComment = true; value.erase(0, comment.size()); } diff --git a/src/text_file_reader.cpp b/src/text_file_reader.cpp index 30070f6c15..f12615ca20 100644 --- a/src/text_file_reader.cpp +++ b/src/text_file_reader.cpp @@ -18,7 +18,6 @@ #include -#include #include #include @@ -38,7 +37,7 @@ std::string TextFileReader::ReadLineFromFile() { ++iter; if (trim) boost::trim(str); - if (boost::starts_with(str, "\xEF\xBB\xBF")) + if (str.starts_with("\xEF\xBB\xBF")) str.erase(0, 3); return str; } diff --git a/src/video_provider_dummy.cpp b/src/video_provider_dummy.cpp index e867d88a01..10ab904774 100644 --- a/src/video_provider_dummy.cpp +++ b/src/video_provider_dummy.cpp @@ -42,7 +42,6 @@ #include #include -#include #include #include @@ -129,7 +128,7 @@ void DummyVideoProvider::GetFrame(int, VideoFrame &frame) { namespace agi { class BackgroundRunner; } std::unique_ptr CreateDummyVideoProvider(agi::fs::path const& filename, std::string_view, agi::BackgroundRunner *) { // Use filename.generic_string here so forward slashes stay as they are - if (!boost::starts_with(filename.generic_string(), "?dummy")) + if (!filename.generic_string().starts_with("?dummy")) return {}; std::vector toks;