本文整理汇总了C++中boost::optional::handle方法的典型用法代码示例。如果您正苦于以下问题:C++ optional::handle方法的具体用法?C++ optional::handle怎么用?C++ optional::handle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类boost::optional
的用法示例。
在下文中一共展示了optional::handle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setRelatedModelObject
bool Relationship::setRelatedModelObject(boost::optional<ModelObject> relatedModelObject)
{
assertSingular(true);
bool result = false;
if (isSettable()) {
// handle ComponentData set
if (relatedModelObject && relatedModelObject->optionalCast<ComponentData>()) {
if (relatedModelObject->model() != m_object.model()) {
if (relatedModelObject->model().optionalCast<Component>()) {
return setRelatedModelObject(relatedModelObject->model().cast<Component>());
}
}
}
QVariant value = QVariant::fromValue(relatedModelObject);
m_object.getImpl<detail::ModelObject_Impl>()->setProperty(m_name.c_str(), value);
// check set
boost::optional<ModelObject> newValue = this->relatedModelObject();
if (relatedModelObject){
if (newValue){
result = (relatedModelObject->handle() == newValue->handle());
}
}else{
result = !newValue;
}
}
return result;
}
示例2: setNormalizedBoilerEfficiencyCurve
bool BoilerHotWater_Impl::setNormalizedBoilerEfficiencyCurve(
const boost::optional<Curve>& normalizedBoilerEfficiencyCurve)
{
if (normalizedBoilerEfficiencyCurve) {
return setPointer(OS_Boiler_HotWaterFields::NormalizedBoilerEfficiencyCurveName,normalizedBoilerEfficiencyCurve->handle());
}
else {
return setString(OS_Boiler_HotWaterFields::NormalizedBoilerEfficiencyCurveName,"");
}
return false;
}