|
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 // INCLUDE FILES |
|
20 #include <asn1dec.h> |
|
21 #include "cstspath.h" |
|
22 |
|
23 namespace java |
|
24 { |
|
25 namespace satsa |
|
26 { |
|
27 |
|
28 // CONSTANTS |
|
29 const TInt KSTSMinNumberOfSubModules = 1; |
|
30 const TInt KSTSMaxNumberOfSubModules = 3; |
|
31 |
|
32 // ============================ MEMBER FUNCTIONS =============================== |
|
33 |
|
34 // ----------------------------------------------------------------------------- |
|
35 // CSTSPath::CSTSPath |
|
36 // C++ default constructor can NOT contain any code, that |
|
37 // might leave. |
|
38 // ----------------------------------------------------------------------------- |
|
39 // |
|
40 CSTSPath::CSTSPath() |
|
41 { |
|
42 } |
|
43 |
|
44 // ----------------------------------------------------------------------------- |
|
45 // CSTSPath::ConstructL |
|
46 // Symbian 2nd phase constructor can leave. |
|
47 // ----------------------------------------------------------------------------- |
|
48 // |
|
49 void CSTSPath::ConstructL() |
|
50 { |
|
51 iPath = KNullDesC8().AllocL(); |
|
52 } |
|
53 |
|
54 // ----------------------------------------------------------------------------- |
|
55 // CSTSPath::NewL |
|
56 // Two-phased constructor. |
|
57 // ----------------------------------------------------------------------------- |
|
58 // |
|
59 CSTSPath* CSTSPath::NewLC() |
|
60 { |
|
61 CSTSPath* self = new(ELeave) CSTSPath(); |
|
62 CleanupStack::PushL(self); |
|
63 self->ConstructL(); |
|
64 return self; |
|
65 } |
|
66 |
|
67 // ----------------------------------------------------------------------------- |
|
68 // CSTSPath::NewL |
|
69 // Two-phased constructor. |
|
70 // ----------------------------------------------------------------------------- |
|
71 // |
|
72 CSTSPath* CSTSPath::NewL() |
|
73 { |
|
74 CSTSPath* self = CSTSPath::NewLC(); |
|
75 CleanupStack::Pop(self); |
|
76 |
|
77 return self; |
|
78 } |
|
79 |
|
80 // Destructor |
|
81 CSTSPath::~CSTSPath() |
|
82 { |
|
83 delete iPath; |
|
84 } |
|
85 |
|
86 // ----------------------------------------------------------------------------- |
|
87 // CSTSPath::DecodeL |
|
88 // Decrypts raw data to this instance |
|
89 // ----------------------------------------------------------------------------- |
|
90 void CSTSPath::DecodeL(const TDesC8& aRawData) |
|
91 { |
|
92 CArrayPtr<TASN1DecGeneric>* itemsData = DecodeSequenceLC(ETrue, //must be sequence |
|
93 aRawData, KSTSMinNumberOfSubModules, KSTSMaxNumberOfSubModules); |
|
94 |
|
95 // we would not get this far if there is not 1-3 elements |
|
96 TInt pos = 0; |
|
97 if (pos >= itemsData->Count()) |
|
98 { |
|
99 User::Leave(KErrArgument); |
|
100 } |
|
101 |
|
102 //decoding Path (octet string) |
|
103 TASN1DecOctetString path; |
|
104 HBufC8* tmpPath = path.DecodeDERL(*itemsData->At(pos++)); |
|
105 delete iPath; |
|
106 iPath = tmpPath; |
|
107 //optional index and optional length are not needed |
|
108 |
|
109 CleanupStack::PopAndDestroy(itemsData); |
|
110 |
|
111 } |
|
112 |
|
113 // ----------------------------------------------------------------------------- |
|
114 // CSTSPath::Path |
|
115 // Getter for Path |
|
116 // ----------------------------------------------------------------------------- |
|
117 const TDesC8& CSTSPath::Path() const |
|
118 { |
|
119 return *iPath; |
|
120 } |
|
121 |
|
122 } // namespace satsa |
|
123 } // namespace java |
|
124 // End of File |