CompareSameMarkerOwner
MarkerOfATypeMarkerSink < T >
MarkersOfATypeMarkerSink < T >
MarkersOfATypeMarkerSink2Vector < T >
MarkersOfATypeMarkerSinkWithCompare2List < T,COMPARE >
MarkersOfATypeMarkerSinkWithCompare2Vector < T,COMPARE >
TextStore
TextStore::MarkerSink
TextStore::VectorMarkerSink
qUseWin32CompareStringCallForCaseInsensitiveSearch
This module introduces one of Led's key abstractions - the TextStore
. A TextStore
- as the name suggests -
is where Led keeps track of text. It is abstract enuf to keep track in many different representations of the text.
A TextStore
also keeps track of Marker
s associated with the text.
Led_tChar
s as the meaning for the indexes. This means for
wide character sets it means characters, and for mbyte or single character set
builds it means bytes. In either case you can use CharacterToTCharIndex/
TCharToCharacterIndex () to get whichever you want.
CompareSameMarkerOwner [public]
A MarkerSink which filters on the given MarkerOwner.
OBSOLETE. Use MarkerOwner arg CollectAllMarkersInRange () etc...
MarkerOfATypeMarkerSink < T > [public]
TextStore::MarkerSink
A MarkerSink template which grabs only Markers of subtype 'T' (using dynamic_cast<>). Similar to
MarkersOfATypeMarkerSink2Vector
except that this class only grabs a SINGLE marker in that range
(which is stored in fResult). It is an error (detected via an assertion) if this class is ever used
to sink more than one marker (though its OK if it gets none - fResult will be NULL).
MarkersOfATypeMarkerSink < T > [public]
TextStore::MarkerSink
A MarkerSink which filters on the given type T
using dynamic_cast
.
MarkersOfATypeMarkerSink2Vector < T > [public]
TextStore::MarkerSink
A MarkerSink template which grabs only Markers of subtype 'T' (using dynamic_cast<>). Dumps results into a vector named 'fResult'.
MarkersOfATypeMarkerSinkWithCompare2List < T,COMPARE > [public]
TextStore::MarkerSink
A MarkerSink template which filters using the template-argument COMPARE type. Useful in conjunction with CompareSameMarkerOwner. Dumps results into a list named 'fResult'.
Now OBSOLETE. Use MarkerOwner arg CollectAllMarkersInRange () etc...
MarkersOfATypeMarkerSinkWithCompare2Vector < T,COMPARE > [public]
TextStore::MarkerSink
A MarkerSink template which filters using the template-argument COMPARE type. Useful in conjunction with CompareSameMarkerOwner. Dumps results into a vector named 'fResult'.
Now OBSOLETE. Use MarkerOwner arg CollectAllMarkersInRange () etc...
TextStore [public]
MarkerOwner
An abstraction of something which contains text, and special objects called markers, which can be used to represent embedded data, or hypertext links, or font style runs. Markers have a left and right edge (named by indexes into the text buffer), and conceptually stick to the text they wrap as the text is modified (edited).
There are two concrete TextStore implementations you can use (with Led 3.0).
Future versions of Led may include TextStore implementations which:
Member Details |
---|
Add the given marker to this TextStore, starting at position lhs, and give the marker length 'length'. Record that its owner is 'owner'. NB: the It is an error to add a marker which is already added to some TextStore (even this TextStore). It is an error to destroy a TextStore without first removing all markers you had added. It is in order to make that more efficient that we provide the RemoveMarkers () method. We are strict about markers extenting outside valid index ranges - this is an prohibited. |
Register the given MarkerOwner with the TextStore for later notification of updates to the text. Remove via RemoveMarkerOwner (). NB: It is illegal to add a |
CollectAllMarkersInRange () is part of a family of routines to retreive markers of interest in a particular range of the text. The You can either specify a callback function/object to be called with each found marker. If you only need the first such, you can throw to terminate the search. There is a help class and helper fuctions to allow you to fill an array with the all the matching Markers. NB: this has changed somewhat since Led22 - see SPR#0489. |
Note - owner can be any valid MarkerOwner, or |
CopyOut does NOT null terminate. It is an error to call with withWhatBytes causing access past end of TextStore buffer. Note that it IS NOT an error to call CopyOut for multibyte characters and split them. This is one of the few API routines where that is so. |
Utility to call AboutToUpdateText on registered MarkerOwners, and Markers. Don't call directly.
Called by concrete TextStore subclasses. Note: we call the AbouToUpdate() calls first on the markers, and
then on the |
Utility to call DidUpdateText on registered MarkerOwners, and Markers. Don't call directly. Called by concrete TextStore subclasses. NB: See |
Search within the given range for the text specified in |
Returns the marker position of the previous character. If at the start of the buffer, it returns 0. Use this instead of pos--, in order to deal properly with multibyte character sets. |
Returns the marker position of the end of the text buffer. |
Returns the marker position of the end of the given line #. |
Returns the marker position of the end of the line contains the character after 'afterPos'. |
|
Returns the # of the line which contains the given charPosition. NB: we use charPosition here to deal with the ambiguity of what line a markerPosition is at when it straddles two lines. |
Returns the # of the lines in the TextStore. |
Returns the list of all MarkerOwners registered for notification of changes to the text. |
Returns the marker position of the beginning of the text buffer (always 0). |
Returns the marker position of the start of the given line #. |
Returns the marker position of the start of the line contains the character after 'afterPos'. |
Returns a If none is associated with the TextStore right now - and default one is built and returned. See also See |
Check internal consitency of data structures. Don't call this directly. Call TextStore::Invariant instead. And only call at quiesent times; not in the midst of some update where data structures might not be fully consistent. |
The idea here is to test if a marker overlaps with a given range of the document. But only in some INTERESTING way. The one case one might plausibly consider overlap which this routine
does NOT is the case where two markers touch only at the edges (lhs of one == rhs of the other).
For the purposes for which markers are used - in my experience - this is NOT an interesting case
and it makes code using There is one further refinement added here in Led 2.3 (970929, for spr#0489). When the marker is zero-length (not the from/to args, but the 'm' arg), then the overlap is allowed to be zero width and it is still considerd a valid overlap. This is true because we want CollectAllMarkersInRange () to be usable to pick up zero-length markers. Essentially, this means it is "OverlapOrStrictlyContains". NB: The details of this special 'zero-width' overlap case were further clarified, and improved, and revised in Led 3.0d6 (2000/04/26, SPR#0745). Important: The part which is a change from Led 2.3 (and earlier) is the details of WHICH zero-width overlap cases are now considered overlap. I think the new rule is simpler, and more intuitive. See Led 2.3 for the old rule/code. NB: This routine is mainly called by the NB: This routine is NOT symetric. By this I mean that Overlap (A,B) is not always the same as Overlap (B,A). The reason for this is because we specially treat the case of a zero-width first arg to overlap. And we make no such special treatment of the second argument. See SPR#0745 for more details. Also, SPR#0489, and SPR#420. |
Since a TextStore is a MarkerOwner, is must override the PeekAtTextStore method, and return itself. |
Don't entirely remove the marker (so it can still be queried for size etc). But mark it so it will not appear in future CollectAllXXX methods. This is NOT required before calling This method was added to fix SPR#0822 - see for details. |
Remove the given marker from the TextStore. It is an error if the given marker is not already
in this TextStore. See |
Remove the given marker from the text. |
Unregister the given MarkerOwner which was previously registed with AddMarkerOwner (). |
Remove the given markers from the TextStore. This is essentially the same as doing multiple
See also |
Replace the text in the range {from,to} with the withWhatCount Led_tChars of text pointed to by withWhat. This update will have the side effect of notifying MarkerOwners, and affected Markers. |
Similar to |
Similar to |
Set the bounds of the given marker. The given marker must already
be in this TextStore (see |
Similar to |
|
Sentinal value meaning to match on ANY marker owner for |
TextStore::MarkerSink [public]
An abstract "callback class", used to be notified in calls to CollectAllMarkersInRangeInto. To use this class, subclass, and override the Append () method. Pass an instance of your subclass to TextStore::CollectAllMarkersInRangeInto (or some variant). Your classes Append method will be called for each marker in the given range.
Member Details |
---|
Don't call directly. Called by TextStore::CollectAllMarkersInRangeInto (). Override this method and pass an instance of your subclass to TextStore::CollectAllMarkersInRangeInto (). |
TextStore::VectorMarkerSink [public]
TextStore::MarkerSink
A utility class which gathers all the markers passed to it into an array (vector).
Member Details |
---|
Don't call directly. Called as a by-product of TextStore::CollectAllMarkersInRange (). This TextStore::VectorMarkerSink produces a vector for such collect calls. |
qUseWin32CompareStringCallForCaseInsensitiveSearch [public]
Produces better internationalized results - but - of course - is Win32 specific - and a bit slower. Based on SPR#0864