|
1 // Copyright (c) 2006-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 // |
|
15 |
|
16 #ifndef __CIMAPATOMWALKER_H__ |
|
17 #define __CIMAPATOMWALKER_H__ |
|
18 |
|
19 #include <e32base.h> |
|
20 |
|
21 class CImapAtom; |
|
22 |
|
23 /** |
|
24 Navigates a tree of CImapAtom objects, by storing the current atom together |
|
25 with an atom stack that makes it possible to track the current atom's parent. |
|
26 |
|
27 Methods are provided to "Walk" the atom tree - updating the current atom, |
|
28 and to "Peek" the tree without updating the current atom. |
|
29 */ |
|
30 class CImapAtomWalker : public CBase |
|
31 { |
|
32 public: |
|
33 static CImapAtomWalker* NewL(TInt aLogId); |
|
34 ~CImapAtomWalker(); |
|
35 |
|
36 void SetRootL(CImapAtom* aRootAtom); |
|
37 |
|
38 void WalkDownL(); |
|
39 CImapAtom* WalkAcrossL(TBool aLeaveIfNull); |
|
40 void WalkUpL(); |
|
41 |
|
42 CImapAtom* PeekDown() const; |
|
43 CImapAtom* PeekAcross() const; |
|
44 |
|
45 TBool CurrentMatch(const TDesC8& aValue) const; |
|
46 |
|
47 const TDesC8& CurrentDes(TBool aNString) const; |
|
48 CImapAtom* Current() const; |
|
49 |
|
50 TInt StackCount() const; |
|
51 |
|
52 enum TAtomType |
|
53 { |
|
54 EAtomNil, // atom matches "NIL": This corresponds to the nil component in section 9 of RFC3501. |
|
55 EAtomOpen, // atom matches "(": This atom has a child. |
|
56 }; |
|
57 TAtomType WalkAcrossToNilOrOpenL(); |
|
58 |
|
59 private: |
|
60 CImapAtomWalker(TInt aLogId); |
|
61 |
|
62 private: |
|
63 CImapAtom* iCurrentAtom; // not owned |
|
64 RPointerArray<CImapAtom> iAtomStack; // does not own the objects it points at |
|
65 TInt iLogId; |
|
66 }; |
|
67 |
|
68 #endif // __CIMAPATOMWALKER_H__ |