Пример #1
0
QString RegistryPersistence::ReadOptional(const SmartPointer<IConfigurationElement>& configurationElement,
                            const QString& attribute)
{
  QString value = configurationElement->GetAttribute(attribute);
  if (value.isEmpty())
  {
    value = QString();
  }

  return value;
}
Пример #2
0
QString RegistryPersistence::ReadRequired(const SmartPointer<IConfigurationElement>& configurationElement,
                            const QString& attribute,
                            QList<SmartPointer<IStatus> >& warningsToLog,
                            const QString& message, const QString& id)
{
  const QString value = configurationElement->GetAttribute(attribute);
  if (value.isEmpty())
  {
    AddWarning(warningsToLog, message, configurationElement, id);
    return QString();
  }

  return value;
}
Пример #3
0
bool RegistryPersistence::CheckClass(const SmartPointer<IConfigurationElement>& configurationElement,
                                     QList<SmartPointer<IStatus> >& warningsToLog,
                                     const QString& message,
                                     const QString& id)
{
  // Check to see if we have a handler class.
  if ((configurationElement->GetAttribute(ATT_CLASS).isNull())
      && (configurationElement->GetChildren(TAG_CLASS).isEmpty()))
  {
    AddWarning(warningsToLog, message, configurationElement, id);
    return false;
  }

  return true;
}
Пример #4
0
bool RegistryPersistence::ReadBoolean(const SmartPointer<IConfigurationElement>& configurationElement,
                        const QString& attribute,
                        const bool defaultValue)
{
  const QString value = configurationElement->GetAttribute(attribute);
  if (value.isNull())
  {
    return defaultValue;
  }

  if (defaultValue)
  {
    return value.compare("false", Qt::CaseInsensitive) != 0;
  }

  return value.compare("true", Qt::CaseInsensitive) == 0;
}