Remove Strings::is_empty(). Use std::string.empty()

This commit is contained in:
Alexander Karatarakis 2017-08-29 16:20:21 -07:00
parent d1d01075ad
commit 5337adf107
5 changed files with 6 additions and 12 deletions

View File

@ -39,9 +39,6 @@ namespace vcpkg::Strings
static constexpr const char* EMPTY = "";
static constexpr const wchar_t* WEMPTY = L"";
bool is_empty(const CStringView s);
bool is_empty(const CWStringView s);
template<class... Args>
std::string format(const char* fmtstr, const Args&... args)
{

View File

@ -89,7 +89,7 @@ namespace vcpkg
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());
}

View File

@ -443,7 +443,7 @@ namespace vcpkg::Dependencies
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
return mark_plus("core", cluster, graph, graph_plan);
@ -551,7 +551,7 @@ namespace vcpkg::Dependencies
auto& status_paragraph_feature = status_paragraph->package.feature;
// 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");
}
@ -573,7 +573,7 @@ namespace vcpkg::Dependencies
auto& dep_cluster = graph.get(dependency.spec());
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];
target_node.remove_edges.emplace_back(FeatureSpec{spec, status_paragraph_feature});

View File

@ -71,9 +71,6 @@ namespace vcpkg::Strings::details
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_convert<std::codecvt_utf8_utf16<wchar_t>, wchar_t> conversion;
@ -133,7 +130,7 @@ namespace vcpkg::Strings
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)

View File

@ -189,7 +189,7 @@ namespace vcpkg
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;
}