css::uno::Any comphelper::detail::ConfigurationWrapper::getPropertyValue(std::u16string_view path) const
{ // should be short-circuited in ConfigurationProperty::get()
assert(!comphelper::IsFuzzing());
// Cache the configuration access, since some of the keys are used in hot code. // Note that this cache is only used by the officecfg:: auto-generated code, using it for anything // else would be unwise because the cache could end up containing stale entries. static std::mutex gMutex; static std::map<OUString, css::uno::Reference< css::container::XNameAccess >> gAccessMap;
// check cache auto it = gAccessMap.find(parentPath); if (it == gAccessMap.end())
{ // not in the cache, look it up
css::uno::Reference<css::container::XNameAccess> access(
access_->getByHierarchicalName(parentPath), css::uno::UNO_QUERY_THROW);
it = gAccessMap.emplace(parentPath, access).first;
} return it->second->getByName(childName);
}
void comphelper::ConfigurationListener::removeListener(ConfigurationListenerPropertyBase *pListener)
{ auto it = std::find( maListeners.begin(), maListeners.end(), pListener ); if ( it != maListeners.end() )
{
maListeners.erase( it );
mxConfig->removePropertyChangeListener( pListener->maName, this );
}
}
void SAL_CALL comphelper::ConfigurationListener::propertyChange(
css::beans::PropertyChangeEvent const &rEvt )
{ // Code is commonly used inside the SolarMutexGuard // so to avoid concurrent writes to the property, // and allow fast, lock-less access, guard here. // // Note that we are abusing rtl::Reference here to do acquire/release because, // unlike osl::Guard, it is tolerant of null pointers, and on some code paths, the // SolarMutex does not exist.
rtl::Reference<comphelper::SolarMutex> xMutexGuard( comphelper::SolarMutex::get() );
assert( rEvt.Source == mxConfig ); for (autoconst& listener : maListeners)
{ if ( listener->maName == rEvt.PropertyName )
{ // ignore rEvt.NewValue - in theory it could be stale => not set.
css::uno::Any aValue = mxConfig->getPropertyValue( listener->maName );
listener->setProperty( aValue );
}
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.