本文整理汇总了C++中SmartPointer::GetParameters方法的典型用法代码示例。如果您正苦于以下问题:C++ SmartPointer::GetParameters方法的具体用法?C++ SmartPointer::GetParameters怎么用?C++ SmartPointer::GetParameters使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SmartPointer
的用法示例。
在下文中一共展示了SmartPointer::GetParameters方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: NullPointerException
ParameterizedCommand::ParameterizedCommand(const SmartPointer<Command> command,
const std::vector<Parameterization>& params) :
command(command), hashCode(HASH_CODE_NOT_COMPUTED)
{
if (!command)
{
throw Poco::NullPointerException(
"A parameterized command cannot have a null command");
}
std::vector<IParameter::Pointer> parameters;
try
{
parameters = command->GetParameters();
} catch (const NotDefinedException* /*e*/)
{
// This should not happen.
}
if (!params.empty() && !parameters.empty())
{
for (unsigned int j = 0; j < parameters.size(); j++)
{
for (unsigned int i = 0; i < params.size(); i++)
{
if (parameters[j] == params[i].GetParameter())
{
this->parameterizations.push_back(params[i]);
}
}
}
}
}
示例2: RegisterElement
void CommandService::RegisterElement(const SmartPointer<IElementReference>& elementReference)
{
QList<IElementReference::Pointer>& parameterizedCommands = commandCallbacks[elementReference->GetCommandId()];
parameterizedCommands.push_back(elementReference);
// If the active handler wants to update the callback, it can do
// so now
Command::Pointer command = GetCommand(elementReference->GetCommandId());
if (command->IsDefined())
{
if (IElementUpdater::Pointer updater = command->GetHandler().Cast<IElementUpdater>())
{
updater->UpdateElement(elementReference->GetElement().GetPointer(),
elementReference->GetParameters());
}
}
}
示例3: expansion
QList<ParameterizedCommand::Pointer>
ParameterizedCommand::GenerateCombinations(const SmartPointer<Command> command)
{
QList<IParameter::Pointer> parameters(command->GetParameters());
typedef QList<QList<Parameterization> > ExpandedParamsType;
const ExpandedParamsType expansion(ExpandParameters(0, parameters));
QList<ParameterizedCommand::Pointer> combinations;
for (ExpandedParamsType::const_iterator expansionItr = expansion.begin();
expansionItr != expansion.end(); ++expansionItr)
{
QList<Parameterization> combination(*expansionItr);
QList<Parameterization> parameterizations(combination);
ParameterizedCommand::Pointer pCmd(new ParameterizedCommand(command,
parameterizations));
combinations.push_back(pCmd);
}
return combinations;
}
示例4: expansion
std::vector<ParameterizedCommand::Pointer>
ParameterizedCommand::GenerateCombinations(const SmartPointer<Command> command)
throw(NotDefinedException)
{
std::vector<IParameter::Pointer> parameters(command->GetParameters());
typedef std::vector<std::list<Parameterization> > ExpandedParamsType;
const ExpandedParamsType expansion(ExpandParameters(0, parameters));
std::vector<ParameterizedCommand::Pointer> combinations;
for (ExpandedParamsType::const_iterator expansionItr = expansion.begin();
expansionItr != expansion.end(); ++expansionItr)
{
std::list<Parameterization> combination(*expansionItr);
std::vector<Parameterization> parameterizations(combination.begin(), combination.end());
ParameterizedCommand::Pointer pCmd(new ParameterizedCommand(command,
parameterizations));
combinations.push_back(pCmd);
}
return combinations;
}
示例5: result
SmartPointer<ParameterizedCommand> RegistryPersistence::ReadParameters(
const SmartPointer<IConfigurationElement>& configurationElement,
QList<SmartPointer<IStatus> >& warningsToLog,
const SmartPointer<Command>& command)
{
const QList<IConfigurationElement::Pointer> parameterElements = configurationElement
->GetChildren(TAG_PARAMETER);
if (parameterElements.isEmpty())
{
ParameterizedCommand::Pointer result(new ParameterizedCommand(command, QList<Parameterization>()));
return result;
}
QList<Parameterization> parameters;
foreach (const IConfigurationElement::Pointer& parameterElement, parameterElements)
{
// Read out the id.
const QString id = parameterElement->GetAttribute(ATT_ID);
if (id.isEmpty())
{
// The id should never be null. This is invalid.
AddWarning(warningsToLog, "Parameters need an id", configurationElement);
continue;
}
// Find the parameter on the command.
IParameter::Pointer parameter;
try
{
const QList<IParameter::Pointer> commandParameters = command->GetParameters();
foreach (const IParameter::Pointer& currentParameter, commandParameters)
{
if (currentParameter->GetId() == id)
{
parameter = currentParameter;
break;
}
}
}
catch (const NotDefinedException& /*e*/)
{
// This should not happen.
}
if (parameter.IsNull())
{
// The name should never be null. This is invalid.
AddWarning(warningsToLog, "Could not find a matching parameter",
configurationElement, id);
continue;
}
// Read out the value.
const QString value = parameterElement->GetAttribute(ATT_VALUE);
if (value.isEmpty())
{
// The name should never be null. This is invalid.
AddWarning(warningsToLog, "Parameters need a value",
configurationElement, id);
continue;
}
parameters.push_back(Parameterization(parameter, value));
}
if (parameters.isEmpty())
{
ParameterizedCommand::Pointer result(new ParameterizedCommand(command, QList<Parameterization>()));
return result;
}
ParameterizedCommand::Pointer result(new ParameterizedCommand(command, parameters));
return result;
}