|
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: Object dumpper. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // ----------------------------------------------------------------------------- |
|
20 // PEngDebugDumpObject::GatherModelDetails() |
|
21 // ----------------------------------------------------------------------------- |
|
22 // |
|
23 void PEngDebugDumpObject::GatherModelDetails( TDes& aPrintBuffer, |
|
24 const MPEngPresenceAttrModel2* aModel ) |
|
25 { |
|
26 if( !aModel) |
|
27 { |
|
28 aPrintBuffer.Append( _L("<NULL> object") ); |
|
29 } |
|
30 |
|
31 else |
|
32 { |
|
33 aPrintBuffer.Append( aModel->PresenceID() ); |
|
34 |
|
35 |
|
36 |
|
37 //add attribute type ID.. |
|
38 |
|
39 //and XML name...and namespace |
|
40 TBuf<20> xmlBuffer; |
|
41 TPtrC8 xmlPtr( NULL, 0 ); |
|
42 aModel->TypeProperties().DesC8Peroperty( xmlPtr ) |
|
43 xmlBuffer.Copy( xmlPtr.Left( xmlBuffer.MaxLength() ); |
|
44 aPrintBuffer.Append( xmlBuffer ); |
|
45 |
|
46 aPrintBuffer.Append( _L(".. ..") ); |
|
47 |
|
48 aModel->TypeProperties().DesC8Peroperty( xmlPtr ) |
|
49 xmlBuffer.Copy( xmlPtr.Right( xmlBuffer.MaxLength() ); |
|
50 aPrintBuffer.Append( xmlBuffer ); |
|
51 |
|
52 |
|
53 switch( aModel->DataSource() ) |
|
54 { |
|
55 case EPEngAttrNetwork: |
|
56 { |
|
57 aPrintBuffer.Append( _L(" [Network]") ); |
|
58 break; |
|
59 } |
|
60 |
|
61 case EPEngAttrLocalEdited: |
|
62 { |
|
63 aPrintBuffer.Append( _L(" [LocalEdited]") ); |
|
64 break; |
|
65 } |
|
66 |
|
67 case EPEngAttrLocalDefault: |
|
68 default: |
|
69 { |
|
70 aPrintBuffer.Append( _L(" [LocalDefault]") ); |
|
71 break; |
|
72 } |
|
73 }; |
|
74 } |
|
75 } |
|
76 |
|
77 |
|
78 // ----------------------------------------------------------------------------- |
|
79 // PEngDebugDumpObject::Dump() |
|
80 // ----------------------------------------------------------------------------- |
|
81 // |
|
82 void PEngDebugDumpObject::Dump( MPEngPresenceAttrModel2* aModel ) |
|
83 { |
|
84 PENG_DP( D_PENG_LIT("Attribute model dump: [1] model") ); |
|
85 TBuf<200> printBuffer; |
|
86 printBuffer.AppendFormat( _L("\t %i. "), ii ); |
|
87 MPEngPresenceAttrModel2* model = aModels[ ii ]; |
|
88 if( !model ) |
|
89 { |
|
90 printBuffer.Append( _L("<NULL> object") ); |
|
91 } |
|
92 |
|
93 |
|
94 // ----------------------------------------------------------------------------- |
|
95 // PEngDebugDumpObject::Dump() |
|
96 // ----------------------------------------------------------------------------- |
|
97 // |
|
98 void PEngDebugDumpObject::Dump( RPointerArray<MPEngPresenceAttrModel2>& aModels ) |
|
99 { |
|
100 const TInt modelCount = aModels.Count(); |
|
101 TPtrC lastUserId( NULL, 0 ); |
|
102 TBuf<200> printBuffer; |
|
103 |
|
104 PENG_DP( D_PENG_LIT("Attribute model array dump: [%i] models"), modelCount ); |
|
105 for( TInt ii(0); ii <modelCount; ii++ ) |
|
106 { |
|
107 printBuffer.Zero(); |
|
108 const MPEngPresenceAttrModel2* model = aModels[ ii ]; |
|
109 |
|
110 printBuffer.AppendFormat( _L("\t %i. "), ii ); |
|
111 |
|
112 PENG_DP( D_PENG_LIT("%S"), &printBuffer ); |
|
113 } |
|
114 } |
|
115 } |
|
116 |
|
117 |
|
118 // ----------------------------------------------------------------------------- |
|
119 // PEngDebugDumpObject::Dump() |
|
120 // ----------------------------------------------------------------------------- |
|
121 // |
|
122 void PEngDebugDumpObject::Dump( MPEngTransactionStatus2& aStatus ) |
|
123 { |
|
124 PENG_DP( D_PENG_LIT("DUMPING Transaction status: status code [%i]"), aStatus.Status() ); |
|
125 |
|
126 const TInt detailedCount = aStatus.DetaildResultCount(); |
|
127 for( TInt ii(0); ii <detailedCount; ii++ ) |
|
128 { |
|
129 TBuf<200> printBuffer; |
|
130 printBuffer.AppendFormat( _L("\t %i. "), ii ); |
|
131 |
|
132 const MPEngDetailedResultEntry* dEntry = aStatus.DetailedResult( ii ); |
|
133 |
|
134 TPtrC desc( NULL, 0 ); |
|
135 if( dEntry->GetDetailedDesc( desc, EPEngDTPresenceID ) == KErrNone ) |
|
136 { |
|
137 desc.Set(desc.Left(50)); |
|
138 printBuffer.AppendFormat( _L("[%S]"), &desc ); |
|
139 } |
|
140 else |
|
141 { |
|
142 printBuffer.Append( _L("[none]") ); |
|
143 } |
|
144 |
|
145 if( dEntry->GetDetailedDesc( desc, EPEngDTContactListID ) == KErrNone ) |
|
146 { |
|
147 desc.Set(desc.Left(50)); |
|
148 printBuffer.AppendFormat( _L("[%s]"), &desc ); |
|
149 } |
|
150 else |
|
151 { |
|
152 printBuffer.Append( _L("[none]") ); |
|
153 } |
|
154 |
|
155 printBuffer.AppendFormat( _L("[%i]"), dEntry->Error() ); |
|
156 |
|
157 if( dEntry->GetDetailedDesc( desc, EPEngDTErrorDescription ) == KErrNone ) |
|
158 { |
|
159 desc.Set(desc.Left(50)); |
|
160 printBuffer.AppendFormat( _L("[%s]"), &desc ); |
|
161 } |
|
162 else |
|
163 { |
|
164 printBuffer.Append( _L("[none]") ); |
|
165 } |
|
166 |
|
167 PENG_DP( D_PENG_LIT("%S"), &printBuffer ); |
|
168 } |
|
169 } |
|
170 |
|
171 |
|
172 // End of File |
|
173 |