diff --git a/src/catalog.cpp b/src/catalog.cpp index a8664bc6d2..43f8d57b23 100644 --- a/src/catalog.cpp +++ b/src/catalog.cpp @@ -706,7 +706,7 @@ bool Catalog::HasSourcesAvailable() const auto root = GetSourcesRootPath(); if (root == wxGetUserHome() || root == wxStandardPaths::Get().GetDocumentsDir() || - root.EndsWith(wxString(wxFILE_SEP_PATH) + "Desktop" + wxFILE_SEP_PATH)) + root.ends_with(wxString(wxFILE_SEP_PATH) + "Desktop" + wxFILE_SEP_PATH)) { return false; } @@ -850,7 +850,7 @@ wxString CatalogItem::GetFormatFlag() const auto format = (space == wxString::npos) ? m_moreFlags.substr(0, pos) : m_moreFlags.substr(space+1, pos-space-1); - if (format.StartsWith("no-")) + if (format.starts_with("no-")) return wxString(); return format; } @@ -977,9 +977,9 @@ wxString CatalogItem::GetOldMsgid() const line.RemoveLast(); if (line[0] == '"') line.Remove(0, 1); - if (line.StartsWith("msgid \"")) + if (line.starts_with("msgid \"")) line.Remove(0, 7); - else if (line.StartsWith("msgid_plural \"")) + else if (line.starts_with("msgid_plural \"")) line.replace(0, 14, "\n"); s += UnescapeCString(line); } diff --git a/src/catalog_po.cpp b/src/catalog_po.cpp index 21ec41fc2c..dbdd483dbc 100644 --- a/src/catalog_po.cpp +++ b/src/catalog_po.cpp @@ -533,9 +533,9 @@ wxString POCatalogParser::ReadTextLine() // gettext tools don't include (extracted) comments in wrapping, so they can't // be reliably used to detect file's wrapping either; just skip them. - if (!ln.StartsWith(wxS("#. ")) && !ln.StartsWith(wxS("# "))) + if (!ln.starts_with(wxS("#. ")) && !ln.starts_with(wxS("# "))) { - if (ln.EndsWith(wxS("\\n\""))) + if (ln.ends_with(wxS("\\n\""))) { // Similarly, lines ending with \n are always wrapped, so skip that too. m_lastLineHardWrapped = true; @@ -737,7 +737,7 @@ bool POLoadParser::OnEntry(const wxString& msgid, // https://groups.google.com/d/topic/poedit/j41KuvXtVUU/discussion // As a workaround, just filter them out. // FIXME: Fix this properly... but not using msgcat in the first place - if (i.StartsWith(MSGCAT_CONFLICT_MARKER) && i.EndsWith(MSGCAT_CONFLICT_MARKER)) + if (i.starts_with(MSGCAT_CONFLICT_MARKER) && i.ends_with(MSGCAT_CONFLICT_MARKER)) continue; d->AddExtractedComments(i); } @@ -1015,7 +1015,7 @@ void POCatalog::FixupCommonIssues() if (!pluralForms.empty()) { - if (!pluralForms.EndsWith(";")) + if (!pluralForms.ends_with(";")) { pluralForms += ";"; m_header.SetHeader("Plural-Forms", pluralForms); diff --git a/src/cloud_accounts_ui.cpp b/src/cloud_accounts_ui.cpp index 56b5df46ef..0e01b78ae8 100644 --- a/src/cloud_accounts_ui.cpp +++ b/src/cloud_accounts_ui.cpp @@ -852,7 +852,7 @@ bool ShouldSyncToCloudAutomatically(CatalogPtr catalog) wxFileName f(catalog->GetFileName()); f.MakeAbsolute(); - return f.GetFullPath().StartsWith(root.GetFullPath()); + return f.GetFullPath().starts_with(root.GetFullPath()); } diff --git a/src/customcontrols.cpp b/src/customcontrols.cpp index dda676f2f8..71a06f965c 100644 --- a/src/customcontrols.cpp +++ b/src/customcontrols.cpp @@ -457,7 +457,7 @@ ImageButton::ImageButton(wxWindow *parent, const wxString& bitmapName) view.buttonType = NSButtonTypeMomentaryChange; #else // refresh template icons on theme change (macOS handles automatically): - if (bitmapName.EndsWith("Template")) + if (bitmapName.ends_with("Template")) { ColorScheme::SetupWindowColors(this, [=] { @@ -475,7 +475,7 @@ StaticBitmap::StaticBitmap(wxWindow *parent, const wxString& bitmapName) { #ifndef __WXOSX__ // refresh template icons on theme change (macOS handles automatically): - if (bitmapName.EndsWith("Template")) + if (bitmapName.ends_with("Template")) { ColorScheme::SetupWindowColors(this, [=] { diff --git a/src/edapp.cpp b/src/edapp.cpp index fd7608f7b9..49290c17b9 100644 --- a/src/edapp.cpp +++ b/src/edapp.cpp @@ -757,7 +757,7 @@ int PoeditApp::OpenFiles(const wxArrayString& names, int lineno) // associated with it, so that the app can provide explanation to users // not familiar with the MO/PO distinction. auto n = name.Lower(); - if (n.EndsWith(".mo") || n.EndsWith(".gmo")) + if (n.ends_with(".mo") || n.ends_with(".gmo")) { wxMessageDialog dlg(nullptr, _(L"MO files can’t be directly edited in Poedit."), @@ -852,7 +852,7 @@ bool PoeditApp::OnCmdLineParsed(wxCmdLineParser& parser) for (size_t i = 0; i < parser.GetParamCount(); i++) { auto fn = parser.GetParam(i); - if (fn.StartsWith("poedit://")) + if (fn.starts_with("poedit://")) client.HandleCustomURI(fn); else client.OpenFile(fn, (int)lineno); @@ -880,7 +880,7 @@ bool PoeditApp::OnCmdLineParsed(wxCmdLineParser& parser) for (size_t i = 0; i < parser.GetParamCount(); i++) { auto fn = parser.GetParam(i); - if (fn.StartsWith("poedit://")) + if (fn.starts_with("poedit://")) { gs_uriToHandle = fn; } @@ -902,7 +902,7 @@ bool PoeditApp::OnCmdLineParsed(wxCmdLineParser& parser) void PoeditApp::HandleCustomURI(const wxString& uri) { - if (!uri.StartsWith("poedit://")) + if (!uri.starts_with("poedit://")) return; #ifdef HAVE_HTTP_CLIENT diff --git a/src/edframe.cpp b/src/edframe.cpp index c1f34e4991..f8945aa501 100644 --- a/src/edframe.cpp +++ b/src/edframe.cpp @@ -2369,7 +2369,7 @@ void PoeditFrame::FixDuplicatesIfPresent() wxString generator = cat->Header().GetHeader("X-Generator"); wxString gversion; if (generator.StartsWith("Poedit ", &gversion) && - !gversion.StartsWith("1.7") && !gversion.StartsWith("1.6") && !gversion.StartsWith("1.5")) + !gversion.starts_with("1.7") && !gversion.starts_with("1.6") && !gversion.starts_with("1.5")) return; if (!cat->HasDuplicateItems()) diff --git a/src/extractors/extractor.cpp b/src/extractors/extractor.cpp index 3dddfc8984..32f4a1cf29 100644 --- a/src/extractors/extractor.cpp +++ b/src/extractors/extractor.cpp @@ -50,7 +50,7 @@ struct PathToMatch if (isWildcard) return wxMatchWild(path, fn); else - return fn == path || fn.StartsWith(path + "/"); + return fn == path || fn.starts_with(path + "/"); } }; diff --git a/src/extractors/extractor_gettext.cpp b/src/extractors/extractor_gettext.cpp index aebb3a2a8c..84375a523c 100644 --- a/src/extractors/extractor_gettext.cpp +++ b/src/extractors/extractor_gettext.cpp @@ -220,7 +220,7 @@ void Extractor::CreateGettextExtractors(Extractor::ExtractorsList& into, const S for (auto& m : sources.TypeMapping) { - if (m.second.StartsWith("gettext:")) // e.g. gettext:php + if (m.second.starts_with("gettext:")) // e.g. gettext:php { auto e = std::make_shared(m.second.AfterFirst(':')); if (wxIsWild(m.first)) diff --git a/src/gexecute.cpp b/src/gexecute.cpp index b28a0b13dc..9dc781fc2b 100644 --- a/src/gexecute.cpp +++ b/src/gexecute.cpp @@ -179,7 +179,7 @@ void LogUnrecognizedError(const wxString& err) // Warning: Failed to set locale category LC_NUMERIC to de. // Warning: Failed to set locale category LC_TIME to de. // ...etc... - if (err.StartsWith("Warning: Failed to set locale category")) + if (err.starts_with("Warning: Failed to set locale category")) return; #endif // __WXOSX__ diff --git a/src/icons.cpp b/src/icons.cpp index b1ed3ec06b..3ac7be891c 100644 --- a/src/icons.cpp +++ b/src/icons.cpp @@ -233,7 +233,7 @@ wxBitmap PoeditArtProvider::CreateBitmap(const wxArtID& id_, return wxNullBitmap; } - if (id.EndsWith("Template")) + if (id.ends_with("Template")) ProcessTemplateImage(icon.image, opaqueVariant, invertedVariant); if (disabledVariant) diff --git a/src/propertiesdlg.cpp b/src/propertiesdlg.cpp index b35f54f361..b17a375792 100644 --- a/src/propertiesdlg.cpp +++ b/src/propertiesdlg.cpp @@ -944,7 +944,7 @@ void PropertiesDialog::TransferFrom(const CatalogPtr& cat) else { auto pluralForms = bidi::strip_control_chars(m_pluralFormsExpr->GetValue().Strip(wxString::both)); - if (!pluralForms.empty() && !pluralForms.EndsWith(";")) + if (!pluralForms.empty() && !pluralForms.ends_with(";")) pluralForms += ";"; cat->Header().SetHeaderNotEmpty("Plural-Forms", pluralForms); } diff --git a/src/qa_checks.cpp b/src/qa_checks.cpp index 1fab8a1589..c23cec4876 100644 --- a/src/qa_checks.cpp +++ b/src/qa_checks.cpp @@ -367,7 +367,7 @@ class PunctuationMismatch : public QACheck } else if (!s_punct && t_punct) { - if (t_last == '.' && (source.EndsWith("st") || source.EndsWith("nd") || source.EndsWith("th"))) + if (t_last == '.' && (source.ends_with("st") || source.ends_with("nd") || source.ends_with("th"))) { // special-case English ordinals to languages that use [number]. } @@ -380,7 +380,7 @@ class PunctuationMismatch : public QACheck } else if (s_punct && t_punct && s_last != t_last) { - if (IsEquivalent(L'…', t_last) && source.EndsWith("...")) + if (IsEquivalent(L'…', t_last) && source.ends_with("...")) { // as a special case, allow translating ... (3 dots) as … (ellipsis) } diff --git a/src/recent_files.cpp b/src/recent_files.cpp index 3bfe28125a..a7351716cc 100644 --- a/src/recent_files.cpp +++ b/src/recent_files.cpp @@ -208,13 +208,13 @@ wxString pretty_print_path(wxFileName f) auto cloud = wxFileName::DirName(PoeditApp::GetCacheDir("Cloud")); cloud.ReplaceHomeDir(); - if (path.StartsWith(cloud.GetFullPath())) + if (path.starts_with(cloud.GetFullPath())) path = _("Cloud") + L" → " + path.substr(cloud.GetFullPath().length()); #ifdef __WXMSW__ // ReplaceHomeDir() puts tilde at the beginning to replace $HOME, but this is uncommon on Windows, // so remove it and just use plain path: - if (path.StartsWith("~\\")) + if (path.starts_with("~\\")) path = path.substr(2); #endif diff --git a/src/sidebar.cpp b/src/sidebar.cpp index c87555ca9c..5d93c4d99a 100644 --- a/src/sidebar.cpp +++ b/src/sidebar.cpp @@ -174,7 +174,7 @@ class ExtractedCommentSidebarBlock : public SidebarBlock void Update(const CatalogItemPtr& item) override { auto comment = wxJoin(item->GetExtractedComments(), '\n', '\0'); - if (comment.StartsWith("TRANSLATORS:") || comment.StartsWith("translators:")) + if (comment.starts_with("TRANSLATORS:") || comment.starts_with("translators:")) { comment.Remove(0, 12); if (!comment.empty() && comment[0] == ' ')