InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
CConversionProvider Class Referenceabstract

#include <CConversionProvider.h>

Inheritance diagram for CConversionProvider:
CPMUnknown< IConversionProvider >IConversionProviderIPMUnknown

Public Member Functions

 CConversionProvider (PluginID plugin, IPMUnknown *boss)
 
virtual int32 CountConversions () const =0
 
virtual void GetNthConversion (int32 n, VersionID *fromVersion, VersionID *toVersion) const =0
 
virtual int32 CountRemovedPlugins (const VersionID &fromVersion, const VersionID &toVersion) const
 
virtual PluginID GetNthRemovedPlugin (const VersionID &fromVersion, const VersionID &toVersion, int32 n) const
 
virtual int32 CountIgnoredPlugins (const VersionID &fromVersion, const VersionID &toVersion) const
 
virtual PluginID GetNthIgnoredPlugin (const VersionID &fromVersion, const VersionID &toVersion, int32 n) const
 
virtual int32 CountClassAliases () const
 
virtual int32 CountImplementationAliases () const
 
virtual void GetNthClassAlias (int32 n, ClassID &fromID, VersionID &fromVersion, ClassID &toID, VersionID &toVersion) const
 
virtual void GetNthImplementationAlias (int32 n, ImplementationID &fromID, VersionID &fromVersion, ImplementationID &toID, VersionID &toVersion) const
 
virtual int32 CountPlugins () const
 
virtual PluginID GetNthPlugin (int32 n) const
 
virtual bool16 DoesConversionRenumberClass (int32 conversionIndex) const
 
virtual bool16 DoesConversionRenumberImplementation (int32 conversionIndex) const
 
virtual
IConversionProvider::ConversionStatus 
ShouldConvertImplementation (ImplementationID tag, ClassID context, int32 conversionIndex) const
 
virtual
IConversionProvider::ConversionStatus 
ShouldConvertClass (ClassID clsID, ImplementationID context, int32 conversionIndex) const
 
virtual ImplementationID ConvertTag (ImplementationID tag, ClassID forClass, int32 conversionIndex, int32 inLength, IPMStream *oldData, IPMStream *newData, IterationStatus whichIteration)
 
virtual ClassID ConvertClass (ClassID clsID, ImplementationID embeddedContext, int32 conversionIndex, int32 inLength, IPMStream *oldData, IPMStream *newData, IterationStatus whichIteration)
 
- Public Member Functions inherited from CPMUnknown< IConversionProvider >
IPMUnknownQueryInterface (PMIID interfaceID) const
 
void AddRef () const
 
void Release () const
 
void PreDirty (ImplementationID prop=kInvalidImpl, bool16 allowModification=kTrue)
 
void PreDirtyNoMessage (ImplementationID prop=kInvalidImpl, bool16 allowModification=kTrue)
 
 CPMUnknown (const CPMUnknown &)=delete
 
CPMUnknownoperator= (const CPMUnknown &)=delete
 

Protected Member Functions

void RemoveImplementation (ImplementationID implID, ClassID classID, int32 majorFormat, int32 minorFormat)
 
void RemoveClass (ClassID classID, int32 majorFormat, int32 minorFormat)
 
void RemovePlugin (PluginID plugin, int32 majorFormat, int32 minorFormat)
 
void IgnorePlugin (PluginID plugin, int32 majorFormat, int32 minorFormat)
 
void MoveClass (ClassID fromClass, PluginID fromPlugin, int32 fromMajorFormat, int32 fromMinorFormat, ClassID toClass, int32 toMajorFormat, int32 toMinorFormat)
 
void MoveImplementation (ImplementationID fromImpl, PluginID fromPlugin, int32 fromMajorFormat, int32 fromMinorFormat, ImplementationID toImpl, int32 toMajorFormat, int32 toMinorFormat)
 
- Protected Member Functions inherited from CPMUnknown< IConversionProvider >
 CPMUnknown (IPMUnknown *boss)
 

Additional Inherited Members

- Public Types inherited from IConversionProvider
enum  ConversionStatus { kNothingToConvert, kMustConvert, kMustRemove, kCantConvert }
 
enum  IterationStatus { kFirstIteration, kMiddleIteration, kLastIteration }
 
- Protected Attributes inherited from CPMUnknown< IConversionProvider >
HelperInterface fHelperInterface
 

Detailed Description

This class provides a useful base implementation of IConversionProvider. It handles most of the details of the rather complex interaction between IConversionMgr and IConversionProvider. A fully functional conversion provider can be written by using the protected methods of this class to define the equivalent of Schema Directives and the overriding key IConversionProvider methods to perform data-based conversions.

The public methods in this class are uncommented because they are documented in IConversionProvider.

See Also
IConversionMgr
IConversionProvider

Member Function Documentation

virtual ClassID CConversionProvider::ConvertClass (ClassID clsID,
ImplementationID embeddedContext,
int32 conversionIndex,
int32 inLength,
IPMStreaminStream,
IPMStreamoutStream,
IterationStatus whichIteration 
)
virtual

Convert the contents of the class from the old format to the new. Returns the new ClassID, which will be the same as the clsID parameter, unless the class was renumbered.

If kInvalidClass is returned, the UID will be deleted from the database.

Parameters
clsIDIN The ID of the class to be converted
embeddedContextIN The ID of the implementation that contains the class, or kInvalidImpl
conversionIndexIN The index (in this conversion provider's list of possible conversions) to be performed
inLengthIN Byte length of the incoming data to be converted
inStreamIN Stream that contains the data to be converted
outStreamIN Stream that will contain the converted data
whichIterationIN Which conversion is this in a series of conversion steps
Returns
The post-conversion ID of the class, or kInvalidClass if the class was removed

Implements IConversionProvider.

virtual ImplementationID CConversionProvider::ConvertTag (ImplementationID tag,
ClassID forClass,
int32 conversionIndex,
int32 inLength,
IPMStreaminStream,
IPMStreamoutStream,
IterationStatus whichIteration 
)
virtual

Convert the contents of the implementation from the old format to the new . The incoming contents from inStream will be whatever was written by the ReadWrite function in version inVersion. The outgoing contents into outStream should be whatever will be expected by ReadWrite for the output version. Returns the new ImplementationID, which will be the same as the tag parameter, unless the implementation was renumbered.

If ConvertTag doesn't write any data to the output stream, the ImplementationID and associated data are removed from the UID.

Parameters
tagIN The ID of the implementation to be converted
forClassIN The ID of the class that contains the implementation
conversionIndexIN The index (in this conversion provider's list of possible conversions) to be performed
inLengthIN Byte length of the incoming data to be converted
inStreamIN Stream that contains the data to be converted
outStreamIN Stream that will contain the converted data
whichIterationIN Which conversion is this in a series of conversion steps
Returns
The post-conversion ID of the implementation, or kInvalidImpl if the implementation was removed

Implements IConversionProvider.

virtual int32 CConversionProvider::CountClassAliases () const
virtual

Return the number of "aliases" (Created when a Class is moved from one Plugin to another).

Returns
The count

Implements IConversionProvider.

virtual int32 CConversionProvider::CountConversions () const
pure virtual

Return the number of conversions this converter can convert.

Returns
The count

Implements IConversionProvider.

virtual int32 CConversionProvider::CountIgnoredPlugins (const VersionIDfromVersion,
const VersionIDtoVersion 
) const
virtual

Return the number of plugins set to "Ignore" between the specified range of format numbers.

Parameters
fromVersionIN The source version
toVersionIN The target version
Returns
The count

Implements IConversionProvider.

virtual int32 CConversionProvider::CountImplementationAliases () const
virtual

Return the number of "aliases" (Created when an Implementation is moved from one Plugin to another).

Returns
The count

Implements IConversionProvider.

virtual int32 CConversionProvider::CountPlugins () const
virtual

Return the number of plugins that this converter represents.

Returns
The count

Implements IConversionProvider.

virtual int32 CConversionProvider::CountRemovedPlugins (const VersionIDfromVersion,
const VersionIDtoVersion 
) const
virtual

Return the number of plugins removed between the specified range of format numbers.

Parameters
fromVersionIN The source version
toVersionIN The target version
Returns
The count

Implements IConversionProvider.

virtual bool16 CConversionProvider::DoesConversionRenumberClass (int32 conversionIndex) const
virtual

Would this conversion renumber a class?

Parameters
conversionIndexIN Which conversion (in this conversion provider's list)
Returns
kTrue if the conversion would renumber a class

Implements IConversionProvider.

virtual bool16 CConversionProvider::DoesConversionRenumberImplementation (int32 conversionIndex) const
virtual

Would this conversion renumber an implementation?

Parameters
conversionIndexIN Which conversion (in this conversion provider's list)
Returns
kTrue if the conversion would renumber an implementation

Implements IConversionProvider.

virtual void CConversionProvider::GetNthClassAlias (int32 n,
ClassIDfromID,
VersionIDfromVersion,
ClassIDtoID,
VersionIDtoVersion 
) const
virtual

Return the n'th class alias.

Parameters
nIN Which alias
fromIDOUT The source class ID
fromVersionOUT The source version
toIDOUT The target class ID
toVersionOUT The target version

Implements IConversionProvider.

virtual void CConversionProvider::GetNthConversion (int32 i,
VersionIDfromVersion,
VersionIDtoVersion 
) const
pure virtual

Return the n'th conversion supported by this converter. The answer is in the form of a pair of VersionIDs. You might think of it as meaning "The i-th conversion transforms data in the format 'fromVersion' to format 'toVersion'"

Parameters
iIN Which conversion
fromVersionOUT The source version of this conversion
toVersionOUT The target version of this conversion

Implements IConversionProvider.

virtual PluginID CConversionProvider::GetNthIgnoredPlugin (const VersionIDfromVersion,
const VersionIDtoVersion,
int32 n 
) const
virtual

Return the n'th ignored plugin.

Parameters
fromVersionIN The source version
toVersionIN The target version
nIN Which plugin
Returns
The ignored plugin ID, or kInvalidPlugin if n is invalid

Implements IConversionProvider.

virtual void CConversionProvider::GetNthImplementationAlias (int32 n,
ImplementationIDfromID,
VersionIDfromVersion,
ImplementationIDtoID,
VersionIDtoVersion 
) const
virtual

Return the n'th implementation alias.

Parameters
nIN Which alias
fromIDOUT The source implementation ID
fromVersionOUT The source version
toIDOUT The target implementation ID
toVersionOUT The target version

Implements IConversionProvider.

virtual PluginID CConversionProvider::GetNthPlugin (int32 n) const
virtual

Return the Nth plugin.

Parameters
nIN Which plugin
Returns
The plugin ID, or kInvalidPlugin if n is invalid

Implements IConversionProvider.

virtual PluginID CConversionProvider::GetNthRemovedPlugin (const VersionIDfromVersion,
const VersionIDtoVersion,
int32 n 
) const
virtual

Return the n'th removed plugin.

Parameters
fromVersionIN The source version
toVersionIN The target version
nIN Which plugin
Returns
The removed plugin ID, or kInvalidPlugin if n is invalid

Implements IConversionProvider.

void CConversionProvider::IgnorePlugin (PluginID plugin,
int32 majorFormat,
int32 minorFormat 
)
protected

For use by subclasses to tell us when a plugin's priority should be set to "Ignored".

Parameters
classIDIN Which plugin is being ignored
majorFormatIN As of this major format number
minorFormatIN and this minor format number
void CConversionProvider::MoveClass (ClassID fromClass,
PluginID fromPlugin,
int32 fromMajorFormat,
int32 fromMinorFormat,
ClassID toClass,
int32 toMajorFormat,
int32 toMinorFormat 
)
protected

For use by subclasses to tell us when a class has moved from another plugin. It is implied that the class is moving to the plugin that contains this conversion provider.

Parameters
fromClassIN Which class is being moved
fromPluginIN From which plugin
fromMajorFormatIN The old plugin's major format number at the time of the move
fromMinorFormatIN and its minor format number
toClassIN The new class ID
toMajorFormatIN This plugin's major format number at the time of the move
toMinorFormatIN and its minor format number
void CConversionProvider::MoveImplementation (ImplementationID fromImpl,
PluginID fromPlugin,
int32 fromMajorFormat,
int32 fromMinorFormat,
ImplementationID toImpl,
int32 toMajorFormat,
int32 toMinorFormat 
)
protected

For use by subclasses to tell us when an implementation has moved from another plugin. It is implied that the implementation is moving to the plugin that contains this conversion provider.

Parameters
fromImplIN Which implementation is being moved
fromPluginIN From which plugin
fromMajorFormatIN The old plugin's major format number at the time of the move
fromMinorFormatIN and its minor format number
toImplIN The new implementation ID
toMajorFormatIN This plugin's major format number at the time of the move
toMinorFormatIN and its minor format number
void CConversionProvider::RemoveClass (ClassID classID,
int32 majorFormat,
int32 minorFormat 
)
inlineprotected

For use by subclasses to tell us when a class has been removed.

Parameters
classIDIN Which class is being removed
majorFormatIN As of this major format number
minorFormatIN and this minor format number
void CConversionProvider::RemoveImplementation (ImplementationID implID,
ClassID classID,
int32 majorFormat,
int32 minorFormat 
)
protected

For use by subclasses to tell us when an implementation has been removed from a class.

Parameters
implIDIN Which implementation is being removed
classIDIN From which class
majorFormatIN As of this major format number
minorFormatIN and this minor format number
void CConversionProvider::RemovePlugin (PluginID plugin,
int32 majorFormat,
int32 minorFormat 
)
protected

For use by subclasses to tell us when a plugin has been removed.

Parameters
classIDIN Which plugin is being removed
majorFormatIN As of this major format number
minorFormatIN and this minor format number
virtual IConversionProvider::ConversionStatus CConversionProvider::ShouldConvertClass (ClassID clsID,
ImplementationID context,
int32 conversionIndex 
) const
virtual

Returns whether the class must be run through the converter to update from one version to another.

Parameters
clsIDIN Which class
contextIN In which context, kInvalidImpl means "in any context"
conversionIndexIN Which conversion (in this conversion provider's list)
Returns
The conversion status

Implements IConversionProvider.

virtual IConversionProvider::ConversionStatus CConversionProvider::ShouldConvertImplementation (ImplementationID tag,
ClassID context,
int32 conversionIndex 
) const
virtual

Returns whether the implementation must be run through the converter to update from one version to another.

Parameters
tagIN Which implementation
contextIN In which context, kInvalidClass means "in any context"
conversionIndexIN Which conversion (in this conversion provider's list)
Returns
The conversion status

Implements IConversionProvider.