1.1 --- a/epoc32/include/cfragmentedstring.h Tue Mar 16 16:12:26 2010 +0000
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,178 +0,0 @@
1.4 -// Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 -// All rights reserved.
1.6 -// This component and the accompanying materials are made available
1.7 -// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.8 -// which accompanies this distribution, and is available
1.9 -// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.10 -//
1.11 -// Initial Contributors:
1.12 -// Nokia Corporation - initial contribution.
1.13 -//
1.14 -// Contributors:
1.15 -//
1.16 -// Description:
1.17 -// A string class implementation which allows quick addition of partial strings
1.18 -// (no copying) by using an internal array of fragmented strings.
1.19 -// The class allows comprehensive character based matching functionality
1.20 -// along with infinite depth marking.
1.21 -//
1.22 -//
1.23 -
1.24 -#ifndef __CFRAGMENTEDSTRING_H__
1.25 -#define __CFRAGMENTEDSTRING_H__
1.26 -
1.27 -// includes
1.28 -#include <e32base.h>
1.29 -#include <cstack.h>
1.30 -
1.31 -
1.32 -//
1.33 -// CFragmentedString
1.34 -
1.35 -//##ModelId=3B666BC6034A
1.36 -
1.37 -
1.38 -
1.39 -class CFragmentedString : protected CArrayPtrFlat<HBufC>
1.40 -/**
1.41 -Utility that allows a single string to be built from an array of consecutive sub-strings.
1.42 -
1.43 -The sub-strings can be inserted by reference or copied.
1.44 -
1.45 -The object maintains information that points to a current position within the string. A typical
1.46 -use is to test the contents of the string using one of the Match...() functions, and then use
1.47 -ConsumeMatched() to advance past the matched area.
1.48 -
1.49 -The class also supports inserting an unlimited number of marks in the string, and performing
1.50 -operations relative to the head (i.e. last inserted) mark.
1.51 - @publishedAll
1.52 - @released
1.53 -*/
1.54 - {
1.55 -protected:
1.56 - class TStringMark
1.57 - /** A mark at a string position. */
1.58 - {
1.59 - public:
1.60 - /** Constructor.
1.61 -
1.62 - @param aIndex Array index of the marked sub-string
1.63 - @param aCharacter Character position within the sub-string for the mark
1.64 - */
1.65 - TStringMark(TInt aIndex, TInt aCharacter)
1.66 - : iMarkIndex(aIndex), iMarkCharacter(aCharacter)
1.67 - {
1.68 - }
1.69 -
1.70 - public:
1.71 - /** Array index of the marked sub-string. */
1.72 - TInt iMarkIndex;
1.73 - /** Character position within the sub-string for the mark. */
1.74 - TInt iMarkCharacter;
1.75 - };
1.76 - /** A stack of string position marks. */
1.77 - typedef CStack<TStringMark, ETrue> CMarkStack;
1.78 -
1.79 -public:
1.80 - /** Defines possible results of a string matching operation for this class. */
1.81 - enum TStringMatch
1.82 - {
1.83 - /** There was no match. */
1.84 - ENoMatch,
1.85 - /** There was a complete match. */
1.86 - EMatch,
1.87 - /** String contained insufficient data to perform the match operation.
1.88 -
1.89 - This can mean that the start of the target string was matched, but the string
1.90 - being searched ended before a complete match was found. */
1.91 - EInsufficientData
1.92 - };
1.93 -
1.94 -public:
1.95 - IMPORT_C CFragmentedString();
1.96 - //##ModelId=3B666BC700AD
1.97 - IMPORT_C ~CFragmentedString();
1.98 -
1.99 - //##ModelId=3B666BC70099
1.100 - IMPORT_C void AddStringL(HBufC* aString); // this version is more efficient
1.101 - //##ModelId=3B666BC700A3
1.102 - IMPORT_C void AddStringL(const TDesC& aString);
1.103 -
1.104 - //##ModelId=3B666BC70090
1.105 - IMPORT_C TInt Length() const;
1.106 - //##ModelId=3B666BC70071
1.107 - IMPORT_C HBufC* StringL() const;
1.108 - //##ModelId=3B666BC70068
1.109 - IMPORT_C HBufC* ContentL() const;
1.110 - //##ModelId=3B666BC70067
1.111 - IMPORT_C void Reset();
1.112 -
1.113 - //##ModelId=3B666BC7005D
1.114 - IMPORT_C TStringMatch Match(const TDesC& aString);
1.115 - //##ModelId=3B666BC70049
1.116 - IMPORT_C TStringMatch MatchRange(const TUint aLower, const TUint aUpper);
1.117 - //##ModelId=3B666BC7003F
1.118 - IMPORT_C TStringMatch MatchSelect(const TDesC& aSelection);
1.119 - //##ModelId=3B666BC70037
1.120 - IMPORT_C TStringMatch MatchNotSelect(const TDesC& aSelection);
1.121 - //##ModelId=3B666BC70036
1.122 - IMPORT_C void ConsumeMatched();
1.123 -
1.124 - //##ModelId=3B666BC70035
1.125 - IMPORT_C HBufC* MarkedL();
1.126 - //##ModelId=3B666BC7002B
1.127 - IMPORT_C HBufC* MarkedWithInitialTextL(const TDesC& aInitialText);
1.128 - //##ModelId=3B666BC70022
1.129 - IMPORT_C void Mark(); // Mark can leave
1.130 - //##ModelId=3B666BC70021
1.131 - IMPORT_C void DeleteMark();
1.132 - //##ModelId=3B666BC70018
1.133 - IMPORT_C void ResetToMark();
1.134 -
1.135 - //##ModelId=3B666BC7000E
1.136 - IMPORT_C void ReplaceMarkedL(HBufC* aString);
1.137 - //##ModelId=3B666BC70005
1.138 - IMPORT_C void ReplaceMarkedAndSkipL(HBufC* aString);
1.139 - //##ModelId=3B666BC70003
1.140 - IMPORT_C void InsertStringL(HBufC* aString);
1.141 -
1.142 -protected:
1.143 - //##ModelId=3B666BC603E1
1.144 - IMPORT_C void DeleteToMark(const TStringMark& aStringMark);
1.145 - //##ModelId=3B666BC603C4
1.146 - IMPORT_C void InsertStringToL(HBufC* aString, TInt aStringIndex, TInt aLengthIntoString);
1.147 - //##ModelId=3B666BC70072
1.148 - HBufC* StringL(TInt aStartIndex, TInt aStartCharacter, TInt aEndIndex, TInt aEndCharacter, const TDesC* aInitialText=NULL) const;
1.149 - //##ModelId=3B666BC603C3
1.150 - void StartMatch();
1.151 - //##ModelId=3B666BC603B8
1.152 - CFragmentedString::TStringMatch DoMatchSelect(const TDesC& aSelection, TBool aInSelection);
1.153 - //##ModelId=3B666BC603AE
1.154 - TBool FindNextMatchChar(TUint& aChar);
1.155 -
1.156 -protected:
1.157 - //##ModelId=3B666BC603A4
1.158 - /** Result of the last match operation. */
1.159 - TStringMatch iMatched;
1.160 -
1.161 - /** Array index of the sub-string found in the last match operation. */
1.162 - //##ModelId=3B666BC6039A
1.163 - TInt iMatchedToIndex;
1.164 - /** Current character position within the iMatchedToIndex sub-string found in the last match operation. */
1.165 - //##ModelId=3B666BC60390
1.166 - TInt iMatchedToCharacter;
1.167 - /** Array index of the current sub-string. */
1.168 - //##ModelId=3B666BC60386
1.169 - TInt iCurrentIndex;
1.170 - /** Current character position within the current sub-string. */
1.171 - //##ModelId=3B666BC6037C
1.172 - TInt iCurrentCharacter;
1.173 - /** Stack of marks in the string.
1.174 -
1.175 - Mark() pushes a mark on the stack; DeleteMark() pops one off.
1.176 - */
1.177 - //##ModelId=3B666BC60372
1.178 - CMarkStack iMarkStack;
1.179 - };
1.180 -
1.181 -#endif // __CFRAGMENTEDSTRING_H__