|
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 |
|
21 #include "cstsefacifile.h" |
|
22 #include "cstsacie.h" |
|
23 #include "cstsfiledatamanager.h" |
|
24 |
|
25 namespace java |
|
26 { |
|
27 namespace satsa |
|
28 { |
|
29 |
|
30 // ============================ MEMBER FUNCTIONS =============================== |
|
31 |
|
32 // ----------------------------------------------------------------------------- |
|
33 // CSTSEFACIFile::CSTSEFACIFile |
|
34 // C++ default constructor can NOT contain any code, that |
|
35 // might leave. |
|
36 // ----------------------------------------------------------------------------- |
|
37 // |
|
38 CSTSEFACIFile::CSTSEFACIFile(CSTSFileDataManager* aFileDataManager) |
|
39 { |
|
40 iFileDataManager = aFileDataManager; |
|
41 } |
|
42 |
|
43 // ----------------------------------------------------------------------------- |
|
44 // CSTSEFACIFile::ConstructL |
|
45 // Symbian 2nd phase constructor can leave. |
|
46 // ----------------------------------------------------------------------------- |
|
47 // |
|
48 void CSTSEFACIFile::ConstructL() |
|
49 { |
|
50 iAID = KNullDesC8().AllocL(); |
|
51 } |
|
52 |
|
53 // ----------------------------------------------------------------------------- |
|
54 // CSTSEFACIFile::NewLC |
|
55 // Two-phased constructor. |
|
56 // ----------------------------------------------------------------------------- |
|
57 // |
|
58 CSTSEFACIFile* CSTSEFACIFile::NewLC(CSTSFileDataManager* aFileDataManager) |
|
59 { |
|
60 CSTSEFACIFile* self = new(ELeave) CSTSEFACIFile(aFileDataManager); |
|
61 CleanupStack::PushL(self); |
|
62 self->ConstructL(); |
|
63 return self; |
|
64 } |
|
65 |
|
66 // Destructor |
|
67 CSTSEFACIFile::~CSTSEFACIFile() |
|
68 { |
|
69 delete iAID; |
|
70 } |
|
71 |
|
72 // ----------------------------------------------------------------------------- |
|
73 // CSTSEFAODFFile::SetArray |
|
74 // Sets the array, where suitable recors will be added. This array will own the |
|
75 // objects after they are added there. |
|
76 // (other items were commented in a header). |
|
77 // ----------------------------------------------------------------------------- |
|
78 void CSTSEFACIFile::SetArray(CArrayPtr<CSTSAcie>* aRecordsArr) |
|
79 { |
|
80 iRecordsArr = aRecordsArr; |
|
81 } |
|
82 |
|
83 // ----------------------------------------------------------------------------- |
|
84 // CSTSEFACIFile::SetAIDL |
|
85 // |
|
86 // (other items were commented in a header). |
|
87 // ----------------------------------------------------------------------------- |
|
88 // |
|
89 void CSTSEFACIFile::SetAIDL(const TDesC8& aAID) |
|
90 { |
|
91 HBufC8* tmp = aAID.AllocL(); |
|
92 delete iAID; |
|
93 iAID = tmp; |
|
94 } |
|
95 |
|
96 // ----------------------------------------------------------------------------- |
|
97 // CSTSEFACIFile::DecodeAndAppendRowL |
|
98 // Decodes row and appends data to correct array. Ignores types which are |
|
99 // not needed. Returns false, if maximum valid data amount is not reached. |
|
100 // Returns true, if maxumum valid data amount is reached. |
|
101 // (other items were commented in a header). |
|
102 // ----------------------------------------------------------------------------- |
|
103 TBool CSTSEFACIFile::DecodeAndAppendRowL(const TDesC8& aRowData, |
|
104 TInt aMaxValidDataAmount) |
|
105 { |
|
106 |
|
107 TBool returnValue = EFalse; |
|
108 |
|
109 //decode CSTSAcie |
|
110 CSTSAcie* currentObject = CSTSAcie::NewLC(); |
|
111 currentObject->DecodeL(aRowData); |
|
112 |
|
113 //if we found correct AID or acie is meant for all ( it is null ) |
|
114 if (currentObject->AID() == iAID->Des() || currentObject->AID() |
|
115 == KNullDesC8()) |
|
116 { |
|
117 iRecordsArr->AppendL(currentObject); |
|
118 CleanupStack::Pop(currentObject); |
|
119 iFoundRecords++; |
|
120 } |
|
121 else |
|
122 { |
|
123 CleanupStack::PopAndDestroy(currentObject); |
|
124 } |
|
125 |
|
126 if ((aMaxValidDataAmount != 0) && //if zero, no data limits used |
|
127 (iFoundRecords >= aMaxValidDataAmount)) |
|
128 { |
|
129 //all needed data is found |
|
130 returnValue = ETrue; |
|
131 } |
|
132 return returnValue; |
|
133 } |
|
134 |
|
135 // ----------------------------------------------------------------------------- |
|
136 // CSTSEFACIFile::ResetData |
|
137 // Resets amount of found records and arrays of objects |
|
138 // (other items were commented in a header). |
|
139 // ----------------------------------------------------------------------------- |
|
140 void CSTSEFACIFile::ResetData() |
|
141 { |
|
142 iFoundRecords = 0; |
|
143 } |
|
144 |
|
145 // ----------------------------------------------------------------------------- |
|
146 // CSTSEFACFile::RetrieveContentL |
|
147 // |
|
148 // (other items were commented in a header). |
|
149 // ----------------------------------------------------------------------------- |
|
150 const TDesC8& CSTSEFACIFile::RetrieveContentL() |
|
151 { |
|
152 return iFileDataManager->RetrieveACIFContentL(); |
|
153 } |
|
154 |
|
155 } // namespace satsa |
|
156 } // namespace java |
|
157 // End of File |