本文整理汇总了C++中PropertyAccessor::setValueWithoutNotification方法的典型用法代码示例。如果您正苦于以下问题:C++ PropertyAccessor::setValueWithoutNotification方法的具体用法?C++ PropertyAccessor::setValueWithoutNotification怎么用?C++ PropertyAccessor::setValueWithoutNotification使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PropertyAccessor
的用法示例。
在下文中一共展示了PropertyAccessor::setValueWithoutNotification方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addProperty
bool BaseGenericObject::addProperty(const char* name, const Variant& value, MetaData metadata, bool enableNotification)
{
const IClassDefinition& definition = *this->getDefinition();
ObjectHandle provider = this->getDerivedType();
auto definitionModifier = definition.getDetails().getDefinitionModifier();
if (definitionModifier == nullptr)
{
return false;
}
Collection testCollection;
bool isCollection = value.tryCast<Collection>(testCollection);
if (!definitionModifier->addProperty(name, value.type()->typeId(), std::move(metadata), isCollection))
{
return false;
}
PropertyAccessor accessor = definition.bindProperty(name, provider);
if (enableNotification)
{
return accessor.setValue(value);
}
else
{
return accessor.setValueWithoutNotification(value);
}
}
示例2: setProperty
bool BaseGenericObject::setProperty(const char* name, const Variant& value, bool enableNotification)
{
// Get existing property
const IClassDefinition& definition = *this->getDefinition();
ObjectHandle provider = this->getDerivedType();
PropertyAccessor accessor = definition.bindProperty(name, provider);
// do nothing if property does not exist and the value is void
if (!accessor.isValid() && value.isVoid())
{
return false;
}
// set value to the property if property exists and the value is not void
if (accessor.isValid() && !value.isVoid())
{
if (enableNotification)
{
return accessor.setValue(value);
}
else
{
return accessor.setValueWithoutNotification(value);
}
}
// Property does not exist
// Add new property and set it
auto definitionModifier = definition.getDetails().getDefinitionModifier();
if (definitionModifier == nullptr)
{
return false;
}
if (accessor.isValid() && value.isVoid())
{
definitionModifier->removeProperty(name);
return false;
}
return addProperty(name, value, nullptr, enableNotification);
}