mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-31 05:03:22 +08:00
Remove Strings::is_empty(). Use std::string.empty()
This commit is contained in:
parent
d1d01075ad
commit
5337adf107
@ -39,9 +39,6 @@ namespace vcpkg::Strings
|
|||||||
static constexpr const char* EMPTY = "";
|
static constexpr const char* EMPTY = "";
|
||||||
static constexpr const wchar_t* WEMPTY = L"";
|
static constexpr const wchar_t* WEMPTY = L"";
|
||||||
|
|
||||||
bool is_empty(const CStringView s);
|
|
||||||
bool is_empty(const CWStringView s);
|
|
||||||
|
|
||||||
template<class... Args>
|
template<class... Args>
|
||||||
std::string format(const char* fmtstr, const Args&... args)
|
std::string format(const char* fmtstr, const Args&... args)
|
||||||
{
|
{
|
||||||
|
@ -89,7 +89,7 @@ namespace vcpkg
|
|||||||
|
|
||||||
std::string BinaryParagraph::displayname() const
|
std::string BinaryParagraph::displayname() const
|
||||||
{
|
{
|
||||||
const auto f = Strings::is_empty(this->feature) ? "core" : this->feature;
|
const auto f = this->feature.empty() ? "core" : this->feature;
|
||||||
return Strings::format("%s[%s]:%s", this->spec.name(), f, this->spec.triplet());
|
return Strings::format("%s[%s]:%s", this->spec.name(), f, this->spec.triplet());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -443,7 +443,7 @@ namespace vcpkg::Dependencies
|
|||||||
|
|
||||||
MarkPlusResult mark_plus(const std::string& feature, Cluster& cluster, ClusterGraph& graph, GraphPlan& graph_plan)
|
MarkPlusResult mark_plus(const std::string& feature, Cluster& cluster, ClusterGraph& graph, GraphPlan& graph_plan)
|
||||||
{
|
{
|
||||||
if (feature == "")
|
if (feature.empty())
|
||||||
{
|
{
|
||||||
// Indicates that core was not specified in the reference
|
// Indicates that core was not specified in the reference
|
||||||
return mark_plus("core", cluster, graph, graph_plan);
|
return mark_plus("core", cluster, graph, graph_plan);
|
||||||
@ -551,7 +551,7 @@ namespace vcpkg::Dependencies
|
|||||||
|
|
||||||
auto& status_paragraph_feature = status_paragraph->package.feature;
|
auto& status_paragraph_feature = status_paragraph->package.feature;
|
||||||
// In this case, empty string indicates the "core" paragraph for a package.
|
// In this case, empty string indicates the "core" paragraph for a package.
|
||||||
if (status_paragraph_feature == "")
|
if (status_paragraph_feature.empty())
|
||||||
{
|
{
|
||||||
cluster.original_features.insert("core");
|
cluster.original_features.insert("core");
|
||||||
}
|
}
|
||||||
@ -573,7 +573,7 @@ namespace vcpkg::Dependencies
|
|||||||
auto& dep_cluster = graph.get(dependency.spec());
|
auto& dep_cluster = graph.get(dependency.spec());
|
||||||
|
|
||||||
auto depends_name = dependency.feature();
|
auto depends_name = dependency.feature();
|
||||||
if (depends_name == "") depends_name = "core";
|
if (depends_name.empty()) depends_name = "core";
|
||||||
|
|
||||||
auto& target_node = dep_cluster.edges[depends_name];
|
auto& target_node = dep_cluster.edges[depends_name];
|
||||||
target_node.remove_edges.emplace_back(FeatureSpec{spec, status_paragraph_feature});
|
target_node.remove_edges.emplace_back(FeatureSpec{spec, status_paragraph_feature});
|
||||||
|
@ -71,9 +71,6 @@ namespace vcpkg::Strings::details
|
|||||||
|
|
||||||
namespace vcpkg::Strings
|
namespace vcpkg::Strings
|
||||||
{
|
{
|
||||||
bool is_empty(const CStringView s) { return s == EMPTY; }
|
|
||||||
bool is_empty(const CWStringView s) { return s == WEMPTY; }
|
|
||||||
|
|
||||||
std::wstring to_utf16(const CStringView s)
|
std::wstring to_utf16(const CStringView s)
|
||||||
{
|
{
|
||||||
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>, wchar_t> conversion;
|
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>, wchar_t> conversion;
|
||||||
@ -133,7 +130,7 @@ namespace vcpkg::Strings
|
|||||||
trim(&s);
|
trim(&s);
|
||||||
}
|
}
|
||||||
|
|
||||||
Util::erase_remove_if(*strings, [](const std::string& s) { return Strings::is_empty(s); });
|
Util::erase_remove_if(*strings, [](const std::string& s) { return s.empty(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> split(const std::string& s, const std::string& delimiter)
|
std::vector<std::string> split(const std::string& s, const std::string& delimiter)
|
||||||
|
@ -189,7 +189,7 @@ namespace vcpkg
|
|||||||
|
|
||||||
for (const std::unique_ptr<StatusParagraph>& pgh : status_db)
|
for (const std::unique_ptr<StatusParagraph>& pgh : status_db)
|
||||||
{
|
{
|
||||||
if (pgh->state != InstallState::INSTALLED || !Strings::is_empty(pgh->package.feature))
|
if (pgh->state != InstallState::INSTALLED || !pgh->package.feature.empty())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user