Commit 3d591980 authored by T.J. Corona's avatar T.J. Corona

In keeping with C++ standards, use 'contains' in favor of 'has'

parent 6be03923
......@@ -168,23 +168,23 @@ struct tuple_index<T, std::tuple<U, Types...> >
/// not the type is in the tuple.
///
/// Examples:
/// tuple_has<bool, std::tuple<int, bool, float>>() == true
/// tuple_has<bool, std::tuple<int, float>>() == false
/// tuple_contains<bool, std::tuple<int, bool, float>>() == true
/// tuple_contains<bool, std::tuple<int, float>>() == false
template <typename T, typename Tuple>
struct tuple_has;
struct tuple_contains;
template <typename T>
struct tuple_has<T, std::tuple<> > : std::false_type
struct tuple_contains<T, std::tuple<> > : std::false_type
{
};
template <typename T, typename U, typename... Ts>
struct tuple_has<T, std::tuple<U, Ts...> > : tuple_has<T, std::tuple<Ts...> >
struct tuple_contains<T, std::tuple<U, Ts...> > : tuple_contains<T, std::tuple<Ts...> >
{
};
template <typename T, typename... Ts>
struct tuple_has<T, std::tuple<T, Ts...> > : std::true_type
struct tuple_contains<T, std::tuple<T, Ts...> > : std::true_type
{
};
......
......@@ -357,12 +357,12 @@ bool Attribute::removeExpungedEntities(const smtk::model::EntityRefs& expungedEn
bool Attribute::isObjectAssociated(const smtk::common::UUID& entity) const
{
return m_associatedObjects ? m_associatedObjects->has(entity) : false;
return m_associatedObjects ? m_associatedObjects->contains(entity) : false;
}
bool Attribute::isObjectAssociated(const smtk::resource::PersistentObjectPtr& comp) const
{
return m_associatedObjects ? m_associatedObjects->has(comp) : false;
return m_associatedObjects ? m_associatedObjects->contains(comp) : false;
}
/**\brief Is the model \a entity associated with this attribute?
......@@ -379,7 +379,7 @@ bool Attribute::isEntityAssociated(const smtk::common::UUID& entity) const
bool Attribute::isEntityAssociated(const smtk::model::EntityRef& entityref) const
{
auto comp = entityref.component();
return (comp && m_associatedObjects) ? m_associatedObjects->has(comp) : false;
return (comp && m_associatedObjects) ? m_associatedObjects->contains(comp) : false;
}
/**\brief Return the associated model entities as a set of UUIDs.
......
......@@ -72,7 +72,7 @@ bool ModelEntityItem::appendValue(const smtk::model::EntityRef& val)
/**\brief
*
*/
bool ModelEntityItem::has(const smtk::model::EntityRef& entity) const
bool ModelEntityItem::contains(const smtk::model::EntityRef& entity) const
{
return this->find(entity.entityRecord()) >= 0;
}
......
......@@ -65,7 +65,7 @@ public:
bool appendValue(const smtk::model::EntityRef& val);
bool has(const smtk::model::EntityRef& entity) const;
bool contains(const smtk::model::EntityRef& entity) const;
std::ptrdiff_t find(const smtk::model::EntityRef& entity) const;
......
......@@ -321,18 +321,14 @@ std::size_t ReferenceItem::maxNumberOfValues() const
return def->maxNumberOfValues();
}
bool ReferenceItem::contains(const smtk::resource::PersistentObjectPtr& obj) const
bool ReferenceItem::contains(const smtk::common::UUID& entity) const
{
bool doesContain = false;
this->visit([&](const PersistentObjectPtr& other) {
if (other == obj)
{
doesContain = true;
return false; // stop iterating
}
return true; // keep iterating
});
return doesContain;
return this->find(entity) >= 0;
}
bool ReferenceItem::contains(const PersistentObjectPtr& entity) const
{
return this->find(entity) >= 0;
}
void ReferenceItem::visit(std::function<bool(const PersistentObjectPtr&)> visitor) const
......@@ -581,16 +577,6 @@ bool ReferenceItem::isExtensible() const
return def->isExtensible();
}
bool ReferenceItem::has(const smtk::common::UUID& entity) const
{
return this->find(entity) >= 0;
}
bool ReferenceItem::has(const PersistentObjectPtr& entity) const
{
return this->find(entity) >= 0;
}
ReferenceItem::const_iterator ReferenceItem::begin() const
{
this->resolve();
......
......@@ -145,6 +145,9 @@ public:
/// Return true if the ReferenceItem contains a reference to the given object.
bool contains(const smtk::resource::PersistentObjectPtr& obj) const;
/// Return true if the component is contained in this item; false otherwise.
bool contains(const smtk::common::UUID& compId) const;
/**\brief Invoke a method on each value of this item.
*
* If the lambda returns false, iteration will terminate immediately.
......@@ -273,11 +276,6 @@ public:
/// A convenience method returning whether the item's definition is extensible.
bool isExtensible() const;
/// Return true if the component is contained in this item; false otherwise.
bool has(const smtk::common::UUID& compId) const;
/// Return true if \a obj is contained in this item; false otherwise.
bool has(const PersistentObjectPtr& obj) const;
/**\brief Return an iterator to the first model-entity value in this item.
*
*/
......
......@@ -55,7 +55,7 @@ public:
bool remove(const std::string& value) { return m_values.erase(value) > 0; }
bool has(const std::string& value) const { return m_values.find(value) != m_values.end(); }
bool contains(const std::string& value) const { return m_values.find(value) != m_values.end(); }
bool operator<(const Tag& rhs) const { return m_name < rhs.m_name; }
......
......@@ -31,12 +31,12 @@ PySharedPtrClass< smtk::attribute::ComponentItem, smtk::attribute::ReferenceItem
.def("appendValue", &smtk::attribute::ComponentItem::appendValue, py::arg("val"))
.def("assign", &smtk::attribute::ComponentItem::assign, py::arg("sourceItem"), py::arg("options") = 0)
.def("begin", &smtk::attribute::ComponentItem::begin)
.def("contains", (bool (smtk::attribute::ComponentItem::*)(::smtk::common::UUID const &) const) &smtk::attribute::ComponentItem::contains, py::arg("compId"))
.def("contains", (bool (smtk::attribute::ComponentItem::*)(const ::smtk::resource::PersistentObjectPtr&) const) &smtk::attribute::ComponentItem::contains, py::arg("comp"))
.def("definition", &smtk::attribute::ComponentItem::definition)
.def("end", &smtk::attribute::ComponentItem::end)
.def("find", (ptrdiff_t (smtk::attribute::ComponentItem::*)(::smtk::common::UUID const &) const) &smtk::attribute::ComponentItem::find, py::arg("compId"))
.def("find", (ptrdiff_t (smtk::attribute::ComponentItem::*)(const ::smtk::resource::PersistentObjectPtr&) const) &smtk::attribute::ComponentItem::find, py::arg("component"))
.def("has", (bool (smtk::attribute::ComponentItem::*)(::smtk::common::UUID const &) const) &smtk::attribute::ComponentItem::has, py::arg("compId"))
.def("has", (bool (smtk::attribute::ComponentItem::*)(const ::smtk::resource::PersistentObjectPtr&) const) &smtk::attribute::ComponentItem::has, py::arg("comp"))
.def("isExtensible", &smtk::attribute::ComponentItem::isExtensible)
.def("isSet", &smtk::attribute::ComponentItem::isSet, py::arg("i") = 0)
.def("isValueValid", (bool (smtk::attribute::ComponentItem::*)(const ::smtk::resource::ComponentPtr) const) &smtk::attribute::ComponentItem::isValueValid, py::arg("val"))
......
......@@ -34,8 +34,8 @@ PySharedPtrClass< smtk::attribute::ModelEntityItem, smtk::attribute::ComponentIt
.def("end", &smtk::attribute::ModelEntityItem::end)
.def("find", (ptrdiff_t (smtk::attribute::ModelEntityItem::*)(::smtk::common::UUID const &) const) &smtk::attribute::ModelEntityItem::find, py::arg("entity"))
.def("find", (ptrdiff_t (smtk::attribute::ModelEntityItem::*)(::smtk::model::EntityRef const &) const) &smtk::attribute::ModelEntityItem::find, py::arg("entity"))
.def("has", (bool (smtk::attribute::ModelEntityItem::*)(::smtk::common::UUID const &) const) &smtk::attribute::ModelEntityItem::has, py::arg("entity"))
.def("has", (bool (smtk::attribute::ModelEntityItem::*)(::smtk::model::EntityRef const &) const) &smtk::attribute::ModelEntityItem::has, py::arg("entity"))
.def("contains", (bool (smtk::attribute::ModelEntityItem::*)(::smtk::common::UUID const &) const) &smtk::attribute::ModelEntityItem::contains, py::arg("entity"))
.def("contains", (bool (smtk::attribute::ModelEntityItem::*)(::smtk::model::EntityRef const &) const) &smtk::attribute::ModelEntityItem::contains, py::arg("entity"))
.def("isExtensible", &smtk::attribute::ModelEntityItem::isExtensible)
.def("isSet", &smtk::attribute::ModelEntityItem::isSet, py::arg("element") = 0)
.def("numberOfRequiredValues", &smtk::attribute::ModelEntityItem::numberOfRequiredValues)
......
......@@ -26,12 +26,12 @@ PySharedPtrClass< smtk::attribute::ReferenceItem, smtk::attribute::Item > pybind
.def("appendObjectValue", &smtk::attribute::ReferenceItem::appendObjectValue, py::arg("val"))
.def("assign", &smtk::attribute::ReferenceItem::assign, py::arg("sourceItem"), py::arg("options") = 0)
.def("begin", &smtk::attribute::ReferenceItem::begin)
.def("contains", (bool (smtk::attribute::ReferenceItem::*)(::smtk::common::UUID const &) const) &smtk::attribute::ReferenceItem::contains, py::arg("compId"))
.def("contains", (bool (smtk::attribute::ReferenceItem::*)(const ::smtk::resource::PersistentObjectPtr&) const) &smtk::attribute::ReferenceItem::contains, py::arg("obj"))
.def("definition", &smtk::attribute::ReferenceItem::definition)
.def("end", &smtk::attribute::ReferenceItem::end)
.def("find", (ptrdiff_t (smtk::attribute::ReferenceItem::*)(::smtk::common::UUID const &) const) &smtk::attribute::ReferenceItem::find, py::arg("compId"))
.def("find", (ptrdiff_t (smtk::attribute::ReferenceItem::*)(const ::smtk::resource::PersistentObjectPtr&) const) &smtk::attribute::ReferenceItem::find, py::arg("component"))
.def("has", (bool (smtk::attribute::ReferenceItem::*)(::smtk::common::UUID const &) const) &smtk::attribute::ReferenceItem::has, py::arg("compId"))
.def("has", (bool (smtk::attribute::ReferenceItem::*)(const ::smtk::resource::PersistentObjectPtr&) const) &smtk::attribute::ReferenceItem::has, py::arg("obj"))
.def("isExtensible", &smtk::attribute::ReferenceItem::isExtensible)
.def("isSet", &smtk::attribute::ReferenceItem::isSet, py::arg("i") = 0)
.def("lockType", &smtk::attribute::ReferenceItem::lockType)
......
......@@ -35,8 +35,8 @@ PySharedPtrClass< smtk::attribute::ResourceItem, smtk::attribute::ReferenceItem
.def("end", &smtk::attribute::ResourceItem::end)
.def("find", (ptrdiff_t (smtk::attribute::ResourceItem::*)(::smtk::common::UUID const &) const) &smtk::attribute::ResourceItem::find, py::arg("rsrcId"))
.def("find", (ptrdiff_t (smtk::attribute::ResourceItem::*)(const ::smtk::resource::PersistentObjectPtr&) const) &smtk::attribute::ResourceItem::find, py::arg("resource"))
.def("has", (bool (smtk::attribute::ResourceItem::*)(::smtk::common::UUID const &) const) &smtk::attribute::ResourceItem::has, py::arg("rsrcId"))
.def("has", (bool (smtk::attribute::ResourceItem::*)(const ::smtk::resource::PersistentObjectPtr&) const) &smtk::attribute::ResourceItem::has, py::arg("rsrc"))
.def("contains", (bool (smtk::attribute::ResourceItem::*)(::smtk::common::UUID const &) const) &smtk::attribute::ResourceItem::contains, py::arg("rsrcId"))
.def("contains", (bool (smtk::attribute::ResourceItem::*)(const ::smtk::resource::PersistentObjectPtr&) const) &smtk::attribute::ResourceItem::contains, py::arg("rsrc"))
.def("isExtensible", &smtk::attribute::ResourceItem::isExtensible)
.def("isSet", &smtk::attribute::ResourceItem::isSet, py::arg("i") = 0)
.def("numberOfRequiredValues", &smtk::attribute::ResourceItem::numberOfRequiredValues)
......
......@@ -118,7 +118,7 @@ int main()
for (std::size_t i = 0; i < 3; i++)
{
if (!tag->has(value[i]))
if (!tag->contains(value[i]))
{
std::cerr << "Expected tag value not found: \"" << value[i] << "\"\n";
std::cerr << logger.convertToString();
......
......@@ -74,7 +74,7 @@ void testLoadedAttributeResource(attribute::ResourcePtr& attRes, const std::stri
smtkTest(result == Definition::AssociationResultType::Conflict, prefix
<< "- A1 did not return conflict");
smtkTest(probAtt == attA, prefix << "- A1 did not return attA as conflicting");
smtkTest(attC->associations()->has(attTest), prefix
smtkTest(attC->associations()->contains(attTest), prefix
<< "- C does not think it is associated with attTest")
}
......
......@@ -231,12 +231,12 @@ public:
}
/// Check if a link with the input id exists.
bool has(const id_type& key) const { return this->find(key) != this->end(); }
bool contains(const id_type& key) const { return this->find(key) != this->end(); }
/// Check if a link with the input value matching the tagged search criterion
/// exists.
template <typename tag>
bool has(const typename LinkTraits<tag>::type&) const;
bool contains(const typename LinkTraits<tag>::type&) const;
/// Return the number of links with the input value matching the tagged search
/// criterion.
......@@ -316,7 +316,7 @@ Links<id_type, left_type, right_type, role_type, base_type>::insert(base_type&&
template <typename id_type, typename left_type, typename right_type, typename role_type,
typename base_type>
template <typename tag>
bool Links<id_type, left_type, right_type, role_type, base_type>::has(
bool Links<id_type, left_type, right_type, role_type, base_type>::contains(
const typename detail::LinkTraits<id_type, left_type, right_type, role_type, base_type,
tag>::type& value) const
{
......
......@@ -69,7 +69,7 @@ public:
PropertiesOfType& operator=(PropertiesOfType&&) = delete;
/// Check whether a property associated with <key> is present.
bool has(const std::string& key) const { return (m_data.find(key) != m_data.end()); }
bool contains(const std::string& key) const { return (m_data.find(key) != m_data.end()); }
/// Insert (<key>, <value>) into the container.
bool insert(const std::string& key, const Type& value)
......@@ -147,7 +147,7 @@ public:
/// On average, this method has constant complexity and can therefore be used
/// in conjunction with at() for conditional queries.
template <typename Type>
bool has(const std::string& key) const
bool contains(const std::string& key) const
{
auto it = m_data.find(smtk::common::typeName<Type>());
if (it == m_data.end())
......@@ -155,7 +155,7 @@ public:
return false;
}
return static_cast<const PropertiesOfType<Type>&>(*it->second).has(key);
return static_cast<const PropertiesOfType<Type>&>(*it->second).contains(key);
}
/// Insert (<Type>, <key>, <value>) into the container.
......@@ -182,7 +182,7 @@ public:
/// Access property of type <Type> indexed by <key>.
/// On average, this method has constant complexity and can therefore be used
/// in conjunction with has() for conditional queries.
/// in conjunction with contains() for conditional queries.
template <typename Type>
Type& at(const std::string& key)
{
......@@ -191,7 +191,7 @@ public:
/// Access property of type <Type> indexed by <key>.
/// On average, this method has constant complexity and can therefore be used
/// in conjunction with has() for conditional queries.
/// in conjunction with contains() for conditional queries.
template <typename Type>
const Type& at(const std::string& key) const
{
......
......@@ -124,7 +124,7 @@ public:
virtual ~MaybeRegister() {}
template <typename M>
bool has(const std::shared_ptr<M>&) const
bool contains(const std::shared_ptr<M>&) const
{
return false;
}
......@@ -153,12 +153,12 @@ public:
}
template <typename M>
bool has(const std::shared_ptr<M>&) const
bool contains(const std::shared_ptr<M>&) const
{
return false;
}
bool has(const std::shared_ptr<Manager>& manager) const
bool contains(const std::shared_ptr<Manager>& manager) const
{
auto m = m_Manager.lock();
return m && m == manager;
......@@ -309,11 +309,11 @@ public:
}
template <typename M>
bool has(const std::shared_ptr<M>& m)
bool contains(const std::shared_ptr<M>& m)
{
auto tmp = dynamic_cast<
detail::MaybeRegister<Registrar, M, typename detail::RegistersTo<Registrar, M>::type>*>(this);
return tmp != nullptr && tmp->has(m);
return tmp != nullptr && tmp->contains(m);
}
virtual ~Registry() {}
......@@ -376,11 +376,11 @@ public:
virtual ~Registry() {}
template <typename M>
bool has(const std::shared_ptr<M>& m)
bool contains(const std::shared_ptr<M>& m)
{
auto tmp = dynamic_cast<
detail::MaybeRegister<Registrar, M, typename detail::RegistersTo<Registrar, M>::type>*>(this);
return tmp != nullptr && tmp->has(m);
return tmp != nullptr && tmp->contains(m);
}
Registry(int, const std::shared_ptr<Manager>& manager, const std::shared_ptr<T>&... managers)
......
......@@ -92,7 +92,7 @@ public:
template <typename T>
struct is_pod
{
using type = typename smtk::tuple_has<T, PODs>::type;
using type = typename smtk::tuple_contains<T, PODs>::type;
};
// A compile-time test to check whether or not a class has a create() method.
......
......@@ -116,9 +116,9 @@ void UnitTest()
smtkTest(links.size() == 3, "Should have 3 links.");
smtkTest(links.size<MyLinks::Role>(100) == 2, "Should have 2 links.");
smtkTest(links.has<MyLinks::Left>(4) == true, "Should have a left value of 4.");
smtkTest(links.has<MyLinks::Right>(1) == false, "Should not have a right value of 1.");
smtkTest(links.has(7) == true, "Should have an id value of 7.");
smtkTest(links.contains<MyLinks::Left>(4) == true, "Should have a left value of 4.");
smtkTest(links.contains<MyLinks::Right>(1) == false, "Should not have a right value of 1.");
smtkTest(links.contains(7) == true, "Should have an id value of 7.");
// Erase all links associated with a "right" value of 5
bool erased = links.erase_all<MyLinks::Right>(5);
......@@ -231,9 +231,9 @@ void MoveOnlyTest()
smtkTest(links.size() == 3, "Should have 3 links.");
smtkTest(links.size<MyLinks::Role>(100) == 2, "Should have 2 links.");
smtkTest(links.has<MyLinks::Left>(4) == true, "Should have a left value of 4.");
smtkTest(links.has<MyLinks::Right>(1) == false, "Should not have a right value of 1.");
smtkTest(links.has(7) == true, "Should have an id value of 7.");
smtkTest(links.contains<MyLinks::Left>(4) == true, "Should have a left value of 4.");
smtkTest(links.contains<MyLinks::Right>(1) == false, "Should not have a right value of 1.");
smtkTest(links.contains(7) == true, "Should have an id value of 7.");
// Erase all links associated with a "right" value of 5
bool erased = links.erase_all<MyLinks::Right>(5);
......
......@@ -52,7 +52,7 @@ int UnitTestProperties(int, char** const)
{
Properties properties;
test(properties.has<int>("foo") == false, "New instance should contain no values.");
test(properties.contains<int>("foo") == false, "New instance should contain no values.");
try
{
......
......@@ -245,7 +245,7 @@ void pqSMTKRegisterImportersBehavior::constructImporters(pqSMTKWrapper* wrapper,
if (groupName == smtk::operation::ImporterGroup::type_name)
{
auto importerGroup = smtk::operation::ImporterGroup(operationManager);
assert(importerGroup.has(index));
assert(importerGroup.contains(index));
auto fileItemDef = importerGroup.fileItemDefinitionForOperation(index);
registerSMTKImporter(
server, importerGroup.resourceForOperation(index), fileItemDef->getFileFilters());
......@@ -271,7 +271,7 @@ void pqSMTKRegisterImportersBehavior::constructImporters(pqSMTKWrapper* wrapper,
if (groupName == smtk::operation::ImporterGroup::type_name)
{
auto importerGroup = smtk::operation::ImporterGroup(operationManager);
assert(importerGroup.has(index));
assert(importerGroup.contains(index));
auto fileItemDef = importerGroup.fileItemDefinitionForOperation(index);
unregisterSMTKImporter(server, importerGroup.resourceForOperation(index),
fileItemDef->getFileFilters());
......
......@@ -178,7 +178,7 @@ smtk::common::RegistryBase* PluginClient<Registrar, Manager>::find(
// take as a template parameter a Manager that they do not support. Because
// of this, we need to check if the accessed registry also supports the
// Manager under query.
if (registry != nullptr && registry->has(manager))
if (registry != nullptr && registry->contains(manager))
{
return base_registry;
}
......
......@@ -44,7 +44,7 @@ class SMTKPVSERVEREXT_EXPORT VTKSelectionResponderGroup : protected smtk::operat
{
public:
using Operation = smtk::operation::Operation;
using smtk::operation::Group::has;
using smtk::operation::Group::contains;
using smtk::operation::Group::operations;
using smtk::operation::Group::operationNames;
using smtk::operation::Group::operationName;
......
......@@ -516,7 +516,7 @@ void XmlDocV3Parser::processReferenceItem(
smtk::common::UUID surrogateId(surrogateNode.attribute("Id").as_string());
std::string surrogateLocation(surrogateNode.attribute("Location").as_string());
if (!links.has(key.first))
if (!links.contains(key.first))
{
links.insert(smtk::resource::Surrogate(
surrogateIndex, surrogateTypeName, surrogateId, surrogateLocation),
......@@ -551,7 +551,7 @@ void XmlDocV3Parser::processReferenceItem(
smtk::common::UUID surrogateId(surrogateNode.attribute("Id").as_string());
std::string surrogateLocation(surrogateNode.attribute("Location").as_string());
if (!links.has(key.first))
if (!links.contains(key.first))
{
links.insert(smtk::resource::Surrogate(
surrogateIndex, surrogateTypeName, surrogateId, surrogateLocation),
......
......@@ -67,7 +67,7 @@ bool AuxiliaryGeometry::hasURL() const
return false;
}
return comp->properties().has<std::vector<std::string> >("url");
return comp->properties().contains<std::vector<std::string> >("url");
}
/**\brief Return the URL to external geometry if any exists, and an empty string otherwise.
......@@ -81,7 +81,7 @@ std::string AuxiliaryGeometry::url() const
return std::string();
}
auto comp = this->component();
if (comp == nullptr || !comp->properties().has<std::vector<std::string> >("url") ||
if (comp == nullptr || !comp->properties().contains<std::vector<std::string> >("url") ||
comp->properties().at<std::vector<std::string> >("url").empty())
{
return std::string();
......
......@@ -1314,7 +1314,7 @@ Entity::QueryFunctor limitedQueryFunctor(
{
return true;
}
if (!floatProperties.has(clause.m_propName))
if (!floatProperties.contains(clause.m_propName))
{
return false;
}
......@@ -1344,7 +1344,7 @@ Entity::QueryFunctor limitedQueryFunctor(
StringData::const_iterator pit;
if (!clause.m_propNameIsRegex)
{
if (!stringProperties.has(clause.m_propName))
if (!stringProperties.contains(clause.m_propName))
{
return false;
}
......@@ -1382,7 +1382,7 @@ Entity::QueryFunctor limitedQueryFunctor(
{
return true;
}
if (!intProperties.has(clause.m_propName))
if (!intProperties.contains(clause.m_propName))
{
return false;
}
......
......@@ -917,7 +917,7 @@ int EntityRef::tessellationGeneration() const
if (comp != nullptr)
{
const auto& integerProperties = comp->properties().get<std::vector<long> >();
if (!integerProperties.has(SMTK_TESS_GEN_PROP) ||
if (!integerProperties.contains(SMTK_TESS_GEN_PROP) ||
integerProperties.at(SMTK_TESS_GEN_PROP).empty())
{
return -1;
......@@ -1149,7 +1149,7 @@ smtk::model::FloatList const& EntityRef::floatProperty(const std::string& propNa
if (comp != nullptr)
{
const auto& floatProperties = comp->properties().get<std::vector<double> >();
if (floatProperties.has(propName))
if (floatProperties.contains(propName))
{
return floatProperties.at(propName);
}
......@@ -1175,7 +1175,7 @@ bool EntityRef::hasFloatProperty(const std::string& propName) const
if (comp != nullptr)
{
const auto& floatProperties = comp->properties().get<std::vector<double> >();
return floatProperties.has(propName);
return floatProperties.contains(propName);
}
return false;
}
......@@ -1186,7 +1186,7 @@ bool EntityRef::removeFloatProperty(const std::string& propName)
if (comp != nullptr)
{
auto floatProperties = comp->properties().get<std::vector<double> >();
if (floatProperties.has(propName))
if (floatProperties.contains(propName))
{
floatProperties.erase(propName);
return true;
......@@ -1249,7 +1249,7 @@ smtk::model::StringList const& EntityRef::stringProperty(const std::string& prop
if (comp != nullptr)
{
const auto& stringProperties = comp->properties().get<std::vector<std::string> >();
if (stringProperties.has(propName))
if (stringProperties.contains(propName))
{
return stringProperties.at(propName);
}
......@@ -1275,7 +1275,7 @@ bool EntityRef::hasStringProperty(const std::string& propName) const
if (comp != nullptr)
{
const auto& stringProperties = comp->properties().get<std::vector<std::string> >();
return stringProperties.has(propName);
return stringProperties.contains(propName);
}
return false;
}
......@@ -1286,7 +1286,7 @@ bool EntityRef::removeStringProperty(const std::string& propName)
if (comp != nullptr)
{
auto stringProperties = comp->properties().get<std::vector<std::string> >();
if (stringProperties.has(propName))
if (stringProperties.contains(propName))
{
stringProperties.erase(propName);
return true;
......@@ -1349,7 +1349,7 @@ smtk::model::IntegerList const& EntityRef::integerProperty(const std::string& pr
if (comp != nullptr)
{
const auto& integerProperties = comp->properties().get<std::vector<long> >();
if (integerProperties.has(propName))
if (integerProperties.contains(propName))
{
return integerProperties.at(propName);
}
......@@ -1375,7 +1375,7 @@ bool EntityRef::hasIntegerProperty(const std::string& propName) const
if (comp != nullptr)
{
const auto& integerProperties = comp->properties().get<std::vector<long> >();
return integerProperties.has(propName);
return integerProperties.contains(propName);
}
return false;
}
......@@ -1386,7 +1386,7 @@ bool EntityRef::removeIntegerProperty(const std::string& propName)
if (comp != nullptr)
{
auto integerProperties = comp->properties().get<std::vector<long> >();
if (integerProperties.has(propName))
if (integerProperties.contains(propName))
{
integerProperties.erase(propName);
return true;
......
......@@ -176,7 +176,7 @@ std::string Instance::rule() const
}
auto stringProperties = comp->properties().get<std::vector<std::string> >();
return (!stringProperties.has(rule) || stringProperties.at(rule).empty())
return (!stringProperties.contains(rule) || stringProperties.at(rule).empty())
? "empty"
: stringProperties.at(rule)[0];
}
......@@ -216,7 +216,7 @@ EntityRefs Instance::snapEntities() const
auto intProperties = comp->properties().get<IntegerList>();
static const std::string snapToEntitiesStr = "snap to entities";
if (!intProperties.has(snapToEntitiesStr))
if (!intProperties.contains(snapToEntitiesStr))
{
return result;
}
......@@ -286,7 +286,7 @@ bool Instance::setSnapEntities(const EntityRefs& snapTo)
static const std::string snapToEntitiesStr = "snap to entities";
if (snapTo.empty())
{
if (!intProperties.has(snapToEntitiesStr))
if (!intProperties.contains(snapToEntitiesStr))
{
return false;
}
......@@ -311,7 +311,7 @@ bool Instance::setSnapEntities(const EntityRefs& snapTo)
*rit = uit[2 * jj] + 256 * uit[2 * jj + 1];
}
}
if (!intProperties.has(snapToEntitiesStr))
if (!intProperties.contains(snapToEntitiesStr))
{
intProperties[snapToEntitiesStr] = replacement;
}
......
......@@ -1188,7 +1188,7 @@ smtk::model::FloatList& Resource::floatProperty(const UUID& entity, const std::s
bool Resource::hasFloatProperty(const UUID& entity, const std::string& propName) const
{
typedef resource::Properties::Indexed<std::vector<double> > FloatProperty;
if (!entity.isNull() && this->properties().data().has<FloatProperty>(propName))
if (!entity.isNull() && this->properties().data().contains<FloatProperty>(propName))
{
auto it = this->properties().data().at<FloatProperty>(propName).find(entity);
return (
......@@ -1259,7 +1259,7 @@ smtk::model::StringList& Resource::stringProperty(const UUID& entity, const std:
bool Resource::hasStringProperty(const UUID& entity, const std::string& propName) const
{
typedef resource::Properties::Indexed<std::vector<std::string> > StringProperty;
if (!entity.isNull() && this->properties().data().has<StringProperty>(propName))
if (!entity.isNull() && this->properties().data().contains<StringProperty>(propName))
{
auto it = this->properties().data().at<StringProperty>(propName).find(entity);
return (
......@@ -1334,7 +1334,7 @@ smtk::model::IntegerList& Resource::integerProperty(const UUID& entity, const st
bool Resource::hasIntegerProperty(const UUID& entity, const std::string& propName) const
{
typedef resource::Properties::Indexed<std::vector<long> > IntProperty;
if (!entity.isNull() && this->properties().data().has<IntProperty>(propName))
if (!entity.isNull() && this->properties().data().contains<IntProperty>(propName))
{
auto it = this->properties().data().at<IntProperty>(propName).find(entity);
return (it != this->properties().data().at<IntProperty>(propName).end() && !it->second.empty());
......
......@@ -138,7 +138,7 @@ Operation::Specification Group::specification(const Operation::Index& index) con
return getSpecification<Operation::Index>(index, m_manager);
}
bool Group::has(const std::string& typeName) const
bool Group::contains(const std::string& typeName) const
{
// Access the operation's specification.
Operation::Specification spec = getSpecification<std::string>(typeName, m_manager);
......@@ -154,7 +154,7 @@ bool Group::has(const std::string& typeName) const
return tagNames.find(name()) != tagNames.end();
}
bool Group::has(const Operation::Index& index) const
bool Group::contains(const Operation::Index& index) const
{
// Access the operation's specification.
Operation::Specification spec = getSpecification<Operation::Index>(index, m_manager);
......
......@@ -93,14 +93,14 @@ public:
Operation::Specification specification() const;
/// Check if an operation identified by it's unique name is in the group.
bool has(const std::string&) const;
bool contains(const std::string&) const;
/// Check if an operation identified by its type index is in the group.
bool has(const Operation::Index&) const;