Add efficient hasTag check to Package.

Avoids copying the tags set each time to check for presence / absence
of a particular tag.
This commit is contained in:
James Turner
2017-07-18 18:01:50 +01:00
parent fe46ae09ef
commit 2a3bb62001
2 changed files with 12 additions and 0 deletions

View File

@@ -268,6 +268,11 @@ string_set Package::tags() const
{
return m_tags;
}
bool Package::hasTag(const std::string& tag) const
{
return m_tags.find(tag) != m_tags.end();
}
SGPropertyNode* Package::properties() const
{

View File

@@ -142,6 +142,13 @@ public:
string_set tags() const;
/**
* @brief hasTag - efficently check if a tag is defined or not
* @param tag
* @return
*/
bool hasTag(const std::string& tag) const;
/**
* download URLs for the package
*/