|
1 /* |
|
2 * Copyright (c) 2008 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 "wsovierrorresponse.h" |
|
26 #include "wsovicons.h" |
|
27 |
|
28 using namespace WSOviResponse; |
|
29 CWSOviErrorResponse* CWSOviErrorResponse::NewL() |
|
30 { |
|
31 CWSOviErrorResponse* self = NewLC(); |
|
32 CleanupStack::Pop(self); |
|
33 return self; |
|
34 } |
|
35 |
|
36 CWSOviErrorResponse* CWSOviErrorResponse::NewLC() |
|
37 { |
|
38 CWSOviErrorResponse* self = new (ELeave) CWSOviErrorResponse(); |
|
39 CleanupStack::PushL (self); |
|
40 self->ConstructL(); |
|
41 return self; |
|
42 } |
|
43 // Second phase construction. |
|
44 void CWSOviErrorResponse::ConstructL() |
|
45 { |
|
46 CSenBaseFragment::BaseConstructL(TPtrC8(NULL,0), |
|
47 KErrorNode); |
|
48 } |
|
49 |
|
50 void CWSOviErrorResponse::StartElementL(const TDesC8& /*aNsUri*/, |
|
51 const TDesC8& aLocalName, |
|
52 const TDesC8& /*aQName*/, |
|
53 const RAttributeArray& /*aAttributes*/) |
|
54 { |
|
55 if ((aLocalName == KErrorCode) || |
|
56 (aLocalName == KErrorText)) |
|
57 { |
|
58 iState = KStateSave; |
|
59 } |
|
60 } |
|
61 |
|
62 void CWSOviErrorResponse::EndElementL(const TDesC8& /*aNsUri*/, |
|
63 const TDesC8& aLocalName, |
|
64 const TDesC8& /*aQName*/) |
|
65 { |
|
66 TPtrC8 content = Content(); |
|
67 if (iState == KStateSave) |
|
68 { |
|
69 if (aLocalName == KErrorCode) |
|
70 { |
|
71 iCode = HBufC8::NewL(content.Length()); |
|
72 iCode->Des().Append(content); |
|
73 ResetContentL(); |
|
74 iState = KStateIgnore; |
|
75 } |
|
76 else if (aLocalName == KErrorText) |
|
77 { |
|
78 iText = HBufC8::NewL(content.Length()); |
|
79 iText->Des().Append(content); |
|
80 ResetContentL(); |
|
81 iState = KStateIgnore; |
|
82 } |
|
83 } |
|
84 } |
|
85 |
|
86 |
|
87 CWSOviErrorResponse::CWSOviErrorResponse() |
|
88 { |
|
89 } |
|
90 |
|
91 CWSOviErrorResponse::~CWSOviErrorResponse() |
|
92 { |
|
93 delete iCode; |
|
94 delete iText; |
|
95 } |
|
96 |
|
97 TPtrC8 CWSOviErrorResponse::Code() |
|
98 { |
|
99 if (iCode) |
|
100 { |
|
101 return *iCode; |
|
102 } |
|
103 else |
|
104 { |
|
105 return KNullDesC8(); |
|
106 } |
|
107 } |
|
108 |
|
109 TPtrC8 CWSOviErrorResponse::Text() |
|
110 { |
|
111 if (iText) |
|
112 { |
|
113 return *iText; |
|
114 } |
|
115 else |
|
116 { |
|
117 return KNullDesC8(); |
|
118 } |
|
119 } |