1 /* |
|
2 * Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: CIRViewStack class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <eikenv.h> |
|
20 #include "irviewstack.h" |
|
21 #include "irdebug.h" |
|
22 |
|
23 // --------------------------------------------------------------------------- |
|
24 // Two-phased constructor. |
|
25 // --------------------------------------------------------------------------- |
|
26 // |
|
27 CIRViewStack* CIRViewStack::NewL() |
|
28 { |
|
29 IRLOG_INFO( "CIRViewStack::NewL - Entering" ); |
|
30 CIRViewStack* self = new( ELeave ) CIRViewStack( ); |
|
31 CleanupStack::PushL( self ); |
|
32 self->ConstructL(); |
|
33 CleanupStack::Pop( self ); |
|
34 IRLOG_INFO( "CIRViewStack::NewL - Exiting" ); |
|
35 return self; |
|
36 } |
|
37 |
|
38 // --------------------------------------------------------------------------- |
|
39 // Desctructor. |
|
40 // --------------------------------------------------------------------------- |
|
41 // |
|
42 CIRViewStack::~CIRViewStack() |
|
43 { |
|
44 IRLOG_INFO( "CIRViewStack::~CIRViewStack - Entering" ); |
|
45 iViewStack.Close(); |
|
46 IRLOG_INFO( "CIRViewStack::~CIRViewStack - Exiting" ); |
|
47 } |
|
48 |
|
49 // --------------------------------------------------------------------------- |
|
50 // C++ defaul desctructor. |
|
51 // --------------------------------------------------------------------------- |
|
52 // |
|
53 CIRViewStack::CIRViewStack( ) |
|
54 { |
|
55 IRLOG_INFO( "CIRViewStack::CIRViewStack" ); |
|
56 } |
|
57 |
|
58 // --------------------------------------------------------------------------- |
|
59 // Second phase constructor. |
|
60 // --------------------------------------------------------------------------- |
|
61 // |
|
62 void CIRViewStack::ConstructL() |
|
63 { |
|
64 IRLOG_INFO( "CIRViewStack::ConstructL" ); |
|
65 } |
|
66 |
|
67 // --------------------------------------------------------------------------- |
|
68 // CIRViewStack::Peek() |
|
69 // --------------------------------------------------------------------------- |
|
70 // |
|
71 TUid CIRViewStack::Peek() const |
|
72 { |
|
73 IRLOG_INFO( "CIRViewStack::ConstructL" ); |
|
74 return iViewStack.Count() ? iViewStack[iViewStack.Count() - 1] : KNullUid; |
|
75 } |
|
76 |
|
77 // --------------------------------------------------------------------------- |
|
78 // CIRViewStack::PushL() |
|
79 // --------------------------------------------------------------------------- |
|
80 // |
|
81 void CIRViewStack::PushL( TUid aView ) |
|
82 { |
|
83 IRLOG_INFO( "CIRViewStack::PushL - Entering" ); |
|
84 if( !iViewStack.Count() || iViewStack[iViewStack.Count()-1] != aView ) |
|
85 { |
|
86 iViewStack.AppendL( aView ); |
|
87 } |
|
88 IRLOG_INFO( "CIRViewStack::PushL - Exiting" ); |
|
89 } |
|
90 |
|
91 // --------------------------------------------------------------------------- |
|
92 // CIRViewStack::Pop() |
|
93 // --------------------------------------------------------------------------- |
|
94 // |
|
95 TInt CIRViewStack::Count() const |
|
96 { |
|
97 IRLOG_INFO( "CIRViewStack::Count" ); |
|
98 return iViewStack.Count(); |
|
99 } |
|
100 |
|
101 // --------------------------------------------------------------------------- |
|
102 // CIRViewStack::Pop() |
|
103 // --------------------------------------------------------------------------- |
|
104 // |
|
105 TUid CIRViewStack::Pop() |
|
106 { |
|
107 IRLOG_INFO( "CIRViewStack::Pop - Entering" ); |
|
108 TUid ret = KNullUid; |
|
109 if( iViewStack.Count() ) |
|
110 { |
|
111 ret = iViewStack[iViewStack.Count()-1]; |
|
112 iViewStack.Remove( iViewStack.Count()-1 ); |
|
113 } |
|
114 IRLOG_INFO( "CIRViewStack::Pop - Exiting" ); |
|
115 return ret; |
|
116 } |
|
117 |
|
118 // --------------------------------------------------------------------------- |
|
119 // CIRViewStack::PopTo() |
|
120 // --------------------------------------------------------------------------- |
|
121 // |
|
122 TUid CIRViewStack::PopTo( TUid aId ) |
|
123 { |
|
124 IRLOG_INFO( "CIRViewStack::PopTo - Entering" ); |
|
125 TUid ret = KNullUid; |
|
126 while ( Peek() != aId && Count() > 0 ) |
|
127 { |
|
128 ret = Pop(); |
|
129 } |
|
130 IRLOG_INFO( "CIRViewStack::PopTo - Exiting" ); |
|
131 return ret; |
|
132 } |
|
133 |
|