本文整理汇总了C++中model::ModelObject::attributeNames方法的典型用法代码示例。如果您正苦于以下问题:C++ ModelObject::attributeNames方法的具体用法?C++ ModelObject::attributeNames怎么用?C++ ModelObject::attributeNames使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model::ModelObject
的用法示例。
在下文中一共展示了ModelObject::attributeNames方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: bind
void OSDoubleEdit::bind(model::ModelObject& modelObject,
const char* property,
const boost::optional<std::string>& isDefaultedProperty,
const boost::optional<std::string>& isAutosizedProperty,
const boost::optional<std::string>& isAutocalculatedProperty)
{
m_modelObject = modelObject;
m_property = property;
m_isDefaultedProperty = isDefaultedProperty;
m_isAutosizedProperty = isAutosizedProperty;
m_isAutocalculatedProperty = isAutocalculatedProperty;
// only let one of autosize/autocalculate
if (isAutosizedProperty && isAutocalculatedProperty) {
LOG_AND_THROW("A field can only be autosized or autocalculated, it cannot be both.");
}
// check for attribute existence
StringVector attributeNames = modelObject.attributeNames();
StringVector::const_iterator anb(attributeNames.begin()),ane(attributeNames.end());
BOOST_ASSERT(std::find(anb,ane,m_property) != ane);
if (m_isDefaultedProperty) {
BOOST_ASSERT(std::find(anb,ane,*m_isDefaultedProperty) != ane);
}
if (m_isAutosizedProperty) {
BOOST_ASSERT(std::find(anb,ane,*m_isAutosizedProperty) != ane);
}
if (m_isAutocalculatedProperty) {
BOOST_ASSERT(std::find(anb,ane,*m_isAutocalculatedProperty) != ane);
}
setEnabled(true);
bool isConnected = false;
isConnected = connect( this, SIGNAL(editingFinished()), this, SLOT(onEditingFinished()) );
BOOST_ASSERT(isConnected);
isConnected = connect( m_modelObject->getImpl<openstudio::model::detail::ModelObject_Impl>().get(),SIGNAL(onChange()),
this,SLOT(onModelObjectChange()) );
BOOST_ASSERT(isConnected);
isConnected = connect( m_modelObject->getImpl<openstudio::model::detail::ModelObject_Impl>().get(),SIGNAL(onRemoveFromWorkspace(Handle)),
this,SLOT(onModelObjectRemove(Handle)) );
BOOST_ASSERT(isConnected);
refreshTextAndLabel();
}