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:
@@ -268,6 +268,11 @@ string_set Package::tags() const
|
|||||||
{
|
{
|
||||||
return m_tags;
|
return m_tags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Package::hasTag(const std::string& tag) const
|
||||||
|
{
|
||||||
|
return m_tags.find(tag) != m_tags.end();
|
||||||
|
}
|
||||||
|
|
||||||
SGPropertyNode* Package::properties() const
|
SGPropertyNode* Package::properties() const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -142,6 +142,13 @@ public:
|
|||||||
|
|
||||||
string_set tags() const;
|
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
|
* download URLs for the package
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user