InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
VOS_SimpleCursor Class Reference

#include <VOSSimpleCursor.h>

Inheritance diagram for VOS_SimpleCursor:
VOS_Cursor

Public Member Functions

 VOS_SimpleCursor (IPMUnknown *cache)
 
 VOS_SimpleCursor (IPMUnknown *cache, IVOSDiskPage *block, int32 offset)
 
 VOS_SimpleCursor (const VOS_SimpleCursor &other)
 
VOS_SimpleCursoroperator= (const VOS_SimpleCursor &other)
 
VOS_SimpleCursor GetPreviousSimple (bool16 *prevExists=nil) const
 
VOS_SimpleCursor GetNextSimple (bool16 *nextExists=nil) const
 
bool16 MoveToNext ()
 
bool16 MoveToPrevious ()
 
bool16 AtBeginning () const
 
bool16 AtEnd () const
 
int32 LocalOffset () const
 
void IncrementOffset (int32 delta)
 
void SetOffset (int32 off)
 
int32 ObjectLength () const
 
void DirtyObject ()
 
VOS_ObjectQueryObject ()
 
bool16 IsEmpty () const
 
bool16 RemoveObject (bool16 deleteIt=kTrue)
 
void RemoveObjects (int32 *pLen2Del, VOS_SavedData *data)
 
void CopyObjects (int32 *pLen2Copy, VOS_SavedData *copyInto=nil)
 
void Rationalize ()
 
void Clear ()
 
IPMUnknownQueryOwningObject ()
 

Static Public Member Functions

static void ReleaseObject (VOS_Object *obj)
 

Protected Member Functions

void AddUndoObject (bool16 front, VOS_SavedData *undo, bool16 *nextExists, int32 len2Del)
 
void CopyObject (bool16 front, VOS_SavedData *copy, bool16 *nextExists, int32 len2Copy)
 
void CopyPageRef (VOS_SavedData *copy, bool16 *unused, int32 len2Copy)
 

Protected Attributes

IPMUnknownfOwner
 
VOS_ObjectfObject
 
int32 fObjOffset
 

Detailed Description

VOS_SimpleCursor is basically an iterator used to iterate over text model strands. A VOS_Cursor is returned from IVOSCache::Locate(). The returned object must be deleted. The iterator points to an object (VOS_Object) and has an internal offset into that object. A particular run of characters could be contained within one VOS_Object and the exact position would be specified by the local offset. This is not meant to be directly constructed, but only retrieved from the IVOSCache interface of the strand. NOTE: This is not derived from IPMUnknown.

See Also
ITextModel
IVOSCache
VOS_Object
VOS_Cursor
VOS_SavedData

Member Function Documentation

void VOS_SimpleCursor::AddUndoObject (bool16 front,
VOS_SavedDataundo,
bool16 * nextExists,
int32 len2Del 
)
protected
add this object to the VOS_SavedData data structure for undo of delete.

Only called by RemoveObjects(). Cursor moves forward when nextExists and len2Del > 0.

Parameters
frontspecifies whether to add this object to the front or the end of the datastructure undo.
undois the data structure to add to.
nextExistsRETURNS kTrue if this is not the last object.
len2Delis the number of characters to delete after this object.
bool16 VOS_SimpleCursor::AtBeginning () const
AtBeginning check

Returns
true if the iterator is pointing at the beginning of the strand
bool16 VOS_SimpleCursor::AtEnd () const
AtEnd check

Returns
true if the iterator is pointing at the end of the strand
void VOS_SimpleCursor::Clear ()

Remove the link to the pointed to object completely.

void VOS_SimpleCursor::CopyObject (bool16 front,
VOS_SavedDatacopy,
bool16 * nextExists,
int32 len2Copy 
)
protected
copy this object to the VOS_SavedData data structure for copy-paste.

Only called by CopyObjects(). Cursor moves forward when nextExists and len2Copy > 0.

Parameters
frontspecifies whether to add this object to the front or the end of the datastructure undo.
copyis the data structure to add to.
nextExistsRETURNS kTrue if this is not the last object.
len2Copyis the number of characters to copy after this object.
void VOS_SimpleCursor::CopyObjects (int32 * pLen2Copy,
VOS_SavedDatacopyInto = nil 
)
Copy all objects from the data structure starting with the current location and

contained within the passed in length.

Parameters
pLen2Copyspecifies the number of character positions to copy. Only entire objects are copied. If the length to copy spans 2 full objects plus half of a third, the parameter is set to the number of characters to copy from the 3rd object, and the iterator is left pointing to it.
copyIntopoints to a data structure to hold the copied objects.
void VOS_SimpleCursor::CopyPageRef (VOS_SavedDatacopy,
bool16 * unused,
int32 len2Copy 
)
protected
copy the entire VOS_DiskPage of the object pointed to into the VOS_SavedData data structure for copy-paste.

Only called by CopyObjects().

Parameters
copyis the data structure to add to.
unusedis unused.
len2Copyis the number of characters to copy beyond that page. It is used to possible advance the cursor.
void VOS_SimpleCursor::DirtyObject ()
inline

Mark the object dirty.

VOS_SimpleCursor VOS_SimpleCursor::GetNextSimple (bool16 * nextExists = nil) const
GetNextSimple -- get a new iterator pointing to the next object.

Parameters
nextExistsis true when the iterator wasn't already at the end.
Returns
a new iterator object.
VOS_SimpleCursor VOS_SimpleCursor::GetPreviousSimple (bool16 * prevExists = nil) const
GetPreviousSimple -- get a new iterator pointing to the object before this one.

Parameters
prevExistswill be true if the iterator wasn't already at the beginning.
Returns
a new iterator object.
void VOS_SimpleCursor::IncrementOffset (int32 delta)
inline
Move the internal offset. Doesn't advance to the next object when advanced too far.

Or to the previous object when negative.

Parameters
deltaspecifies the amount to add to the current offset.
bool16 VOS_SimpleCursor::IsEmpty (void ) const
inline
Is the cursor pointing at anything?

Returns
true when the iterator isn't pointing at anything.
int32 VOS_SimpleCursor::LocalOffset () const
inline
Local Offset

Returns
the offset into the current object – not a global position.
bool16 VOS_SimpleCursor::MoveToNext ()
Move this cursor to the next object.

Returns
true when the move to the next object succeeded (not past end).
bool16 VOS_SimpleCursor::MoveToPrevious ()
Move this cursor to the previous object.

Returns
true when the move to the previous succeeds (not already at beginning).
int32 VOS_SimpleCursor::ObjectLength () const
inline
ObjectLength -- how large is the object being pointed to?

Returns
the number of characters the current object represents.
VOS_Object* VOS_SimpleCursor::QueryObject ()
inline
Get the underlying object. Should be matched with a call to ReleaseObject().

Returns
a pointer to the underlying object.
IPMUnknown* VOS_SimpleCursor::QueryOwningObject ()
inline
Return a referenced pointer to the containing data structure boss object.

Returns
an interface to the containing boss object. (kVOSDiskPageBoss)
void VOS_SimpleCursor::Rationalize ()

Rationalize moves the iterator to the beginning of the next object if it currently points to the end of an object.

static void VOS_SimpleCursor::ReleaseObject (VOS_Objectobj)
inlinestatic
Release the object. Strictly not necessary because this routine just

calls the Release() on the underlying object, but the thinking was that letting

the cursor know may allow future caching.

Parameters
objis the pointer to the object to release that was retrieved with QueryObject.
bool16 VOS_SimpleCursor::RemoveObject (bool16 deleteIt = kTrue)
Remove the object from the containing data structure.

Parameters
deleteItindicates whether to delete the object being removed.
Returns
true when the deletion succeeds.
void VOS_SimpleCursor::RemoveObjects (int32 * pLen2Del,
VOS_SavedDatadata 
)
Remove all objects from the data structure starting with the current location and

contained within the passed in length.

Parameters
pLen2Delspecifies the number of character positions to delete. Only entire objects are deleted. If the length to delete spans 2 full objects plus half of a third, the parameter is set to the number of characters to delete from the 3rd object, and the iterator is left pointing to it.
datapoints to a data structure to hold the deleted objects.
void VOS_SimpleCursor::SetOffset (int32 off)
inline
Set the internal offset. Doesn't advance to the next object when Set too large;

or to the previous object when negative.

Parameters
offspecifies the offset into the current object to use.