Rename VcpkgStringRange -> StringRange
MODIFY
include/vcpkg/base/stringrange.h
include/vcpkg/base/stringrange.h
namespace vcpkg
{
- struct VcpkgStringRange
+ struct StringRange
{
- static std::vector<VcpkgStringRange> find_all_enclosed(const VcpkgStringRange& input,
+ static std::vector<StringRange> find_all_enclosed(const StringRange& input,
const std::string& left_delim,
const std::string& right_delim);
- static VcpkgStringRange find_exactly_one_enclosed(const VcpkgStringRange& input,
+ static StringRange find_exactly_one_enclosed(const StringRange& input,
const std::string& left_tag,
const std::string& right_tag);
- static Optional<VcpkgStringRange> find_at_most_one_enclosed(const VcpkgStringRange& input,
+ static Optional<StringRange> find_at_most_one_enclosed(const StringRange& input,
const std::string& left_tag,
const std::string& right_tag);
- VcpkgStringRange() = default;
- VcpkgStringRange(const std::string& s); // Implicit by design
- VcpkgStringRange(const std::string::const_iterator begin, const std::string::const_iterator end);
+ StringRange() = default;
+ StringRange(const std::string& s); // Implicit by design
+ StringRange(const std::string::const_iterator begin, const std::string::const_iterator end);
std::string::const_iterator begin;
std::string::const_iterator end;

MODIFY
src/vcpkg/base/stringrange.cpp
src/vcpkg/base/stringrange.cpp
namespace vcpkg
{
- std::vector<VcpkgStringRange> VcpkgStringRange::find_all_enclosed(const VcpkgStringRange& input,
+ std::vector<StringRange> StringRange::find_all_enclosed(const StringRange& input,
const std::string& left_delim,
const std::string& right_delim)
{
std::string::const_iterator it_left = input.begin;
std::string::const_iterator it_right = input.begin;
- std::vector<VcpkgStringRange> output;
+ std::vector<StringRange> output;
while (true)
{
@@ -32,11 +32,11 @@ namespace vcpkg
return output;
}
- VcpkgStringRange VcpkgStringRange::find_exactly_one_enclosed(const VcpkgStringRange& input,
+ StringRange StringRange::find_exactly_one_enclosed(const StringRange& input,
const std::string& left_tag,
const std::string& right_tag)
{
- std::vector<VcpkgStringRange> result = find_all_enclosed(input, left_tag, right_tag);
+ std::vector<StringRange> result = find_all_enclosed(input, left_tag, right_tag);
Checks::check_exit(VCPKG_LINE_INFO,
result.size() == 1,
"Found %d sets of %s.*%s but expected exactly 1, in block:\n%s",
@@ -47,11 +47,11 @@ namespace vcpkg
return result.front();
}
- Optional<VcpkgStringRange> VcpkgStringRange::find_at_most_one_enclosed(const VcpkgStringRange& input,
+ Optional<StringRange> StringRange::find_at_most_one_enclosed(const StringRange& input,
const std::string& left_tag,
const std::string& right_tag)
{
- std::vector<VcpkgStringRange> result = find_all_enclosed(input, left_tag, right_tag);
+ std::vector<StringRange> result = find_all_enclosed(input, left_tag, right_tag);
Checks::check_exit(VCPKG_LINE_INFO,
result.size() <= 1,
"Found %d sets of %s.*%s but expected at most 1, in block:\n%s",
@@ -68,12 +68,12 @@ namespace vcpkg
return result.front();
}
- VcpkgStringRange::VcpkgStringRange(const std::string& s) : begin(s.cbegin()), end(s.cend()) {}
+ StringRange::StringRange(const std::string& s) : begin(s.cbegin()), end(s.cend()) {}
- VcpkgStringRange::VcpkgStringRange(const std::string::const_iterator begin, const std::string::const_iterator end)
+ StringRange::StringRange(const std::string::const_iterator begin, const std::string::const_iterator end)
: begin(begin), end(end)
{
}
- std::string VcpkgStringRange::to_string() const { return std::string(this->begin, this->end); }
+ std::string StringRange::to_string() const { return std::string(this->begin, this->end); }
}

MODIFY
src/vcpkg/commands.fetch.cpp
src/vcpkg/commands.fetch.cpp
@@ -83,16 +83,15 @@ namespace vcpkg::Commands::Fetch
XML_PATH.generic_string());
const std::string tool_data =
- VcpkgStringRange::find_exactly_one_enclosed(XML, match_tool_entry[0], "</tool>").to_string();
+ StringRange::find_exactly_one_enclosed(XML, match_tool_entry[0], "</tool>").to_string();
const std::string version_as_string =
- VcpkgStringRange::find_exactly_one_enclosed(tool_data, "<version>", "</version>").to_string();
+ StringRange::find_exactly_one_enclosed(tool_data, "<version>", "</version>").to_string();
const std::string exe_relative_path =
- VcpkgStringRange::find_exactly_one_enclosed(tool_data, "<exeRelativePath>", "</exeRelativePath>")
- .to_string();
- const std::string url = VcpkgStringRange::find_exactly_one_enclosed(tool_data, "<url>", "</url>").to_string();
+ StringRange::find_exactly_one_enclosed(tool_data, "<exeRelativePath>", "</exeRelativePath>").to_string();
+ const std::string url = StringRange::find_exactly_one_enclosed(tool_data, "<url>", "</url>").to_string();
const std::string sha512 =
- VcpkgStringRange::find_exactly_one_enclosed(tool_data, "<sha512>", "</sha512>").to_string();
- auto archive_name = VcpkgStringRange::find_at_most_one_enclosed(tool_data, "<archiveName>", "</archiveName>");
+ StringRange::find_exactly_one_enclosed(tool_data, "<sha512>", "</sha512>").to_string();
+ auto archive_name = StringRange::find_at_most_one_enclosed(tool_data, "<archiveName>", "</archiveName>");
const Optional<std::array<int, 3>> version = parse_version_string(version_as_string);
Checks::check_exit(VCPKG_LINE_INFO,

MODIFY
src/vcpkg/visualstudio.cpp
src/vcpkg/visualstudio.cpp
@@ -73,11 +73,11 @@ namespace vcpkg::VisualStudio
code_and_output.output);
const auto instance_entries =
- VcpkgStringRange::find_all_enclosed(code_and_output.output, "<instance>", "</instance>");
- for (const VcpkgStringRange& instance : instance_entries)
+ StringRange::find_all_enclosed(code_and_output.output, "<instance>", "</instance>");
+ for (const StringRange& instance : instance_entries)
{
auto maybe_is_prerelease =
- VcpkgStringRange::find_at_most_one_enclosed(instance, "<isPrerelease>", "</isPrerelease>");
+ StringRange::find_at_most_one_enclosed(instance, "<isPrerelease>", "</isPrerelease>");
VisualStudioInstance::ReleaseType release_type = VisualStudioInstance::ReleaseType::LEGACY;
if (const auto p = maybe_is_prerelease.get())
@@ -92,10 +92,9 @@ namespace vcpkg::VisualStudio
}
instances.emplace_back(
- VcpkgStringRange::find_exactly_one_enclosed(instance, "<installationPath>", "</installationPath>")
+ StringRange::find_exactly_one_enclosed(instance, "<installationPath>", "</installationPath>")
.to_string(),
- VcpkgStringRange::find_exactly_one_enclosed(
- instance, "<installationVersion>", "</installationVersion>")
+ StringRange::find_exactly_one_enclosed(instance, "<installationVersion>", "</installationVersion>")
.to_string(),
release_type);
}

Rename VcpkgStringRange -> StringRange