#include <VOSSimpleCursor.h>
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
| void VOS_SimpleCursor::AddUndoObject | ( | bool16 | front, | | | VOS_SavedData * | undo, | | | 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
| front | specifies whether to add this object to the front or the end of the datastructure undo. |
| undo | is the data structure to add to. |
| nextExists | RETURNS kTrue if this is not the last object. |
| len2Del | is 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_SavedData * | copy, | | | 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
| front | specifies whether to add this object to the front or the end of the datastructure undo. |
| copy | is the data structure to add to. |
| nextExists | RETURNS kTrue if this is not the last object. |
| len2Copy | is the number of characters to copy after this object. |
| void VOS_SimpleCursor::CopyObjects | ( | int32 * | pLen2Copy, |
| | VOS_SavedData * | copyInto = nil |
| ) | | |
Copy all objects from the data structure starting with the current location and
contained within the passed in length.
- Parameters
| pLen2Copy | specifies 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. |
| copyInto | points to a data structure to hold the copied objects. |
| void VOS_SimpleCursor::CopyPageRef | ( | VOS_SavedData * | copy, | | | 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
| copy | is the data structure to add to. |
| unused | is unused. |
| len2Copy | is the number of characters to copy beyond that page. It is used to possible advance the cursor. |
| void VOS_SimpleCursor::DirtyObject | ( | | ) | |
| inline |
| VOS_SimpleCursor VOS_SimpleCursor::GetNextSimple | ( | bool16 * | nextExists = nil | ) | const |
GetNextSimple -- get a new iterator pointing to the next object.
- Parameters
| nextExists | is 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
| prevExists | will 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
| delta | specifies 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.
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_Object * | obj | ) | |
| 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
| obj | is 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
| deleteIt | indicates whether to delete the object being removed. |
- Returns
- true when the deletion succeeds.
| void VOS_SimpleCursor::RemoveObjects | ( | int32 * | pLen2Del, |
| | VOS_SavedData * | data |
| ) | | |
Remove all objects from the data structure starting with the current location and
contained within the passed in length.
- Parameters
| pLen2Del | specifies 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. |
| data | points 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
| off | specifies the offset into the current object to use. |