equal
deleted
inserted
replaced
96 @internalComponent |
96 @internalComponent |
97 @released |
97 @released |
98 |
98 |
99 @param aLongEntry - the long entry |
99 @param aLongEntry - the long entry |
100 */ |
100 */ |
101 void ClongName::WriteLongEntry(CLongEntry* aLongEntry,String& longEntryString) |
101 void ClongName::WriteLongEntry(CLongEntry* aLongEntry,string& longEntryString) |
102 { |
102 { |
103 longEntryString.append(KWriteOnce, aLongEntry->GetDirOrder()); |
103 longEntryString.append(KWriteOnce, aLongEntry->GetDirOrder()); |
104 WriteSubName(aLongEntry->GetSubName1(),(ESubName1Length*2),longEntryString); |
104 WriteSubName(aLongEntry->GetSubName1(),(ESubName1Length*2),longEntryString); |
105 longEntryString.append(KWriteOnce, aLongEntry->GetAttribute()); |
105 longEntryString.append(KWriteOnce, aLongEntry->GetAttribute()); |
106 longEntryString.append(KWriteOnce, aLongEntry->GetDirType()); |
106 longEntryString.append(KWriteOnce, aLongEntry->GetDirType()); |
122 |
122 |
123 @param aName - Sub name of a long entry |
123 @param aName - Sub name of a long entry |
124 @param aSubNameLength - No of characters to be filled |
124 @param aSubNameLength - No of characters to be filled |
125 @param alongEntryString - formatted sub name appended to this string |
125 @param alongEntryString - formatted sub name appended to this string |
126 */ |
126 */ |
127 void ClongName::WriteSubName(String& aSubName,unsigned short aSubNameLength,String& alongEntryString) |
127 void ClongName::WriteSubName(string& aSubName,unsigned short aSubNameLength,string& alongEntryString) |
128 { |
128 { |
129 unsigned int subNameCurrLength = aSubName.length(); |
129 unsigned int subNameCurrLength = aSubName.length(); |
130 if(subNameCurrLength == 0) |
130 if(subNameCurrLength == 0) |
131 { |
131 { |
132 iFirstNullName = true; |
132 iFirstNullName = true; |
152 } |
152 } |
153 //Apply padding with two zero's to mention Long Name end. |
153 //Apply padding with two zero's to mention Long Name end. |
154 if(subNameCurrLength < aSubNameLength) |
154 if(subNameCurrLength < aSubNameLength) |
155 { |
155 { |
156 aSubName.insert(subNameCurrLength, KPaddingCharCnt, 0); |
156 aSubName.insert(subNameCurrLength, KPaddingCharCnt, 0); |
|
157 iSubNameProperEnd = false; |
157 } |
158 } |
158 } |
159 } |
159 subNameCurrLength = aSubName.length(); |
160 subNameCurrLength = aSubName.length(); |
160 if((iSubNameProperEnd == true) && (iFirstNullName == true)) |
161 if((iSubNameProperEnd == true) && (iFirstNullName == true)) |
161 { |
162 { |
182 |
183 |
183 @param aFirstName - first sub name |
184 @param aFirstName - first sub name |
184 @param aSecondName - Second sub name |
185 @param aSecondName - Second sub name |
185 @param aThirdName - third sub name |
186 @param aThirdName - third sub name |
186 */ |
187 */ |
187 void ClongName::PushAndErase(String& aFirstName,String& aSecondName,String& aThirdName) |
188 void ClongName::PushAndErase(string& aFirstName,string& aSecondName,string& aThirdName) |
188 { |
189 { |
189 iSubNamesList.push_back(aFirstName); |
190 iSubNamesList.push_back(aFirstName); |
190 aFirstName.erase(); |
191 aFirstName.erase(); |
191 iSubNamesList.push_back(aSecondName); |
192 iSubNamesList.push_back(aSecondName); |
192 aSecondName.erase(); |
193 aSecondName.erase(); |
204 @param aStartIndex - Sub name starting index |
205 @param aStartIndex - Sub name starting index |
205 @param aStringLength - total string length |
206 @param aStringLength - total string length |
206 @param aSubNameLength - Length of the Sub Name of required length |
207 @param aSubNameLength - Length of the Sub Name of required length |
207 @param aSubName - splitted Sub Name assigned using this string |
208 @param aSubName - splitted Sub Name assigned using this string |
208 */ |
209 */ |
209 void ClongName::GetSubName(String& aLongName, |
210 void ClongName::GetSubName(string& aLongName, |
210 int& aStartIndex, |
211 int& aStartIndex, |
211 int& aStringLength, |
212 int& aStringLength, |
212 int aSubNameLength, |
213 int aSubNameLength, |
213 String& aSubName) |
214 string& aSubName) |
214 { |
215 { |
215 if((aStartIndex + aSubNameLength) <= aStringLength) |
216 if((aStartIndex + aSubNameLength) <= aStringLength) |
216 { |
217 { |
217 aSubName = aLongName.substr(aStartIndex,aSubNameLength); |
218 aSubName = aLongName.substr(aStartIndex,aSubNameLength); |
218 aStartIndex += aSubNameLength; |
219 aStartIndex += aSubNameLength; |
228 iNameList container. |
229 iNameList container. |
229 |
230 |
230 @internalComponent |
231 @internalComponent |
231 @released |
232 @released |
232 */ |
233 */ |
233 void ClongName::FormatLongFileName(String& aLongName) |
234 void ClongName::FormatLongFileName(string& aLongName) |
234 { |
235 { |
235 int stringLength = aLongName.length(); |
236 int stringLength = aLongName.length(); |
236 int startIndex = 0; |
237 int startIndex = 0; |
237 String iSubName1; |
238 string iSubName1; |
238 String iSubName2; |
239 string iSubName2; |
239 String iSubName3; |
240 string iSubName3; |
240 |
241 |
241 while(startIndex < stringLength) |
242 while(startIndex < stringLength) |
242 { |
243 { |
243 GetSubName(aLongName,startIndex,stringLength,ESubName1Length,iSubName1); |
244 GetSubName(aLongName,startIndex,stringLength,ESubName1Length,iSubName1); |
244 GetSubName(aLongName,startIndex,stringLength,ESubName2Length,iSubName2); |
245 GetSubName(aLongName,startIndex,stringLength,ESubName2Length,iSubName2); |
256 @internalComponent |
257 @internalComponent |
257 @released |
258 @released |
258 |
259 |
259 @return - returns the short name |
260 @return - returns the short name |
260 */ |
261 */ |
261 void ClongName::CheckAndUpdateShortName(String& aShortName) |
262 void ClongName::CheckAndUpdateShortName(string& aShortName) |
262 { |
263 { |
263 char trailingChar; |
264 char trailingChar; |
264 StringList::iterator beginIter = GShortEntryList.begin(); |
265 StringList::iterator beginIter = GShortEntryList.begin(); |
265 StringList::iterator endIter = GShortEntryList.end(); |
266 StringList::iterator endIter = GShortEntryList.end(); |
266 String tempString; |
267 string tempString; |
267 while(beginIter != endIter) |
268 while(beginIter != endIter) |
268 { |
269 { |
269 tempString = (*beginIter); |
270 tempString = (*beginIter); |
270 if(strcmp(tempString.c_str(),aShortName.c_str()) == 0) |
271 if(strcmp(tempString.c_str(),aShortName.c_str()) == 0) |
271 { |
272 { |
273 aShortName[iTildeNumberPosition] = ++trailingChar; //Increment the character value by 1 |
274 aShortName[iTildeNumberPosition] = ++trailingChar; //Increment the character value by 1 |
274 continue; |
275 continue; |
275 } |
276 } |
276 ++beginIter; |
277 ++beginIter; |
277 } |
278 } |
|
279 int gap = ENameLengthWithExtension - aShortName.length(); |
|
280 if(gap >0 ) |
|
281 aShortName.append(gap,KSpace); |
278 } |
282 } |
279 |
283 |
280 /** |
284 /** |
281 Function responsible to take the long file name as input and to prepare the short name. |
285 Function responsible to take the long file name as input and to prepare the short name. |
282 e.g. Long File Name.pl to LONGFI~1PL |
286 e.g. Long File Name.pl to LONGFI~1PL |
285 @released |
289 @released |
286 |
290 |
287 @return - returns the short name |
291 @return - returns the short name |
288 */ |
292 */ |
289 |
293 |
290 String ClongName::GetShortEntryName() |
294 string ClongName::GetShortEntryName() |
291 { |
295 { |
292 String shortName; |
296 string shortName; |
293 unsigned int extensionIndex = iLongName.find_last_of(KDot); |
297 unsigned int extensionIndex = iLongName.find_last_of(KDot); |
294 |
298 |
295 unsigned int dotIndex = extensionIndex; |
299 unsigned int dotIndex = extensionIndex; |
296 //Erase all the dots from the string, but keep the extension index |
300 //Erase all the dots from the string, but keep the extension index |
297 while(dotIndex != String::npos) |
301 while(dotIndex != string::npos) |
298 { |
302 { |
299 iLongName.erase(dotIndex,1); //Erase the dot |
303 iLongName.erase(dotIndex,1); //Erase the dot |
300 dotIndex = iLongName.find_first_of(KDot); |
304 dotIndex = iLongName.find_first_of(KDot); |
301 if(dotIndex != String::npos) |
305 if(dotIndex != string::npos) |
302 { |
306 { |
303 //Decrement only if more than one dot exists |
307 //Decrement only if more than one dot exists |
304 --extensionIndex; |
308 --extensionIndex; |
305 } |
309 } |
306 } |
310 } |
330 { |
334 { |
331 if(shortName.length() < ENameLength) |
335 if(shortName.length() < ENameLength) |
332 { |
336 { |
333 shortName.append((ENameLength - shortName.length()),KSpace); |
337 shortName.append((ENameLength - shortName.length()),KSpace); |
334 } |
338 } |
335 String shortNameString = iLongName.substr(extensionIndex,EExtensionLength); |
339 string shortNameString = iLongName.substr(extensionIndex,EExtensionLength); |
336 shortName.append(ToUpper(shortNameString)); |
340 shortName.append(ToUpper(shortNameString)); |
337 CheckAndUpdateShortName(shortName); |
341 CheckAndUpdateShortName(shortName); |
338 return shortName; |
342 return shortName; |
339 } |
343 } |
340 //extension padding |
344 //extension padding |
375 @param aEntry - directory entry which has long file name |
379 @param aEntry - directory entry which has long file name |
376 @return shortEntry - returns the initialized short Directory entry |
380 @return shortEntry - returns the initialized short Directory entry |
377 */ |
381 */ |
378 CDirectory* ClongName::CreateShortEntry(CDirectory* aEntry) |
382 CDirectory* ClongName::CreateShortEntry(CDirectory* aEntry) |
379 { |
383 { |
380 CDirectory* shortEntry = new CDirectory((char*)iShortName.c_str()); |
384 CDirectory* shortEntry = new CDirectory(iShortName.c_str(),NULL); |
381 shortEntry->SetEntryAttribute(aEntry->GetEntryAttribute()); |
385 shortEntry->SetEntryAttribute(aEntry->GetEntryAttribute()); |
382 if(aEntry->IsFile()) |
386 if(aEntry->IsFile()) |
383 { |
387 { |
384 shortEntry->SetFilePath((char*)aEntry->GetFilePath().c_str()); |
388 shortEntry->SetFilePath((char*)aEntry->GetFilePath().c_str()); |
385 } |
389 } |
416 @internalComponent |
420 @internalComponent |
417 @released |
421 @released |
418 |
422 |
419 @return - returns the formatted long name string |
423 @return - returns the formatted long name string |
420 */ |
424 */ |
421 String ClongName::CreateLongEntries() |
425 string ClongName::CreateLongEntries() |
422 { |
426 { |
423 String longEntryString; |
427 string longEntryString; |
424 CLongEntry* longEntryObject; |
428 CLongEntry* longEntryObject; |
425 unsigned char chckSum = CalculateCheckSum(); |
429 unsigned char chckSum = CalculateCheckSum(); |
426 unsigned char dirOrderNumber = 0x00; |
430 unsigned char dirOrderNumber = 0x00; |
427 while(iSubNamesList.size() > 0) |
431 while(iSubNamesList.size() > 0) |
428 { |
432 { |