|
|
|
Location:
CFragmentedString.h
Link against: bnf.lib
class CFragmentedString : protected CArrayPtrFlat<HBufC>
Supported from 6.0
Utility that allows a single string to be built from an array of consecutive sub-strings.
The sub-strings can be inserted by reference or copied.
The object maintains information that points to a current position
within the string. A typical use is to test the contents of the string using
one of the Match...() functions, and then use
ConsumeMatched() to advance past the matched
area.
The class also supports inserting an unlimited number of marks in the string, and performing operations relative to the head (i.e. last inserted) mark.
|
Defined in CFragmentedString:
AddStringL(), AddStringL(), CFragmentedString(), CMarkStack, ConsumeMatched(), ContentL(), DeleteMark(), DeleteToMark(), DoMatchSelect(), EInsufficientData, EMatch, ENoMatch, FindNextMatchChar(), InsertStringL(), InsertStringToL(), Length(), Mark(), MarkedL(), MarkedWithInitialTextL(), Match(), MatchNotSelect(), MatchRange(), MatchSelect(), ReplaceMarkedAndSkipL(), ReplaceMarkedL(), Reset(), ResetToMark(), StartMatch(), StringL(), StringL(), TStringMark, TStringMatch, iCurrentCharacter, iCurrentIndex, iMarkStack, iMatched, iMatchedToCharacter, iMatchedToIndex, ~CFragmentedString()
Inherited from CArrayFix:
AppendL(),
AppendL()Append,
Array(),
At(),
Back(),
End(),
ExpandL(),
ExtendL(),
Find(),
FindIsq(),
InsertIsqAllowDuplicatesL(),
InsertIsqL(),
InsertL(),
ResizeL(),
operator[]
Inherited from CArrayFixBase:
Compress(),
Count(),
Delete(),
Sort()
Inherited from CArrayPtr:
ResetAndDestroy()
Inherited from CArrayPtrFlat:
SetReserveL()
Inherited from CBase:
operator new()
void AddStringL(HBufC* aString);
Appends a sub-string to the string.
|
void AddStringL(const TDesC& aString);
Copies a sub-string and then appends the copy to the string.
|
HBufC* StringL() const;
Gets a string containing all sub-strings after the current position in a newly-allocated buffer.
It is the caller's responsibility to clean up the returned string.
|
HBufC* ContentL() const;
Gets the entire string in a newly-allocated buffer.
It is the caller's responsibility to clean up the returned string.
|
void Reset();
Resets the string.
This resets and destroys the
HBufC array, and clears all indexes and marks.
TStringMatch Match(const TDesC& aString);
Tests if a specified target string occurs at the current position.
The function does a byte-for-byte comparison of the string contents from
the current position against aString.
|
|
TStringMatch MatchRange(const TUint aLower, const TUint aUpper);
Tests if the character at the current position is within a specified character code range.
|
|
TStringMatch MatchSelect(const TDesC& aSelection);
Tests if the character at the current position matches any character in a specified string.
|
|
TStringMatch MatchNotSelect(const TDesC& aSelection);
Tests if the character at the current position does not match any character in a specified string.
|
|
void ConsumeMatched();
Removes and deletes all sub-strings occurring before the position of the last successful match.
Any sub-strings at or after a mark are not deleted, regardless of the last successful match position.
HBufC* MarkedL();
Gets a new string containing the string contents from the head mark to the current index position.
It is the caller's responsibility to clean up the returned string.
|
HBufC* MarkedWithInitialTextL(const TDesC& aInitialText);
Gets a new string containing the string contents from the head mark to the current index position, prepended with a specified string.
It is the caller's responsibility to clean up the returned string.
|
|
void Mark();
Adds a mark at the current index position.
This mark becomes the head mark.
Note this function can leave with an out of memory error.
void ReplaceMarkedL(HBufC* aString);
Replaces the string contents to the head mark with a specified string.
|
void ReplaceMarkedAndSkipL(HBufC* aString);
Replaces the string contents to the head mark with a specified string, and then advances the current index position to the next sub-string.
|
void InsertStringL(HBufC* aString);
Inserts a specified string at the current index position.
|
protected: void DeleteToMark(const TStringMark& aStringMark);
Deletes from the current index position to the specified mark.
|
protected: void InsertStringToL(HBufC* aString, TInt aStringIndex, TInt aLengthIntoString);
Inserts a string at a specified position.
if aLengthIntoString is 0, the function inserts a new
sub-string at array position aStringIndex
if aLengthIntoString is equal to the length of the
sub-string at aStringIndex, then it inserts a new sub-string at
array position aStringIndex+1.
If aLengthIntoString is in the middle of
theaStringIndex sub-string, then it:
inserts a new sub-string at aStringIndex+1
holdingaString
inserts a new sub-string at aStringIndex+2 holding the data
from aStringIndex after aLengthIntoString
truncates the original aStringIndex to hold only the data
before aLengthIntoString
|
class TStringMark
A mark at a string position.
Defined in CFragmentedString::TStringMark:
TStringMark(), iMarkCharacter, iMarkIndex
TStringMark()TStringMark(TInt aIndex, TInt aCharacter);
Constructor.
|
iMarkIndexTInt iMarkIndex;
Array index of the marked sub-string.
iMarkCharacterTInt iMarkCharacter;
Character position within the sub-string for the mark.
TStringMatch
Defines possible results of a string matching operation for this class.
|
protected: typedef CStack<TStringMark, ETrue> CMarkStack;
A stack of string position marks.
protected: TInt iMatchedToIndex;
Array index of the sub-string found in the last match operation.
protected: TInt iMatchedToCharacter;
Current character position within the
iMatchedToIndex sub-string found in the last match
operation.
protected: TInt iCurrentCharacter;
Current character position within the current sub-string.
protected: CMarkStack iMarkStack;
Stack of marks in the string.
Mark() pushes a mark on the stack;
DeleteMark() pops one off.
protected: HBufC* StringL(TInt aStartIndex, TInt aStartCharacter, TInt aEndIndex, TInt aEndCharacter, const TDesC* aInitialText=NULL) const;
This member is internal and not intended for use.
protected: CFragmentedString::TStringMatch DoMatchSelect(const TDesC& aSelection, TBool aInSelection);
This member is internal and not intended for use.
protected: TBool FindNextMatchChar(TUint& aChar);
This member is internal and not intended for use.