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; }
ParameterType::Pointer Command::GetReturnType() const { if (!this->IsDefined()) { throw NotDefinedException( "Cannot get the return type of an undefined command. " + id); } return returnType; }
std::vector<IParameter::Pointer> Command::GetParameters() const { if (!this->IsDefined()) { throw NotDefinedException( "Cannot get the parameters from an undefined command. " + id); } return parameters; }
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)); }
IParameterValueConverter* ParameterType::GetValueConverter() const { if (!this->IsDefined()) { throw NotDefinedException( "Cannot use GetValueConverter() with an undefined ParameterType"); //$NON-NLS-1$ } return parameterTypeConverter.data(); }
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); }
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")); }
void BandLUMatrix::operator=(const BaseMatrix&) { Throw(NotDefinedException("=","BandLUMatrix")); }
void CroutMatrix::operator=(const BaseMatrix&) { Throw(NotDefinedException("=","Crout")); }