|
1 // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // CStringParser |
|
15 |
|
16 #ifndef STRINGPARSER_H_ |
|
17 #define STRINGPARSER_H_ |
|
18 |
|
19 //system include |
|
20 #include <e32base.h> |
|
21 |
|
22 //user include |
|
23 #include "mcommobserver.h" |
|
24 |
|
25 |
|
26 class CStringParser : public CBase |
|
27 { |
|
28 public: |
|
29 static CStringParser* NewL(TInt aBufferSize); |
|
30 |
|
31 static CStringParser* NewLC(TInt aBufferSize); |
|
32 |
|
33 virtual ~CStringParser(); |
|
34 |
|
35 public: |
|
36 void ProcessReadString(const TDesC8& aReadString); |
|
37 |
|
38 TPtrC8 Buffer() const; |
|
39 |
|
40 TPtrC8 CurrentLine() const; |
|
41 |
|
42 void ClearBuffer(); |
|
43 |
|
44 void ClearCurrentLine(); |
|
45 |
|
46 //Must be call this function |
|
47 void SetReadLineNotify(MCommReadLineNotifier* aNofity); |
|
48 |
|
49 protected: |
|
50 |
|
51 CStringParser(); |
|
52 |
|
53 void ConstructL(TInt aBufferSize); |
|
54 |
|
55 void CreateL(TInt aBufferSize); |
|
56 |
|
57 private: |
|
58 TText8 *iBuffer; |
|
59 TText8 *iBufferEnd; |
|
60 /** |
|
61 * The last char added in the current line |
|
62 */ |
|
63 TText8 *iLastChar; |
|
64 |
|
65 /** |
|
66 * The start of \r\n delimited line |
|
67 */ |
|
68 TText8 *iLineStart; |
|
69 |
|
70 /** |
|
71 * Means if current char is a delimiter |
|
72 */ |
|
73 TBool iInDelimiter; |
|
74 |
|
75 /** |
|
76 * |
|
77 */ |
|
78 MCommReadLineNotifier *iReadLineNotify; //Not owned |
|
79 }; |
|
80 |
|
81 #endif /*STRINGPARSER_H_*/ |