|
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 "cstsefacfile.h" |
|
21 #include "cstsace.h" |
|
22 #include "cstsfiledatamanager.h" |
|
23 |
|
24 namespace java |
|
25 { |
|
26 namespace satsa |
|
27 { |
|
28 |
|
29 // ============================ MEMBER FUNCTIONS =============================== |
|
30 |
|
31 // ----------------------------------------------------------------------------- |
|
32 // CSTSEFACFile::CSTSEFACFile |
|
33 // C++ default constructor can NOT contain any code, that |
|
34 // might leave. |
|
35 // ----------------------------------------------------------------------------- |
|
36 // |
|
37 CSTSEFACFile::CSTSEFACFile(CSTSFileDataManager* aFileDataManager) |
|
38 { |
|
39 iFileDataManager = aFileDataManager; |
|
40 } |
|
41 |
|
42 // ----------------------------------------------------------------------------- |
|
43 // CSTSEFACFile::NewL |
|
44 // Two-phased constructor. |
|
45 // ----------------------------------------------------------------------------- |
|
46 // |
|
47 CSTSEFACFile* CSTSEFACFile::NewLC(CSTSFileDataManager* aFileDataManager) |
|
48 { |
|
49 CSTSEFACFile* self = new(ELeave) CSTSEFACFile(aFileDataManager); |
|
50 CleanupStack::PushL(self); |
|
51 return self; |
|
52 } |
|
53 |
|
54 // Destructor |
|
55 CSTSEFACFile::~CSTSEFACFile() |
|
56 { |
|
57 } |
|
58 |
|
59 // ----------------------------------------------------------------------------- |
|
60 // CSTSEFACFile::SetArray |
|
61 // Sets the array, where suitable recors will be added. This array will own the |
|
62 // objects after they are added there. |
|
63 // (other items were commented in a header). |
|
64 // ----------------------------------------------------------------------------- |
|
65 void CSTSEFACFile::SetArray(CArrayPtr<CSTSAce>* aRecordsArr) |
|
66 { |
|
67 iRecordsArr = aRecordsArr; |
|
68 } |
|
69 |
|
70 // ----------------------------------------------------------------------------- |
|
71 // CSTSEFACFile::SetPath |
|
72 // |
|
73 // (other items were commented in a header). |
|
74 // ----------------------------------------------------------------------------- |
|
75 void CSTSEFACFile::SetPath(const TDesC8& aPath) |
|
76 { |
|
77 iPath.Set(aPath); |
|
78 } |
|
79 |
|
80 // ----------------------------------------------------------------------------- |
|
81 // CSTSEFACFile::DecodeAndAppendRowL |
|
82 // Decodes row and appends data to correct array. Ignores types which are |
|
83 // not needed. Returns false, if maximum valid data amount is not reached. |
|
84 // Returns true, if maxumum valid data amount is reached. |
|
85 // (other items were commented in a header). |
|
86 // ----------------------------------------------------------------------------- |
|
87 TBool CSTSEFACFile::DecodeAndAppendRowL(const TDesC8& aRowData, |
|
88 TInt aMaxValidDataAmount) |
|
89 { |
|
90 TBool returnValue = EFalse; |
|
91 |
|
92 //decode CSTSAce |
|
93 CSTSAce* currentObject = CSTSAce::NewLC(); |
|
94 currentObject->DecodeL(aRowData); |
|
95 |
|
96 //ownership moved to aAces array |
|
97 iRecordsArr->AppendL(currentObject); |
|
98 CleanupStack::Pop(currentObject); |
|
99 iFoundRecords++; |
|
100 |
|
101 if ((aMaxValidDataAmount != 0) && //if zero, no data limits used |
|
102 (iFoundRecords >= aMaxValidDataAmount)) |
|
103 { |
|
104 //all needed data is found |
|
105 returnValue = ETrue; |
|
106 } |
|
107 return returnValue; |
|
108 } |
|
109 |
|
110 // ----------------------------------------------------------------------------- |
|
111 // CSTSEFACFile::ResetData |
|
112 // Resets amount of found records and arrays of objects |
|
113 // (other items were commented in a header). |
|
114 // ----------------------------------------------------------------------------- |
|
115 void CSTSEFACFile::ResetData() |
|
116 { |
|
117 iFoundRecords = 0; |
|
118 } |
|
119 |
|
120 // ----------------------------------------------------------------------------- |
|
121 // CSTSEFACFile::RetrieveContentL |
|
122 // Gets content of some ACF file identified by path |
|
123 // (other items were commented in a header). |
|
124 // ----------------------------------------------------------------------------- |
|
125 const TDesC8& CSTSEFACFile::RetrieveContentL() |
|
126 { |
|
127 return iFileDataManager->RetrieveACFContentL(iPath); |
|
128 } |
|
129 |
|
130 } // namespace satsa |
|
131 } // namespace java |
|
132 // End of File |