29
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 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:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
|
22 |
|
|
23 |
|
|
24 |
|
|
25 |
#include "mainfragment.h"
|
|
26 |
#include "SenFragmentBase.h"
|
|
27 |
|
|
28 |
namespace
|
|
29 |
{
|
|
30 |
const TInt KStateParsingDelegate = 100;
|
|
31 |
_LIT8(KMainFragmentXmlns, "urn:main:fragment");
|
|
32 |
_LIT8(KMainFragmentName, "MainFragment");
|
|
33 |
_LIT8(KMainFragmentQName, "mn:MainFragment");
|
|
34 |
_LIT8(KDelegateName, "DelegateFragment");
|
|
35 |
}
|
|
36 |
|
|
37 |
CMainFragment* CMainFragment::NewL()
|
|
38 |
{
|
|
39 |
CMainFragment* pNew = NewLC();
|
|
40 |
CleanupStack::Pop(); // pNew;
|
|
41 |
return pNew;
|
|
42 |
}
|
|
43 |
|
|
44 |
CMainFragment* CMainFragment::NewLC()
|
|
45 |
{
|
|
46 |
CMainFragment* pNew = new (ELeave) CMainFragment;
|
|
47 |
CleanupStack::PushL(pNew);
|
|
48 |
pNew->BaseConstructL();
|
|
49 |
return pNew;
|
|
50 |
}
|
|
51 |
|
|
52 |
|
|
53 |
CMainFragment* CMainFragment::NewL(
|
|
54 |
const TDesC8& aNsUri,
|
|
55 |
const TDesC8& aLocalName,
|
|
56 |
const TDesC8& aQName
|
|
57 |
)
|
|
58 |
{
|
|
59 |
CMainFragment* pNew = NewLC( aNsUri, aLocalName, aQName );
|
|
60 |
CleanupStack::Pop(); // pNew;
|
|
61 |
return pNew;
|
|
62 |
}
|
|
63 |
|
|
64 |
CMainFragment* CMainFragment::NewLC(
|
|
65 |
const TDesC8& aNsUri,
|
|
66 |
const TDesC8& aLocalName,
|
|
67 |
const TDesC8& aQName
|
|
68 |
)
|
|
69 |
{
|
|
70 |
CMainFragment* pNew = new (ELeave) CMainFragment;
|
|
71 |
CleanupStack::PushL(pNew);
|
|
72 |
pNew->BaseConstructL(aNsUri, aLocalName, aQName);
|
|
73 |
return pNew;
|
|
74 |
}
|
|
75 |
|
|
76 |
|
|
77 |
CMainFragment::CMainFragment()
|
|
78 |
: ipDelegateFragment(NULL)
|
|
79 |
{
|
|
80 |
}
|
|
81 |
|
|
82 |
void CMainFragment::BaseConstructL()
|
|
83 |
{
|
|
84 |
CSenFragmentBase::BaseConstructL(
|
|
85 |
KMainFragmentXmlns,
|
|
86 |
KMainFragmentName,
|
|
87 |
KMainFragmentQName
|
|
88 |
);
|
|
89 |
}
|
|
90 |
|
|
91 |
void CMainFragment::BaseConstructL(
|
|
92 |
const TDesC8& aNsUri,
|
|
93 |
const TDesC8& aLocalName,
|
|
94 |
const TDesC8& aQName
|
|
95 |
)
|
|
96 |
{
|
|
97 |
CSenFragmentBase::BaseConstructL(aNsUri, aLocalName, aQName);
|
|
98 |
}
|
|
99 |
|
|
100 |
CMainFragment::~CMainFragment()
|
|
101 |
{
|
|
102 |
delete ipDelegateFragment;
|
|
103 |
}
|
|
104 |
|
|
105 |
void CMainFragment::OnStartElementL(const RTagInfo& aElement,
|
|
106 |
const RAttributeArray& aAttributes,
|
|
107 |
TInt aErrorCode)
|
|
108 |
{
|
|
109 |
switch (iState)
|
|
110 |
{
|
|
111 |
case KSenStateSave:
|
|
112 |
{
|
|
113 |
const TPtrC8 saxLocalName = aElement.LocalName().DesC();
|
|
114 |
|
|
115 |
if (saxLocalName == KDelegateName)
|
|
116 |
{
|
|
117 |
const TPtrC8 saxNsUri = aElement.Uri().DesC();
|
|
118 |
const TPtrC8 saxPrefix = aElement.Prefix().DesC();
|
|
119 |
|
|
120 |
TXmlEngElement element = AsElementL();
|
|
121 |
|
|
122 |
ipDelegateFragment = CDelegateFragment::NewL(
|
|
123 |
saxNsUri, saxLocalName,
|
|
124 |
saxPrefix, aAttributes
|
|
125 |
);
|
|
126 |
|
|
127 |
iState = KStateParsingDelegate;
|
|
128 |
|
|
129 |
OnDelegateParsingL(*ipDelegateFragment);
|
|
130 |
}
|
|
131 |
else
|
|
132 |
{
|
|
133 |
CSenFragmentBase::OnStartElementL(aElement, aAttributes,
|
|
134 |
aErrorCode);
|
|
135 |
}
|
|
136 |
break;
|
|
137 |
}
|
|
138 |
default:
|
|
139 |
{
|
|
140 |
CSenFragmentBase::OnStartElementL(aElement, aAttributes,
|
|
141 |
aErrorCode);
|
|
142 |
break;
|
|
143 |
}
|
|
144 |
}
|
|
145 |
}
|
|
146 |
|
|
147 |
void CMainFragment::OnEndElementL(const RTagInfo& aElement,
|
|
148 |
TInt aErrorCode)
|
|
149 |
|
|
150 |
{
|
|
151 |
switch(iState)
|
|
152 |
{
|
|
153 |
case KStateParsingDelegate:
|
|
154 |
{
|
|
155 |
iState = KSenStateSave;
|
|
156 |
break;
|
|
157 |
}
|
|
158 |
|
|
159 |
default:
|
|
160 |
{
|
|
161 |
CSenFragmentBase::OnEndElementL(aElement, aErrorCode);
|
|
162 |
break;
|
|
163 |
}
|
|
164 |
}
|
|
165 |
}
|
|
166 |
|
|
167 |
CDelegateFragment& CMainFragment::DelegateFragment()
|
|
168 |
{
|
|
169 |
return *ipDelegateFragment;
|
|
170 |
}
|
|
171 |
|
|
172 |
// End of File
|
|
173 |
|