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

#include <IPMStream.h>

Inheritance diagram for IPMStream:
IPMUnknownCStreamReadCStreamWritePrtMemWriteStream

Public Types

enum  _StreamType { kUnknown, kReader, kWriter }
 
typedef enum IPMStream::_StreamType StreamType
 

Public Member Functions

template<typename T >
void XferEnum (T &e)
 
virtual uchar XferByte (uchar &chr)=0
 
virtual int32 XferByte (uchar *buf, int32 num)=0
 
virtual bool16 XferBool (bool16 &chr)=0
 
virtual int32 XferBool (bool16 *buf, int32 num)=0
 
virtual int16 XferInt16 (int16 &i)=0
 
virtual int32 XferInt16 (int16 *buf, int32 num)=0
 
virtual int32 XferInt32 (int32 &i)=0
 
virtual int32 XferInt32 (int32 *buf, int32 num)=0
 
virtual int64 XferInt64 (int64 &i)=0
 
virtual uintptr_t XferPointer (uintptr_t &i)=0
 
template<class T >
IDType< T > XferID (IDType< T > &id)
 
template<class T >
int32 XferID (IDType< T > *buf, int32 count)
 
virtual ClassID XferID (ClassID &i)=0
 
virtual int32 XferID (ClassID *buf, int32 num)=0
 
virtual ImplementationID XferID (ImplementationID &i)=0
 
virtual int32 XferID (ImplementationID *buf, int32 num)=0
 
virtual WidgetID XferID (WidgetID &i)=0
 
virtual int32 XferID (WidgetID *buf, int32 num)=0
 
virtual PluginID XferID (PluginID &i)=0
 
virtual int32 XferID (PluginID *buf, int32 num)=0
 
virtual PMIID XferID (PMIID &i)=0
 
virtual int32 XferID (PMIID *buf, int32 num)=0
 
virtual ActionID XferID (ActionID &i)=0
 
virtual int32 XferID (ActionID *buf, int32 num)=0
 
virtual ScriptElementID XferID (ScriptElementID &i)=0
 
virtual int32 XferID (ScriptElementID *buf, int32 num)=0
 
virtual ScriptID XferID (ScriptID &i)=0
 
virtual int32 XferID (ScriptID *buf, int32 num)=0
 
virtual LinkClientID XferID (LinkClientID &i)=0
 
virtual int32 XferID (LinkClientID *buf, int32 num)=0
 
virtual UID XferObject (UID &u)=0
 
virtual int32 XferObject (UID *buf, int32 num)=0
 
virtual UID XferReference (UID &u)=0
 
virtual int32 XferReference (UID *buf, int32 num)=0
 
virtual PMRealXferRealNumber (PMReal &r)=0
 
virtual int32 XferRealNumber (PMReal *buf, int32 num)=0
 
virtual void Comment (const char *comment)=0
 
virtual int64 Seek (int64 numberOfBytes, SeekFromWhere fromHere)=0
 
virtual void SetEndOfStream ()=0
 
virtual void Flush ()=0
 
virtual StreamState GetStreamState ()=0
 
virtual bool16 IsReading () const =0
 
virtual bool16 IsWriting () const =0
 
virtual bool16 IsWritingForDuplication (IDataBase **optDestDB=nil) const =0
 
virtual void SetSwapping (bool16 swapOn)=0
 
virtual bool16 GetSwapping () const =0
 
virtual bool16 Open ()=0
 
virtual void Close ()=0
 
- Public Member Functions inherited from IPMUnknown
virtual IPMUnknownQueryInterface (PMIID interfaceID) const =0
 
virtual void AddRef () const =0
 
virtual void Release () const =0
 

Detailed Description

IPMStream is the interface for streaming. It is used for serializing objects to/from the disk, copying objects, reading objects in from files, resources, or memory, etc. Each of the Xfer functions will either Read or Write the data, depending on the stream type. Xfer functions that take two arguments, where the second is a count, read or write an array of data.

Member Typedef Documentation

Member Enumeration Documentation

StreamType
Enumerator
kReader 

Stream is used for reading data in

kWriter 

Stream is used for writing data out

Member Function Documentation

virtual void IPMStream::Close ()
pure virtual

Close the stream. Call this when you are all done with the stream.

Implemented in CStreamRead, and CStreamWrite.

virtual void IPMStream::Comment (const char * comment)
pure virtual

This method is mainly for notation purposes. Streams that write data in a text format write out appropriate syntax for the beginning and ending of structs and arrays.

Implemented in CStreamRead, and CStreamWrite.

virtual void IPMStream::Flush ()
pure virtual

Flushes any pending writes out to the operating system.

Implemented in CStreamRead, and CStreamWrite.

virtual StreamState IPMStream::GetStreamState ()
pure virtual

Return the current stream state. Use this method to tell whether you've read past the end of the stream.

Implemented in CStreamRead, and CStreamWrite.

virtual bool16 IPMStream::GetSwapping () const
pure virtual
Returns
kTrue if the stream is set to swap.

Implemented in CStreamRead, and CStreamWrite.

virtual bool16 IPMStream::IsReading () const
pure virtual

Returns true if the stream is a read (input) stream.

Implemented in CStreamRead, and CStreamWrite.

virtual bool16 IPMStream::IsWriting () const
pure virtual

Returns true if the stream is a write (output) stream.

Implemented in CStreamRead, and CStreamWrite.

virtual bool16 IPMStream::IsWritingForDuplication (IDataBase ** optDestDB = nil) const
pure virtual

Write streams which are created for the purposes of duplicating, such as from IScrapUtils::CopyObject(), may influence how persisting implemenations behave if they have state that is dependent on external state. The value returned here is by definition constant throughout the life of the stream. Most implementors of IPMStreams will always return kFalse and only those which duplicate objects, rathern than simply persisting them, in XferReference() and XferObject() should be returning kTrue.

Parameters
optDestDBPointer to IDataBase pointer. If non-nil, will be filled in with the destination if the method returns kTrue, otherwise unchanged.
Returns
kTrue if IsWriting() return kTrue and the underlying stream is for the purposes of stream duplication.

Implemented in CStreamRead, and CStreamWrite.

virtual bool16 IPMStream::Open ()
pure virtual

Open the stream for reading or writing. This must be called before any Xfers are called. It gets called for you by the StreamUtils functions. Typically streams may have data interfaces that must be filled out before you can call Open.

Returns
kTrue if stream successfully opened, kFalse otherwise.

Implemented in CStreamRead, and CStreamWrite.

virtual int64 IPMStream::Seek (int64 numberOfBytes,
SeekFromWhere fromHere 
)
pure virtual
Set the location for the next xfer. Analogous to seeking in a file.

Returns
new location in the stream, following the requested Seek. Hence stream->Seek(0,kSeekFromCurrent) returns the current stream position.

Implemented in CStreamRead, and CStreamWrite.

virtual void IPMStream::SetEndOfStream ()
pure virtual

Set the end of the stream at the current location. Truncates the stream!

Implemented in CStreamRead, and CStreamWrite.

virtual void IPMStream::SetSwapping (bool16 swapOn)
pure virtual

Turn byte swapping on/off. When on, the stream will treat the data target as having the oppsite byte order to the current platform. The stream will automatically byte swap if swapping has been turned on, enabling conversion across platforms. Swapping is off by default.

Implemented in CStreamRead, and CStreamWrite.

virtual bool16 IPMStream::XferBool (bool16 & chr)
pure virtual

Read or write a single bool16.

Implemented in CStreamRead, and CStreamWrite.

virtual int32 IPMStream::XferBool (bool16 * buf,
int32 num 
)
pure virtual

Read or write an array of bools.

Implemented in CStreamRead, and CStreamWrite.

virtual uchar IPMStream::XferByte (uchar & chr)
pure virtual

Read or write a single byte.

Implemented in CStreamRead, and CStreamWrite.

virtual int32 IPMStream::XferByte (uchar * buf,
int32 num 
)
pure virtual

Read or write an array of bytes.

Implemented in CStreamRead, and CStreamWrite.

template<typename T >
void IPMStream::XferEnum (T & e)
inline

Read or write a single enum value.

template<class T >
IDType<T> IPMStream::XferID (IDType< T > & id)
inline

Read or write a single IDType id. Generic implementation for most IDType based types. If necessary, one can specialize the implementation.

template<class T >
int32 IPMStream::XferID (IDType< T > * buf,
int32 count 
)
inline

Read or write a single IDType id. Generic implementation for most IDType based types. If necessary, one can specialize the implementation.

virtual ClassID IPMStream::XferID (ClassIDi)
pure virtual

Read or write a single ClassID.

Implemented in CStreamRead, and CStreamWrite.

virtual int32 IPMStream::XferID (ClassIDbuf,
int32 num 
)
pure virtual

Read or write an array of ClassIDs.

Implemented in CStreamRead, and CStreamWrite.

virtual ImplementationID IPMStream::XferID (ImplementationIDi)
pure virtual

Read or write a single ImplementationID. idSpace is implied to be kImplementationIDSpace

Implemented in CStreamRead, and CStreamWrite.

virtual int32 IPMStream::XferID (ImplementationIDbuf,
int32 num 
)
pure virtual

Read or write an array of ImplementationIDs.

Implemented in CStreamRead, and CStreamWrite.

virtual WidgetID IPMStream::XferID (WidgetIDi)
pure virtual

Read or write a single WidgetID. idSpace is implied to be kWidgetIDSpace

Implemented in CStreamRead, and CStreamWrite.

virtual int32 IPMStream::XferID (WidgetIDbuf,
int32 num 
)
pure virtual

Read or write an array of WidgetIDs.

Implemented in CStreamRead, and CStreamWrite.

virtual PluginID IPMStream::XferID (PluginIDi)
pure virtual

Read or write a single PluginID. idSpace is implied to be kPluginIDSpace

Implemented in CStreamRead, and CStreamWrite.

virtual int32 IPMStream::XferID (PluginIDbuf,
int32 num 
)
pure virtual

Read or write an array of PluginIDs.

Implemented in CStreamRead, and CStreamWrite.

virtual PMIID IPMStream::XferID (PMIIDi)
pure virtual

Read or write a single PMIID. idSpace is implied to be kInterfaceIDSpace

Implemented in CStreamRead, and CStreamWrite.

virtual int32 IPMStream::XferID (PMIIDbuf,
int32 num 
)
pure virtual

Read or write an array of PMIIDs.

Implemented in CStreamRead, and CStreamWrite.

virtual ActionID IPMStream::XferID (ActionIDi)
pure virtual

Read or write a single Action id. idSpace is implied to be kActionIDSpace

Implemented in CStreamRead, and CStreamWrite.

virtual int32 IPMStream::XferID (ActionIDbuf,
int32 num 
)
pure virtual

Read or write an array of ActionIDs.

Implemented in CStreamRead, and CStreamWrite.

virtual ScriptElementID IPMStream::XferID (ScriptElementIDi)
pure virtual

Read or write a single ScriptInfo id. idSpace is implied to be kScriptInfoIDSpace

Implemented in CStreamRead, and CStreamWrite.

virtual int32 IPMStream::XferID (ScriptElementIDbuf,
int32 num 
)
pure virtual

Read or write an array of ScriptElementIDs.

Implemented in CStreamRead, and CStreamWrite.

virtual ScriptID IPMStream::XferID (ScriptIDi)
pure virtual

Read or write a single ScriptID id.

Implemented in CStreamRead, and CStreamWrite.

virtual int32 IPMStream::XferID (ScriptIDbuf,
int32 num 
)
pure virtual

Read or write an array of ScriptIDs.

Implemented in CStreamRead, and CStreamWrite.

virtual LinkClientID IPMStream::XferID (LinkClientIDi)
pure virtual

Read or write a single LinkClientID id. idSpace is implied to be kLinkClientIDSpace.

Implemented in CStreamRead, and CStreamWrite.

virtual int32 IPMStream::XferID (LinkClientIDbuf,
int32 num 
)
pure virtual

Read or write an array of LinkClientIDs.

Implemented in CStreamRead, and CStreamWrite.

virtual int16 IPMStream::XferInt16 (int16 & i)
pure virtual

Read or write a single int16.

Implemented in CStreamRead, and CStreamWrite.

virtual int32 IPMStream::XferInt16 (int16 * buf,
int32 num 
)
pure virtual

Read or write an array of int16.

Implemented in CStreamRead, and CStreamWrite.

virtual int32 IPMStream::XferInt32 (int32 & i)
pure virtual

Read or write a single int32.

Implemented in CStreamRead, and CStreamWrite.

virtual int32 IPMStream::XferInt32 (int32 * buf,
int32 num 
)
pure virtual

Read or write an array of int32.

Implemented in CStreamRead, and CStreamWrite.

virtual int64 IPMStream::XferInt64 (int64 & i)
pure virtual

Read or write a single int64.

Implemented in CStreamRead, and CStreamWrite.

virtual UID IPMStream::XferObject (UIDu)
pure virtual

Read or write a single UID-based object. Call this method when an object is being written out, and the object has a UID to another object that it owns. The stream will decide whether to output just the UID, or to make a copy of the object. For instance, if an object has children, it should call XferObject to write out the children.

Implemented in CStreamRead, and CStreamWrite.

virtual int32 IPMStream::XferObject (UIDbuf,
int32 num 
)
pure virtual

Read or write an array of objects.

Implemented in CStreamRead, and CStreamWrite.

virtual uintptr_t IPMStream::XferPointer (uintptr_t & i)
pure virtual

Read or write a single pointer - this will fail if writing to a user document, and return garbage when reading from a user document; useful only for memory streams. There is no validity checking on the pointer, it is up to the reader/writer to manage the pointers lifetime. On a 32 bit machine, this will xfer 4 bytes, on a 64 bit machine, it will xfer 8 bytes.

Implemented in CStreamRead, and CStreamWrite.

virtual PMReal& IPMStream::XferRealNumber (PMRealr)
pure virtual

Read or write a single real number.

Implemented in CStreamRead, and CStreamWrite.

virtual int32 IPMStream::XferRealNumber (PMRealbuf,
int32 num 
)
pure virtual

Read or write an array of real number.

Implemented in CStreamRead, and CStreamWrite.

virtual UID IPMStream::XferReference (UIDu)
pure virtual

Read or write a single object reference. Call this method when an object is being written out, and the object has a UID to another object but it just refers to the other object, it doesn't own it. For instance, if an object has a reference to some global object that is owned by the document (for instance a style or color), it uses XferReference to tell the stream to map the reference from a reference to a color in the source document, to an equivalent color in the destination document.

Implemented in CStreamRead, and CStreamWrite.

virtual int32 IPMStream::XferReference (UIDbuf,
int32 num 
)
pure virtual

Read or write an array of object references.

Implemented in CStreamRead, and CStreamWrite.