Example #1
0
SmartPointer<IElementReference> CommandService::RegisterElementForCommand(
    const SmartPointer<ParameterizedCommand>& command,
    const SmartPointer<UIElement>& element)
{
  if (!command->GetCommand()->IsDefined())
  {
    throw NotDefinedException(
        "Cannot define a callback for undefined command "
            + command->GetCommand()->GetId());
  }
  if (element.IsNull())
  {
    throw NotDefinedException("No callback defined for command "
        + command->GetCommand()->GetId());
  }

  QHash<QString, QString> paramMap = command->GetParameterMap();
  QHash<QString, Object::Pointer> parms;
  for (QHash<QString, QString>::const_iterator i = paramMap.begin();
       i != paramMap.end(); ++i)
  {
    Object::Pointer value(new ObjectString(i.value()));
    parms.insert(i.key(), value);
  }
  IElementReference::Pointer ref(new ElementReference(command->GetId(),
                                                      element, parms));
  RegisterElement(ref);
  return ref;
}
Example #2
0
  ParameterType::Pointer Command::GetReturnType() const {
    if (!this->IsDefined()) {
      throw NotDefinedException(
          "Cannot get the return type of an undefined command. " + id);
    }

    return returnType;
  }
Example #3
0
  std::vector<IParameter::Pointer> Command::GetParameters() const {
    if (!this->IsDefined()) {
      throw NotDefinedException(
          "Cannot get the parameters from an undefined command. " + id);
    }

    return parameters;
  }
Example #4
0
bool ParameterType::IsCompatible(const QObject* const value) const
{
  if (!this->IsDefined())
  {
    throw NotDefinedException(
        "Cannot use IsCompatible() with an undefined ParameterType");
  }
  return value->inherits(qPrintable(type));
}
Example #5
0
IParameterValueConverter* ParameterType::GetValueConverter() const
{
  if (!this->IsDefined())
  {
    throw NotDefinedException(
        "Cannot use GetValueConverter() with an undefined ParameterType"); //$NON-NLS-1$
  }

  return parameterTypeConverter.data();
}
Example #6
0
  IParameter::Pointer Command::GetParameter(const std::string& parameterId) const
       {
    if (!this->IsDefined()) {
      throw NotDefinedException(
          "Cannot get a parameter from an undefined command. " + id);
    }

    for (unsigned int i = 0; i < parameters.size(); i++) {
      IParameter::Pointer parameter(parameters[i]);
      if (parameter->GetId() == parameterId) {
        return parameter;
      }
    }

    return IParameter::Pointer(0);
  }
Example #7
0
  std::string CommandManager::GetHelpContextId(const SmartPointer<const Command> command) const
      throw(NotDefinedException) {
    // Check if the command is defined.
    if (!command->IsDefined()) {
      throw NotDefinedException("The command is not defined. " //$NON-NLS-1$
          + command->GetId());
    }

    // Check the handler.
    const IHandler::Pointer handler(command->GetHandler());
    if (handler) {
      const IHandler::WeakPtr weakHandler(handler);
      Poco::HashMap<WeakPointer<IHandler>, std::string, Object::Hash>::ConstIterator itr =
        helpContextIdsByHandler.find(weakHandler);
      if (itr != helpContextIdsByHandler.end() && !itr->second.empty())
      {
        return itr->second;
      }
    }

    // Simply return whatever the command has as a help context identifier.
    return command->GetHelpContextId();
  }
void BaseMatrix::IEQND() const
   { Throw(NotDefinedException("inequalities", "matrices")); }
void BandLUMatrix::GetCol(MatrixRowCol&)
   { Throw(NotDefinedException("GetCol","BandLUMatrix")); }
void CroutMatrix::GetCol(MatrixRowCol&)
   { Throw(NotDefinedException("GetCol","Crout")); }
Example #11
0
void BandLUMatrix::operator=(const BaseMatrix&)
   { Throw(NotDefinedException("=","BandLUMatrix")); }
Example #12
0
void CroutMatrix::operator=(const BaseMatrix&)
   { Throw(NotDefinedException("=","Crout")); }