|
1 /* |
|
2 * Copyright (c) 2002-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: Class represents an Object Description Tree of Xuikon. |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <s32strm.h> |
|
19 #include <s32mem.h> |
|
20 #include "xndomdocument.h" |
|
21 #include "xnresource.h" |
|
22 #include "xnodt.h" |
|
23 |
|
24 // ============================ MEMBER FUNCTIONS =============================== |
|
25 |
|
26 // ----------------------------------------------------------------------------- |
|
27 // CXnODT::CXnODT |
|
28 // C++ default constructor can NOT contain any code, that |
|
29 // might leave. |
|
30 // ----------------------------------------------------------------------------- |
|
31 // |
|
32 CXnODT::CXnODT() |
|
33 { |
|
34 } |
|
35 |
|
36 // ----------------------------------------------------------------------------- |
|
37 // CXnODT::ConstructL |
|
38 // Symbian 2nd phase constructor can leave. |
|
39 // ----------------------------------------------------------------------------- |
|
40 // |
|
41 void CXnODT::ConstructL() |
|
42 { |
|
43 iDomDocument = CXnDomDocument::NewL(); |
|
44 } |
|
45 |
|
46 // ----------------------------------------------------------------------------- |
|
47 // CXnODT::NewL |
|
48 // Two-phased constructor. |
|
49 // ----------------------------------------------------------------------------- |
|
50 // |
|
51 EXPORT_C CXnODT* CXnODT::NewL() |
|
52 { |
|
53 CXnODT* self = new( ELeave ) CXnODT; |
|
54 CleanupStack::PushL( self ); |
|
55 self->ConstructL(); |
|
56 CleanupStack::Pop( self ); |
|
57 return self; |
|
58 } |
|
59 |
|
60 // Destructor |
|
61 CXnODT::~CXnODT() |
|
62 { |
|
63 delete iDomDocument; |
|
64 } |
|
65 |
|
66 // ----------------------------------------------------------------------------- |
|
67 // CXnODT::InternalizeHeaderL |
|
68 // Internalizes the ODT header |
|
69 // (other items were commented in a header). |
|
70 // ----------------------------------------------------------------------------- |
|
71 EXPORT_C void CXnODT::InternalizeHeaderL( RReadStream& aStream ) |
|
72 { |
|
73 // Dummy internalize to support legacy for backward compatibility |
|
74 |
|
75 // iAppUid |
|
76 (void)aStream.ReadUint32L(); |
|
77 // iProviderUid |
|
78 (void)aStream.ReadUint32L(); |
|
79 // iThemeUid |
|
80 (void)aStream.ReadUint32L(); |
|
81 |
|
82 // iProviderName |
|
83 HBufC::NewLC( aStream, KMaxFileName ); |
|
84 // iThemeFullName |
|
85 HBufC::NewLC( aStream, KMaxFileName ); |
|
86 // iThemeShortName |
|
87 HBufC::NewLC( aStream, KMaxFileName ); |
|
88 // iThemeVersion |
|
89 HBufC::NewLC( aStream, KMaxFileName ); |
|
90 |
|
91 CleanupStack::PopAndDestroy( 4 ); |
|
92 |
|
93 // iScreenSizeX |
|
94 (void)aStream.ReadUint32L(); |
|
95 // iScreenSizeY |
|
96 (void)aStream.ReadUint32L(); |
|
97 // iLanguage |
|
98 (void)aStream.ReadInt32L(); |
|
99 // iFlags |
|
100 (void)aStream.ReadUint32L(); |
|
101 |
|
102 // consumes header delimiter |
|
103 (void)aStream.ReadInt16L(); |
|
104 } |
|
105 |
|
106 // ----------------------------------------------------------------------------- |
|
107 // CXnODT::InternalizeResourceListL |
|
108 // (other items were commented in a header). |
|
109 // ----------------------------------------------------------------------------- |
|
110 EXPORT_C CArrayPtrSeg< CXnResource >* CXnODT::InternalizeResourceListL( |
|
111 RReadStream& aStream ) |
|
112 { |
|
113 CArrayPtrSeg< CXnResource >* list = |
|
114 new( ELeave ) CArrayPtrSeg<CXnResource>( 4 ); |
|
115 |
|
116 CleanupStack::PushL( list ); |
|
117 |
|
118 // stream in the resource list |
|
119 TInt count( aStream.ReadInt32L() ); |
|
120 |
|
121 for ( TInt i = 0; i < count; i++ ) |
|
122 { |
|
123 CXnResource* resource = CXnResource::NewL(); |
|
124 CleanupStack::PushL( resource ); |
|
125 |
|
126 resource->InternalizeL( aStream ); |
|
127 |
|
128 list->AppendL( resource ); |
|
129 CleanupStack::Pop( resource ); // now owned by array |
|
130 } |
|
131 |
|
132 CleanupStack::Pop( list ); |
|
133 |
|
134 return list; |
|
135 } |
|
136 |
|
137 // ----------------------------------------------------------------------------- |
|
138 // CXnODT::InternalizeDomDocumentL |
|
139 // Internalizes the ODT with shared document |
|
140 // (other items were commented in a header). |
|
141 // ----------------------------------------------------------------------------- |
|
142 EXPORT_C CXnDomNode* CXnODT::InternalizeDomDocumentL( RReadStream& aStream ) |
|
143 { |
|
144 return ( iDomDocument->ReadL( aStream ) ); |
|
145 } |
|
146 |
|
147 // ----------------------------------------------------------------------------- |
|
148 // CXnODT::DomDocument |
|
149 // Get DomDocument |
|
150 // (other items were commented in a header). |
|
151 // ----------------------------------------------------------------------------- |
|
152 // |
|
153 EXPORT_C CXnDomDocument& CXnODT::DomDocument() const |
|
154 { |
|
155 return *iDomDocument; |
|
156 } |
|
157 |
|
158 // End of File |