Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
berry::IParameterValueConverter Struct Referenceabstract

#include <berryIParameterValueConverter.h>

Public Member Functions

virtual ~IParameterValueConverter ()
 
virtual Object::Pointer ConvertToObject (const QString &parameterValue)=0
 
virtual QString ConvertToString (const Object::Pointer &parameterValue)=0
 

Detailed Description

Supports conversion between objects and strings for command parameter values. Extenders must produce strings that identify objects (of a specific command parameter type) as well as consume the strings to locate and return the objects they identify.

This class offers multiple handlers of a command a consistent way of converting string parameter values into the objects that the handlers would prefer to deal with. This class also gives clients a way to serialize object parameters as strings so that entire parameterized commands can be serialized, stored and later deserialized and executed.

This class will typically be extended so the subclass can be referenced from the converter attribute of the commandParameterType elemement of the org.blueberry.ui.commands extension-point. Objects implementing this interface may also be passed directly to ParameterType#Define(IParameterValueConverter::Pointer) by clients.

See also
ParameterType::Define(IParameterValueConverter::Pointer)
ParameterizedCommand::Serialize()

Definition at line 55 of file berryIParameterValueConverter.h.

Constructor & Destructor Documentation

berry::IParameterValueConverter::~IParameterValueConverter ( )
virtual

Definition at line 21 of file berryIParameterValueConverter.cpp.

Member Function Documentation

virtual Object::Pointer berry::IParameterValueConverter::ConvertToObject ( const QString &  parameterValue)
pure virtual

Returns whether the provided value is compatible with this parameter value converter. An object is compatible with a converter if the object is an instance of the class defined in the type attribute of the commandParameterType element.

Parameters
valuean object to check for compatibility with this parameter type; may be null.
Returns
true if the value is compatible with this converter, false otherwise Converts a string encoded command parameter value into the parameter value object.
Parameters
parameterValuea command parameter value string describing an object; may be null
Returns
the object described by the command parameter value string; may be null
Exceptions
ParameterValueConversionExceptionif an object cannot be produced from the parameterValue string
virtual QString berry::IParameterValueConverter::ConvertToString ( const Object::Pointer parameterValue)
pure virtual

Converts a command parameter value object into a string that encodes a reference to the object or serialization of the object.

Parameters
parameterValuean object to convert into an identifying string; may be null
Returns
a string describing the provided object; may be null
Exceptions
ParameterValueConversionExceptionif a string reference or serialization cannot be provided for the parameterValue

The documentation for this struct was generated from the following files: