void View::SetPropertyValue( const IsoString& property, const Variant& value, bool notify, ViewPropertyAttributes attributes ) { api_property_value apiValue; APIPropertyValueFromVariant( apiValue, value ); if ( (*API->View->SetViewPropertyValue)( ModuleHandle(), handle, property.c_str(), &apiValue, attributes, notify ) == api_false ) throw APIFunctionError( "SetViewPropertyValue" ); }
bool FileFormatInstance::WriteProperty( const IsoString& property, const Variant& value ) { try { if ( (*API->FileFormat->BeginPropertyEmbedding)( handle ) == api_false ) return false; bool ok = true; if ( value.IsValid() ) { api_property_value apiValue; APIPropertyValueFromVariant( apiValue, value ); api_property_value safeCopy = apiValue; ok = (*API->FileFormat->SetImageProperty)( handle, property.c_str(), &safeCopy ) != api_false; if ( safeCopy.data.blockValue != apiValue.data.blockValue || safeCopy.dimX != apiValue.dimX || safeCopy.dimY != apiValue.dimY || safeCopy.dimZ != apiValue.dimZ || safeCopy.dimT != apiValue.dimT || safeCopy.type != apiValue.type ) { APIHackingAttempt( "WriteProperty" ); } } (*API->FileFormat->EndPropertyEmbedding)( handle ); return ok; } catch ( ... ) { (*API->FileFormat->EndPropertyEmbedding)( handle ); throw; } }