//----------------------------------------------------------------------------
ctkDicomAppHosting::State ctkDicomSoapState::fromString(const QString& string)
{
  if (string == "IDLE") return ctkDicomAppHosting::IDLE;
  if (string == "INPROGRESS") return ctkDicomAppHosting::INPROGRESS;
  if (string == "COMPLETED") return ctkDicomAppHosting::COMPLETED;
  if (string == "SUSPENDED") return ctkDicomAppHosting::SUSPENDED;
  if (string == "CANCELED") return ctkDicomAppHosting::CANCELED;
  if (string == "EXIT") return ctkDicomAppHosting::EXIT;
  throw ctkRuntimeException(string + "Invalid STATE:");
  return ctkDicomAppHosting::EXIT;
}
//----------------------------------------------------------------------------
QString ctkDicomSoapState::toStringValue(ctkDicomAppHosting::State state)
{
  switch(state)
    {
    case ctkDicomAppHosting::IDLE:
      return "IDLE";
    case ctkDicomAppHosting::INPROGRESS:
      return "INPROGRESS";
    case ctkDicomAppHosting::COMPLETED:
      return "COMPLETED";
    case ctkDicomAppHosting::SUSPENDED:
      return "SUSPENDED";
    case ctkDicomAppHosting::CANCELED:
      return "CANCELED";
    case ctkDicomAppHosting::EXIT:
      return "EXIT";
    default:
      throw ctkRuntimeException( "Invalid value for state" );

    }
}
Esempio n. 3
0
ChangeTextDescriptor::ChangeTextDescriptor(berry::IConfigurationElement::Pointer changeTextExtensionPoint)
  : m_ChangeTextExtensionPoint(changeTextExtensionPoint)
{
  this->m_Id = this->m_ChangeTextExtensionPoint->GetAttribute(ExtensionPointDefinitionConstants::CHANGETEXT_XMLATTRIBUTE_ID);
  this->m_Name = this->m_ChangeTextExtensionPoint->GetAttribute(ExtensionPointDefinitionConstants::CHANGETEXT_XMLATTRIBUTE_NAME);

  // Check if the "id" and "name" attributes are available
  if (this->m_Id.isNull() || this->m_Name.isNull())
  {
    throw ctkRuntimeException("Invalid changetext configuration element (missing id or name) from: " +
                              m_ChangeTextExtensionPoint->GetContributor()->GetName());
  }

  // Get the optional "description" child element
  QList<berry::IConfigurationElement::Pointer> descriptions(
        this->m_ChangeTextExtensionPoint->GetChildren(ExtensionPointDefinitionConstants::CHANGETEXT_CHILD_DESCRIPTION));

  if(!descriptions.isEmpty())
  {
    this->m_Description = descriptions[0]->GetValue();
  }
}