diff options
| author | Robert Schumacher <roschuma@microsoft.com> | 2017-10-12 11:22:25 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-10-12 11:22:25 -0700 |
| commit | 85e6b1b36e734c0db50464b07b77589d63c3c875 (patch) | |
| tree | 095289838517a64f06298b1a05ded47a7139d7d9 /toolsrc/src/SourceParagraph.cpp | |
| parent | d7a313c5c356e1641f18cd14ad0ac0c3901bc0bf (diff) | |
| parent | 9c3f9582fb4541a59e4282269e4f6c9c7debcc3e (diff) | |
| download | vcpkg-85e6b1b36e734c0db50464b07b77589d63c3c875.tar.gz vcpkg-85e6b1b36e734c0db50464b07b77589d63c3c875.zip | |
Merge branch 'master' into vtk-components
Diffstat (limited to 'toolsrc/src/SourceParagraph.cpp')
| -rw-r--r-- | toolsrc/src/SourceParagraph.cpp | 33 |
1 files changed, 11 insertions, 22 deletions
diff --git a/toolsrc/src/SourceParagraph.cpp b/toolsrc/src/SourceParagraph.cpp index c69770ae1..0f1a38d19 100644 --- a/toolsrc/src/SourceParagraph.cpp +++ b/toolsrc/src/SourceParagraph.cpp @@ -25,7 +25,7 @@ namespace vcpkg static const std::string VERSION = "Version"; } - static span<const std::string> get_list_of_valid_fields() + static Span<const std::string> get_list_of_valid_fields() { static const std::string valid_fields[] = { Fields::SOURCE, @@ -38,7 +38,7 @@ namespace vcpkg return valid_fields; } - void print_error_message(span<const std::unique_ptr<Parse::ParseControlErrorInfo>> error_info_list) + void print_error_message(Span<const std::unique_ptr<Parse::ParseControlErrorInfo>> error_info_list) { Checks::check_exit(VCPKG_LINE_INFO, error_info_list.size() > 0); @@ -137,7 +137,7 @@ namespace vcpkg auto control_file = std::make_unique<SourceControlFile>(); auto maybe_source = parse_source_paragraph(std::move(control_paragraphs.front())); - if (auto source = maybe_source.get()) + if (const auto source = maybe_source.get()) control_file->core_paragraph = std::move(*source); else return std::move(maybe_source).error(); @@ -147,7 +147,7 @@ namespace vcpkg for (auto&& feature_pgh : control_paragraphs) { auto maybe_feature = parse_feature_paragraph(std::move(feature_pgh)); - if (auto feature = maybe_feature.get()) + if (const auto feature = maybe_feature.get()) control_file->feature_paragraphs.emplace_back(std::move(*feature)); else return std::move(maybe_feature).error(); @@ -170,24 +170,17 @@ namespace vcpkg std::string Dependency::name() const { - std::string str = this->depend.name; - if (this->depend.features.empty()) return str; + if (this->depend.features.empty()) return this->depend.name; - str += "["; - for (auto&& s : this->depend.features) - { - str += s + ","; - } - str.pop_back(); - str += "]"; - return str; + const std::string features = Strings::join(",", this->depend.features); + return Strings::format("%s[%s]", this->depend.name, features); } std::vector<Dependency> vcpkg::expand_qualified_dependencies(const std::vector<std::string>& depends) { return Util::fmap(depends, [&](const std::string& depend_string) -> Dependency { auto pos = depend_string.find(' '); - if (pos == std::string::npos) return Dependency::parse_dependency(depend_string, ""); + if (pos == std::string::npos) return Dependency::parse_dependency(depend_string, Strings::EMPTY); // expect of the form "\w+ \[\w+\]" Dependency dep; @@ -195,7 +188,7 @@ namespace vcpkg if (depend_string.c_str()[pos + 1] != '(' || depend_string[depend_string.size() - 1] != ')') { // Error, but for now just slurp the entire string. - return Dependency::parse_dependency(depend_string, ""); + return Dependency::parse_dependency(depend_string, Strings::EMPTY); } dep.qualifier = depend_string.substr(pos + 2, depend_string.size() - pos - 3); return dep; @@ -220,11 +213,7 @@ namespace vcpkg return FeatureSpec::from_strings_and_triplet(filter_dependencies(deps, t), t); } - const std::string to_string(const Dependency& dep) - { - std::string name = dep.name(); - return name; - } + std::string to_string(const Dependency& dep) { return dep.name(); } ExpectedT<Supports, std::vector<std::string>> Supports::parse(const std::vector<std::string>& strs) { @@ -263,7 +252,7 @@ namespace vcpkg bool Supports::is_supported(Architecture arch, Platform plat, Linkage crt, ToolsetVersion tools) { - auto is_in_or_empty = [](auto v, auto&& c) -> bool { return c.empty() || c.end() != Util::find(c, v); }; + const auto is_in_or_empty = [](auto v, auto&& c) -> bool { return c.empty() || c.end() != Util::find(c, v); }; if (!is_in_or_empty(arch, architectures)) return false; if (!is_in_or_empty(plat, platforms)) return false; if (!is_in_or_empty(crt, crt_linkages)) return false; |
