aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Karatarakis <alkarata@microsoft.com>2018-06-19 17:52:20 -0700
committerAlexander Karatarakis <alkarata@microsoft.com>2018-06-19 23:07:31 -0700
commit31374871f2011b419a0aed09ad16201037230b15 (patch)
treef7572571aad52a2b6cc66d1e268efe17ff137a18
parentc256ccf4526decec0422d8fc9d91ceb8fcf6160b (diff)
downloadvcpkg-31374871f2011b419a0aed09ad16201037230b15.tar.gz
vcpkg-31374871f2011b419a0aed09ad16201037230b15.zip
Rename VcpkgStringRange -> StringRange
-rw-r--r--toolsrc/include/vcpkg/base/stringrange.h26
-rw-r--r--toolsrc/src/vcpkg/base/stringrange.cpp30
-rw-r--r--toolsrc/src/vcpkg/commands.fetch.cpp13
-rw-r--r--toolsrc/src/vcpkg/visualstudio.cpp11
4 files changed, 39 insertions, 41 deletions
diff --git a/toolsrc/include/vcpkg/base/stringrange.h b/toolsrc/include/vcpkg/base/stringrange.h
index 94bd584af..6126ec48f 100644
--- a/toolsrc/include/vcpkg/base/stringrange.h
+++ b/toolsrc/include/vcpkg/base/stringrange.h
@@ -7,23 +7,23 @@
namespace vcpkg
{
- struct VcpkgStringRange
+ struct StringRange
{
- static std::vector<VcpkgStringRange> find_all_enclosed(const VcpkgStringRange& input,
- const std::string& left_delim,
- const std::string& right_delim);
+ 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,
- const std::string& left_tag,
- const std::string& right_tag);
+ 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,
- const std::string& left_tag,
- const std::string& right_tag);
+ 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;
diff --git a/toolsrc/src/vcpkg/base/stringrange.cpp b/toolsrc/src/vcpkg/base/stringrange.cpp
index 47ed3bf8d..f7e431c88 100644
--- a/toolsrc/src/vcpkg/base/stringrange.cpp
+++ b/toolsrc/src/vcpkg/base/stringrange.cpp
@@ -5,14 +5,14 @@
namespace vcpkg
{
- std::vector<VcpkgStringRange> VcpkgStringRange::find_all_enclosed(const VcpkgStringRange& input,
- const std::string& left_delim,
- const std::string& right_delim)
+ 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,
- const std::string& left_tag,
- const std::string& right_tag)
+ 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,
- const std::string& left_tag,
- const std::string& right_tag)
+ 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); }
}
diff --git a/toolsrc/src/vcpkg/commands.fetch.cpp b/toolsrc/src/vcpkg/commands.fetch.cpp
index 66af4ec48..e3407a632 100644
--- a/toolsrc/src/vcpkg/commands.fetch.cpp
+++ b/toolsrc/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,
diff --git a/toolsrc/src/vcpkg/visualstudio.cpp b/toolsrc/src/vcpkg/visualstudio.cpp
index d5f801f28..9480a11bf 100644
--- a/toolsrc/src/vcpkg/visualstudio.cpp
+++ b/toolsrc/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);
}