//---------------------------------------------------------------------------- void ctkPluginFrameworkDebug::setPropertyIfNotSet(ctkProperties& props, const QString& key, const QVariant& val) { if (!props.contains(key)) { props.insert(key, val); } }
//---------------------------------------------------------------------------- void mergeProperties(ctkProperties& destination, const ctkProperties& source) { for (ctkProperties::const_iterator iter = source.begin(); iter != source.end(); ++iter) { if (!destination.contains(iter.key())) { destination.insert(iter.key(), iter.value()); } } }
ctkDictionary::ctkDictionary(const ctkProperties& properties) { ctkProperties::ConstIterator end = properties.end(); for (ctkProperties::ConstIterator it = properties.begin(); it != end; ++it) { if (this->contains(it.key())) { QString msg("ctkProperties object contains case variants of the key: "); msg += it.key(); throw std::invalid_argument(qPrintable(msg)); } this->insert(it.key(), it.value()); } }
//---------------------------------------------------------------------------- ctkPluginFrameworkDebug::ctkPluginFrameworkDebug(ctkProperties& props) { setPropertyIfNotSet(props, ERRORS_PROP, false); setPropertyIfNotSet(props, FRAMEWORK_PROP, false); setPropertyIfNotSet(props, HOOKS_PROP, false); setPropertyIfNotSet(props, LAZY_ACTIVATION_PROP, false); setPropertyIfNotSet(props, LDAP_PROP, false); setPropertyIfNotSet(props, SERVICE_REFERENCE_PROP, false); setPropertyIfNotSet(props, STARTLEVEL_PROP, false); setPropertyIfNotSet(props, URL_PROP, false); setPropertyIfNotSet(props, RESOLVE_PROP, false); errors = props.value(ERRORS_PROP).toBool(); framework = props.value(FRAMEWORK_PROP).toBool(); hooks = props.value(HOOKS_PROP).toBool(); lazy_activation = props.value(LAZY_ACTIVATION_PROP).toBool(); ldap = props.value(LDAP_PROP).toBool(); service_reference = props.value(SERVICE_REFERENCE_PROP).toBool(); startlevel = props.value(STARTLEVEL_PROP).toBool(); url = props.value(URL_PROP).toBool(); resolve = props.value(RESOLVE_PROP).toBool(); }