|
1 /* |
|
2 * Copyright (c) 2005 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: CXcapOperationFactory |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include <ecom.h> |
|
21 #include <flogger.h> |
|
22 #include <implementationproxy.h> |
|
23 #include "XcapAddition.h" |
|
24 #include "XcapDeletion.h" |
|
25 #include "XdmOperation.h" |
|
26 #include "XcapRetrieval.h" |
|
27 #include "XcapInsertion.h" |
|
28 #include "XcapReplacement.h" |
|
29 #include "xdmlogwriter.h" |
|
30 #include "XcapOperationFactory.h" |
|
31 |
|
32 // --------------------------------------------------------- |
|
33 // CXcapOperationFactory::CXcapOperationFactory |
|
34 // |
|
35 // --------------------------------------------------------- |
|
36 // |
|
37 CXcapOperationFactory::CXcapOperationFactory() |
|
38 { |
|
39 } |
|
40 |
|
41 // --------------------------------------------------------- |
|
42 // CXcapOperationFactory::NewL |
|
43 // |
|
44 // --------------------------------------------------------- |
|
45 // |
|
46 CXcapOperationFactory* CXcapOperationFactory::NewL() |
|
47 { |
|
48 CXcapOperationFactory* self = new ( ELeave ) CXcapOperationFactory(); |
|
49 CleanupStack::PushL( self ); |
|
50 self->ConstructL(); |
|
51 CleanupStack::Pop(); |
|
52 return self; |
|
53 } |
|
54 |
|
55 // --------------------------------------------------------- |
|
56 // CXcapOperationFactory::ConstructL |
|
57 // |
|
58 // --------------------------------------------------------- |
|
59 // |
|
60 void CXcapOperationFactory::ConstructL() |
|
61 { |
|
62 #ifdef _DEBUG |
|
63 iLogWriter = CXdmLogWriter::NewL( KOperationsLogFile ); |
|
64 WriteToLog( _L8( "-> CXcapOperationFactory::ConstructL" ) ); |
|
65 WriteToLog( _L8( "<- CXcapOperationFactory::ConstructL" ) ); |
|
66 #endif |
|
67 } |
|
68 |
|
69 // --------------------------------------------------------- |
|
70 // CXcapOperationFactory::~CXcapOperationFactory |
|
71 // |
|
72 // --------------------------------------------------------- |
|
73 // |
|
74 CXcapOperationFactory::~CXcapOperationFactory() |
|
75 { |
|
76 #ifdef _DEBUG |
|
77 WriteToLog( _L8( "-> CXcapOperationFactory::~CXcapOperationFactory()" ) ); |
|
78 #endif |
|
79 #ifdef _DEBUG |
|
80 WriteToLog( _L8( "<- CXcapOperationFactory::~CXcapOperationFactory()" ) ); |
|
81 #endif |
|
82 delete iLogWriter; |
|
83 } |
|
84 |
|
85 // --------------------------------------------------------- |
|
86 // CXcapOperationFactory::FetchL |
|
87 // |
|
88 // --------------------------------------------------------- |
|
89 // |
|
90 MXdmOperation* CXcapOperationFactory::FetchL( CXdmDocument& aTargetDocument, |
|
91 CXdmDocumentNode* aTargetNode ) const |
|
92 { |
|
93 return CXcapRetrieval::NewL( ( CXcapDocument& )aTargetDocument, |
|
94 ( CXcapDocumentNode* )aTargetNode, |
|
95 const_cast<CXcapOperationFactory&>( *this ) ); |
|
96 } |
|
97 |
|
98 // --------------------------------------------------------- |
|
99 // CXcapOperationFactory::InsertL |
|
100 // |
|
101 // --------------------------------------------------------- |
|
102 // |
|
103 MXdmOperation* CXcapOperationFactory::InsertL( CXdmDocument& aTargetDocument, |
|
104 CXdmDocumentNode* aTargetNode ) const |
|
105 { |
|
106 return CXcapInsertion::NewL( ( CXcapDocument& )aTargetDocument, |
|
107 ( CXcapDocumentNode* )aTargetNode, |
|
108 const_cast<CXcapOperationFactory&>( *this ) ); |
|
109 } |
|
110 |
|
111 // --------------------------------------------------------- |
|
112 // CXcapOperationFactory::ReplaceL |
|
113 // |
|
114 // --------------------------------------------------------- |
|
115 // |
|
116 MXdmOperation* CXcapOperationFactory::ReplaceL( CXdmDocument& aOldDocument, |
|
117 CXdmDocumentNode* aNewNode, |
|
118 CXdmDocumentNode* aOldNode ) const |
|
119 { |
|
120 return CXcapReplacement::NewL( ( CXcapDocument& )aOldDocument, |
|
121 ( CXcapDocumentNode* )aNewNode, |
|
122 ( CXcapDocumentNode* )aOldNode, |
|
123 const_cast<CXcapOperationFactory&>( *this ) ); |
|
124 } |
|
125 |
|
126 // --------------------------------------------------------- |
|
127 // CXcapOperationFactory::AppendL |
|
128 // |
|
129 // --------------------------------------------------------- |
|
130 // |
|
131 MXdmOperation* CXcapOperationFactory::AppendL( CXdmDocument& aTargetDocument, |
|
132 CXdmDocumentNode* aTargetNode ) const |
|
133 { |
|
134 return CXcapAddition::NewL( ( CXcapDocument& )aTargetDocument, |
|
135 ( CXcapDocumentNode* )aTargetNode, |
|
136 const_cast<CXcapOperationFactory&>( *this ) ); |
|
137 } |
|
138 |
|
139 // --------------------------------------------------------- |
|
140 // CXcapOperationFactory::PartialDeletionL |
|
141 // |
|
142 // --------------------------------------------------------- |
|
143 // |
|
144 MXdmOperation* CXcapOperationFactory::DeletionL( CXdmDocument& aTargetDocument, |
|
145 CXdmDocumentNode* aTargetNode ) const |
|
146 { |
|
147 return CXcapDeletion::NewL( ( CXcapDocument& )aTargetDocument, |
|
148 ( CXcapDocumentNode* )aTargetNode, |
|
149 const_cast<CXcapOperationFactory&>( *this ) ); |
|
150 } |
|
151 |
|
152 // ---------------------------------------------------- |
|
153 // CXcapOperationFactory::WriteToLog |
|
154 // |
|
155 // ---------------------------------------------------- |
|
156 // |
|
157 void CXcapOperationFactory::WriteToLog( TRefByValue<const TDesC8> aFmt,... ) const |
|
158 { |
|
159 VA_LIST list; |
|
160 VA_START( list, aFmt ); |
|
161 TBuf8<KLogBufferMaxSize> buf; |
|
162 buf.FormatList( aFmt, list ); |
|
163 iLogWriter->WriteToLog( buf ); |
|
164 } |
|
165 |
|
166 // --------------------------------------------------------- |
|
167 // Map the interface UIDs to implementation factory functions |
|
168 // |
|
169 // --------------------------------------------------------- |
|
170 // |
|
171 const TImplementationProxy ImplementationTable[] = |
|
172 { |
|
173 #ifdef __EABI__ |
|
174 IMPLEMENTATION_PROXY_ENTRY( KXcapOperationFactory, CXcapOperationFactory::NewL ) |
|
175 #else |
|
176 { { KXcapOperationFactory }, CXcapOperationFactory::NewL } |
|
177 #endif |
|
178 }; |
|
179 |
|
180 // --------------------------------------------------------- |
|
181 // Return the implementation table & number of implementations |
|
182 // |
|
183 // --------------------------------------------------------- |
|
184 // |
|
185 EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) |
|
186 { |
|
187 aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy ); |
|
188 return ImplementationTable; |
|
189 } |
|
190 |