|
1 // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of the License "Symbian Foundation License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // f32\sfsrv\cl_entry.cpp |
|
15 // |
|
16 // |
|
17 |
|
18 #include "cl_std.h" |
|
19 |
|
20 |
|
21 /** |
|
22 Default constructor. |
|
23 */ |
|
24 EXPORT_C TVolumeInfo::TVolumeInfo() |
|
25 { |
|
26 Mem::FillZ(this, sizeof(TVolumeInfo)); //-- zero-fill itself |
|
27 new(&iName)TBufC<KMaxFileName>; //-- initialise broken descriptor |
|
28 } |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 EXPORT_C TBool TEntry::IsReadOnly() const |
|
34 /** |
|
35 Tests whether the file or directory is read-only. |
|
36 |
|
37 @return ETrue if entry is read-only, EFalse if not. |
|
38 |
|
39 @see KEntryAttReadOnly |
|
40 */ |
|
41 { |
|
42 return(iAtt&KEntryAttReadOnly); |
|
43 } |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 EXPORT_C TBool TEntry::IsHidden() const |
|
49 /** |
|
50 Tests whether the file or directory is hidden. |
|
51 |
|
52 @return ETrue if entry is hidden, EFalse if not. |
|
53 |
|
54 @see KEntryAttHidden |
|
55 */ |
|
56 { |
|
57 |
|
58 return(iAtt&KEntryAttHidden); |
|
59 } |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 EXPORT_C TBool TEntry::IsSystem() const |
|
65 /** |
|
66 Tests whether the file or directory has the system attribute set. |
|
67 |
|
68 @return ETrue if entry is a system entry, EFalse if not. |
|
69 |
|
70 @see KEntryAttSystem |
|
71 */ |
|
72 { |
|
73 |
|
74 return(iAtt&KEntryAttSystem); |
|
75 } |
|
76 |
|
77 |
|
78 |
|
79 |
|
80 EXPORT_C TBool TEntry::IsDir() const |
|
81 /** |
|
82 Tests whether the entry is a directory. |
|
83 |
|
84 @return ETrue if entry indicates a directory, EFalse if not. |
|
85 |
|
86 @see KEntryAttDir |
|
87 */ |
|
88 { |
|
89 |
|
90 return(iAtt&KEntryAttDir); |
|
91 } |
|
92 |
|
93 |
|
94 |
|
95 |
|
96 EXPORT_C TBool TEntry::IsArchive() const |
|
97 /** |
|
98 Tests whether the file is an archive file. |
|
99 |
|
100 @return ETrue if file is archive, EFalse if not. |
|
101 |
|
102 @see KEntryAttArchive |
|
103 */ |
|
104 { |
|
105 |
|
106 return(iAtt&KEntryAttArchive); |
|
107 } |
|
108 |
|
109 |
|
110 |
|
111 |
|
112 EXPORT_C TEntryArray::TEntryArray() |
|
113 : iCount(0) |
|
114 /** |
|
115 Default constructor. |
|
116 |
|
117 Initialises its count of contained TEntry objects to zero. |
|
118 */ |
|
119 {} |
|
120 |
|
121 |
|
122 |
|
123 |
|
124 EXPORT_C TInt TEntryArray::Count() const |
|
125 /** |
|
126 Gets the number of entries in the array. |
|
127 |
|
128 @return The number of entries in the array. |
|
129 */ |
|
130 { |
|
131 |
|
132 if (iCount==KCountNeeded) |
|
133 { |
|
134 const TEntry* pE=(const TEntry*)iBuf.Ptr(); |
|
135 const TEntry* pEnd=PtrAdd(pE,iBuf.Length()); |
|
136 TInt c=0; |
|
137 while (pE<pEnd) |
|
138 { |
|
139 c++; |
|
140 pE=PtrAdd(pE,Align4(EntrySize(*pE))); |
|
141 } |
|
142 TEntryArray& me=(TEntryArray& )(*this); |
|
143 me.iCount=c; |
|
144 me.iIndex=0; |
|
145 me.iPos=(const TEntry*)iBuf.Ptr(); |
|
146 } |
|
147 return(iCount); |
|
148 } |
|
149 |
|
150 |
|
151 |
|
152 |
|
153 EXPORT_C const TEntry& TEntryArray::operator[](TInt anIndex) const |
|
154 /** |
|
155 Gets the directory entry at the specified index. |
|
156 |
|
157 @param anIndex Index of the entry within the array. |
|
158 This value is relative to zero. |
|
159 |
|
160 @return On return contains the entry at the specified index. |
|
161 |
|
162 @panic FSCLIENT 22 if anIndex is greater than or equal to the number |
|
163 of elements in the array. |
|
164 */ |
|
165 { |
|
166 |
|
167 __ASSERT_ALWAYS(anIndex<Count(),Panic(EEntryArrayBadIndex)); |
|
168 const TEntry* pE=iPos; |
|
169 TInt ix=iIndex; |
|
170 if (anIndex<ix) |
|
171 { |
|
172 ix=0; |
|
173 pE=(const TEntry*)iBuf.Ptr(); |
|
174 } |
|
175 while (ix<anIndex) |
|
176 { |
|
177 pE=PtrAdd(pE,Align4(EntrySize(*pE))); |
|
178 ix++; |
|
179 } |
|
180 TEntryArray& me=(TEntryArray& )(*this); |
|
181 me.iIndex=ix; |
|
182 me.iPos=pE; |
|
183 return(*pE); |
|
184 } |
|
185 |
|
186 |
|
187 |
|
188 |
|
189 EXPORT_C TEntry::TEntry() |
|
190 /** |
|
191 Default constructor. |
|
192 */ |
|
193 {} |
|
194 |
|
195 |
|
196 |
|
197 |
|
198 EXPORT_C TEntry::TEntry(const TEntry& aEntry) |
|
199 /** |
|
200 Copy constructor. |
|
201 |
|
202 @param aEntry The TEntry object to be copied. |
|
203 */ |
|
204 { |
|
205 Mem::Copy(this,&aEntry,EntrySize(aEntry)); |
|
206 } |
|
207 |
|
208 |
|
209 |
|
210 |
|
211 EXPORT_C TEntry& TEntry::operator=(const TEntry& aEntry) |
|
212 /** |
|
213 Assignment operator. |
|
214 |
|
215 @param aEntry The TEntry object to be copied to this TEntry object. |
|
216 |
|
217 @return A reference to this TEntry object. |
|
218 */ |
|
219 { |
|
220 if(this!=&aEntry) |
|
221 Mem::Copy(this,&aEntry,EntrySize(aEntry)); |
|
222 return(*this); |
|
223 } |