symport/f32/sfsrv/cl_parse.cpp
changeset 1 0a7b44b10206
child 2 806186ab5e14
equal deleted inserted replaced
0:c55016431358 1:0a7b44b10206
       
     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_parse.cpp
       
    15 // 
       
    16 //
       
    17 
       
    18 #include "cl_std.h"
       
    19 
       
    20 const TInt KLexComponents=4;
       
    21 const TInt KLexNames=3;
       
    22 
       
    23 
       
    24 
       
    25 
       
    26 EXPORT_C TParseBase::TParseBase()
       
    27 	: iWild(0)
       
    28 /**
       
    29 Default constructor.
       
    30 */
       
    31 	{
       
    32 
       
    33 	Mem::FillZ(&iField[0],sizeof(iField));
       
    34 	}
       
    35 
       
    36 
       
    37 
       
    38 
       
    39 TInt TParseBase::ParseDrive(TLex& aName,TBool& aDone)
       
    40 //
       
    41 // Parse the drive name.
       
    42 //
       
    43 	{
       
    44 
       
    45 	TPtrC d=aName.RemainderFromMark();
       
    46 	if (d.Length()<2 || d[1]!=KDriveDelimiter)
       
    47 		return(KErrNone);	//must be Drive delimeter and longer that tow to be valid drive
       
    48 	TCharF c=d[0];
       
    49 	if (!c.IsAlpha())		//must be alphaber letter 
       
    50 		return(KErrBadName);
       
    51 	if (!aDone)
       
    52 		{
       
    53 		if(iMod)
       
    54 			NameBuf()+=d.Left(2);
       
    55 		aDone=ETrue;
       
    56 		}
       
    57 	aName.SkipAndMark(2);
       
    58 	return(KErrNone);
       
    59 	}
       
    60 
       
    61 TInt TParseBase::ParsePath(TLex& aName,TBool& aDone)
       
    62 //
       
    63 // Parse the path.
       
    64 //
       
    65 	{
       
    66 
       
    67 	TPtrC d=aName.RemainderFromMark();
       
    68 	if (d.Length() && d[0]!=KPathDelimiter)
       
    69 		return(KErrNone); // Require first char of path to be a '\'
       
    70 	TInt n=d.LocateReverse(KPathDelimiter)+1;
       
    71 	if (n && !aDone)
       
    72 		{
       
    73 		if(iMod)
       
    74 			{
       
    75 			if (NameBuf().Length()+n>KMaxFileName)
       
    76 				return(KErrBadName);
       
    77 			NameBuf()+=d.Left(n);
       
    78 			}
       
    79 		aDone=ETrue;
       
    80 		}
       
    81 	aName.SkipAndMark(n);
       
    82 	return(KErrNone);
       
    83 	}
       
    84 
       
    85 LOCAL_C TBool IsSpace(const TDesC& aDes)
       
    86 //
       
    87 // Returns ETrue if aDes only contains spaces or is zero length
       
    88 //
       
    89 	{
       
    90 
       
    91 	TInt len=aDes.Length();
       
    92 	for (TInt i=0;i<len;i++)
       
    93 		{
       
    94 		TChar txt=aDes[i];
       
    95 		if (!txt.IsSpace())
       
    96 			return(EFalse);
       
    97 		}
       
    98 	return(ETrue);
       
    99 	}
       
   100 
       
   101 TInt TParseBase::ParseName(TLex& aName,TBool& aDone)
       
   102 //
       
   103 // Parse the name.
       
   104 //
       
   105 	{
       
   106 
       
   107 	TPtrC d=aName.RemainderFromMark();
       
   108 	if (d.Locate(KPathDelimiter)!=KErrNotFound)
       
   109 		return(KErrBadName); // Illegal name - filenames cannot contain a '\'
       
   110 	TInt n=d.LocateReverse(KExtDelimiter);
       
   111 	if (n==KErrNotFound)
       
   112 		{
       
   113 		n=d.Length();
       
   114 		if (IsSpace(d.Left(n)))
       
   115 			return(KErrNone);
       
   116 		}
       
   117 	TPtrC v=d.Left(n);
       
   118 	if (n && !aDone)
       
   119 		{
       
   120 		if (v.Locate(KMatchOne)!=KErrNotFound)	//	Found ? in the name
       
   121 			iWild|=(EWildName|EWildEither|EWildIsKMatchOne);		
       
   122 		if (v.Locate(KMatchAny)!=KErrNotFound)	//	Found * in the name
       
   123 			iWild|=(EWildName|EWildEither|EWildIsKMatchAny);		
       
   124 		if(iMod)
       
   125 			{
       
   126 			if (NameBuf().Length()+n>KMaxFileName)	
       
   127 				return(KErrBadName);
       
   128 			NameBuf()+=v;
       
   129 			if (n==d.Length())
       
   130 				NameBuf().TrimRight();
       
   131 			}
       
   132 		aDone=ETrue;
       
   133 		}
       
   134 	aName.SkipAndMark(n);
       
   135 	return(KErrNone);
       
   136 	}
       
   137 
       
   138 TInt TParseBase::ParseExt(TLex& aName,TBool& aDone)
       
   139 //
       
   140 // Parse the extension.
       
   141 //
       
   142 	{
       
   143 
       
   144 	TPtrC d=aName.RemainderFromMark();
       
   145 	if (d.Length() && !IsSpace(d) && !aDone)
       
   146 		{
       
   147 		if (d.Locate(KMatchOne)!=KErrNotFound || d.Locate(KMatchAny)!=KErrNotFound)
       
   148 			iWild|=(EWildExt|EWildEither);
       
   149 		if(iMod)
       
   150 			{
       
   151 			if (NameBuf().Length()+d.Length()>KMaxFileName)
       
   152 				return(KErrBadName);
       
   153 			NameBuf()+=d;
       
   154 			NameBuf().TrimRight();
       
   155 			}
       
   156 		else
       
   157 			aName.SkipAndMark(d.Length());
       
   158 		aDone=ETrue;
       
   159 		}
       
   160 	return(KErrNone);
       
   161 	}
       
   162 
       
   163 TInt TParseBase::Set(const TDesC* aName,const TDesC* aRelated,const TDesC* aDefault,TBool allowWild)
       
   164 //
       
   165 // Parse a name. Optionally allow wild cards.
       
   166 //
       
   167 	{
       
   168 
       
   169 	TInt (TParseBase::*parse[KLexComponents])(TLex& aName,TBool& aDone);
       
   170 	parse[0]=&TParseBase::ParseDrive;
       
   171 	parse[1]=&TParseBase::ParsePath;
       
   172 	parse[2]=&TParseBase::ParseName;
       
   173 	parse[3]=&TParseBase::ParseExt;
       
   174 	
       
   175 	iWild=0;
       
   176 
       
   177 	Mem::FillZ(&iField[0],sizeof(iField));
       
   178 	
       
   179 	TLex name(*aName);
       
   180 	TLex def;
       
   181 	TLex rel;
       
   182 	TInt lexnames;
       
   183 	if(iMod)
       
   184 		{
       
   185 		if (aRelated)
       
   186 			rel=(*aRelated);
       
   187 		if (aDefault)
       
   188 			def=(*aDefault);
       
   189 		NameBuf().Zero();
       
   190 		lexnames = KLexNames;
       
   191 		}
       
   192 	else
       
   193 		{
       
   194 		lexnames = 1;
       
   195 		}
       
   196 	
       
   197 	TLex* lex[KLexNames];
       
   198 	lex[0]=(&name);
       
   199 	lex[1]=(&rel);
       
   200 	lex[2]=(&def);
       
   201 	
       
   202 	name.Mark();
       
   203 	rel.Mark();
       
   204 	def.Mark();
       
   205 	
       
   206 	TInt r;
       
   207 	TInt pos=0;
       
   208 	
       
   209 	for (TInt i=0;i<KLexComponents;i++)
       
   210 		{
       
   211 		TBool done=EFalse;
       
   212 		for (TInt j=0;j<lexnames;j++)
       
   213 			{
       
   214 			if ((r=(this->*parse[i])(*lex[j],done))<KErrNone)
       
   215 				return(r);
       
   216 			if (j==0 && done)
       
   217 				iField[i].present=ETrue;
       
   218 			}
       
   219 		TInt len;
       
   220 		if(iMod)
       
   221 			len=NameBuf().Length()-pos;
       
   222 		else
       
   223 			len=name.MarkedOffset()-pos;
       
   224 		iField[i].len=(TUint8)len;
       
   225 		iField[i].pos=(TUint8)pos;
       
   226 		pos+=len;
       
   227 		}
       
   228 	if (!allowWild && iWild)
       
   229 		return(KErrBadName);
       
   230 	if (iField[EPath].len==1)
       
   231 		iWild|=EIsRoot;
       
   232 	return(KErrNone);
       
   233 	}
       
   234 
       
   235 
       
   236 
       
   237 
       
   238 EXPORT_C TInt TParseBase::PopDir()
       
   239 /**
       
   240 Removes the last directory from the path in the fully parsed specification.
       
   241  
       
   242 This function may be used to navigate up one level in a directory hierarchy.
       
   243 An error is returned if the specified directory is the root.
       
   244 
       
   245 @return KErrNone if successful, otherwise one of the other system-wide error 
       
   246         codes.
       
   247 */
       
   248 	{
       
   249 
       
   250 	if (IsRoot())
       
   251 		return(KErrGeneral);
       
   252 	TInt len;
       
   253 	if (iField[EName].pos==0 && NameBuf().Length()==256)
       
   254 		len=256;
       
   255 	else
       
   256 		len=iField[EName].pos;
       
   257 	TPtrC p(NameBuf().Ptr(),len-1);
       
   258 	TInt pos=p.LocateReverse(KPathDelimiter)+1;
       
   259 	len-=pos;
       
   260 	NameBuf().Delete(pos,len);
       
   261 	iField[EName].pos=(TUint8)(iField[EName].pos-len);
       
   262 	iField[EExt].pos=(TUint8)(iField[EExt].pos-len);
       
   263 	iField[EPath].len=(TUint8)(iField[EPath].len-len);
       
   264 	if (iField[EPath].len==1)
       
   265 		iWild|=EIsRoot;
       
   266 	return(KErrNone);
       
   267 	}
       
   268 
       
   269 
       
   270 
       
   271 
       
   272 EXPORT_C TInt TParseBase::AddDir(const TDesC& aName)
       
   273 /**
       
   274 Adds a single directory onto the end of the path in
       
   275 the fully parsed specification. 
       
   276 
       
   277 The directory is inserted between the final directory, and the filename, if 
       
   278 there is one.
       
   279 
       
   280 @param aName The directory to be added. It must not start with a \\ otherwise 
       
   281              the function does not recognise it as a valid directory name
       
   282              and an error is returned.
       
   283              The directory name must not end with a \\ since the function 
       
   284              adds this automatically. It must not exceed the maximum
       
   285              filename length, KMaxFileName characters, otherwise  an error
       
   286              is returned.
       
   287 
       
   288 @return KErrNone if successful, otherwise another of the system-wide error 
       
   289         codes.   
       
   290 @see KMaxFileName
       
   291 */
       
   292 	{
       
   293 
       
   294 	if (aName.Length()==0)
       
   295 		return(KErrNone);
       
   296 	TInt len=aName.Length()+1;
       
   297 	if ((len+NameBuf().Length())>NameBuf().MaxLength())
       
   298 		return(KErrGeneral);
       
   299 	TInt pos=aName.Locate(KPathDelimiter);
       
   300 	if (pos!=KErrNotFound)
       
   301 		return(KErrBadName);
       
   302 	TFileName n=aName;
       
   303 	n.Append(KPathDelimiter);
       
   304 	NameBuf().Insert(iField[EName].pos,n);
       
   305 	iField[EPath].len=(TUint8)(iField[EPath].len+len);
       
   306 	iField[EName].pos=(TUint8)(iField[EName].pos+len);
       
   307 	iField[EExt].pos=(TUint8)(len+iField[EExt].pos);
       
   308 	if (IsRoot())
       
   309 		iWild&=~EIsRoot;
       
   310 	return(KErrNone);
       
   311 	}
       
   312 
       
   313 
       
   314 
       
   315 
       
   316 EXPORT_C const TDesC& TParseBase::FullName() const
       
   317 /**
       
   318 Gets the complete file specification.
       
   319 
       
   320 This is in the form:
       
   321 
       
   322 drive-letter: \\path\\filename.extension
       
   323 
       
   324 @return The fully parsed file specification.
       
   325 */
       
   326 	{
       
   327 
       
   328 	return(NameBufC());
       
   329 	}
       
   330 
       
   331 
       
   332 
       
   333 
       
   334 EXPORT_C TPtrC TParseBase::Drive() const
       
   335 /**
       
   336 Gets the drive letter.
       
   337 
       
   338 The drive letter is in the form:
       
   339 
       
   340 drive-letter:
       
   341 
       
   342 Note that the drive letter is folded.
       
   343 
       
   344 @return The drive letter and colon.
       
   345 */
       
   346 	{
       
   347 
       
   348 	const SField& f=iField[EDrive];
       
   349 	return(NameBufC().Mid(f.pos,f.len));
       
   350 	}
       
   351 
       
   352 
       
   353 
       
   354 
       
   355 EXPORT_C TPtrC TParseBase::Path() const
       
   356 /**
       
   357 Gets the path.
       
   358 
       
   359 The path is in the form:
       
   360 
       
   361 \\path\\
       
   362 
       
   363 @return The path. It always begins and ends in a backslash.
       
   364 */
       
   365 	{
       
   366 
       
   367 	const SField& f=iField[EPath];
       
   368 	return(NameBufC().Mid(f.pos,f.len));
       
   369 	}
       
   370 
       
   371 
       
   372 
       
   373 
       
   374 EXPORT_C TPtrC TParseBase::DriveAndPath() const
       
   375 /**
       
   376 Gets the drive letter and path.
       
   377 
       
   378 This is in the form
       
   379 
       
   380 drive-letter:\\path\\
       
   381 
       
   382 Note that the drive letter is folded
       
   383 
       
   384 @return The drive and path.
       
   385 */
       
   386 	{
       
   387 
       
   388 	const SField& f=iField[EDrive];
       
   389 	return(NameBufC().Mid(f.pos,f.len+iField[EPath].len));
       
   390 	}
       
   391 
       
   392 
       
   393 
       
   394 
       
   395 EXPORT_C TPtrC TParseBase::Name() const
       
   396 /**
       
   397 Gets the filename.
       
   398 
       
   399 This is in the form
       
   400 
       
   401 filename
       
   402 
       
   403 @return The filename.
       
   404 */
       
   405 	{
       
   406 
       
   407 	const SField& f=iField[EName];
       
   408 	return(NameBufC().Mid(f.pos,f.len));
       
   409 	}
       
   410 
       
   411 
       
   412 
       
   413 
       
   414 EXPORT_C TPtrC TParseBase::Ext() const
       
   415 /**
       
   416 Gets the extension.
       
   417 
       
   418 This is in the form:
       
   419 
       
   420 .extension
       
   421 
       
   422 @return The extension and preceding dot.
       
   423 */
       
   424 	{
       
   425 
       
   426 	const SField& f=iField[EExt];
       
   427 	return(NameBufC().Mid(f.pos,f.len));
       
   428 	}
       
   429 
       
   430 
       
   431 
       
   432 
       
   433 EXPORT_C TPtrC TParseBase::NameAndExt() const
       
   434 /**
       
   435 Gets the filename and extension.
       
   436 
       
   437 This is in the form:
       
   438 
       
   439 filename.ext
       
   440 
       
   441 @return The filename and extension.
       
   442 */
       
   443 	{
       
   444 
       
   445 	const SField& f=iField[EName];
       
   446 	return(NameBufC().Mid(f.pos,f.len+iField[EExt].len));
       
   447 	}
       
   448 
       
   449 
       
   450 
       
   451 
       
   452 EXPORT_C TBool TParseBase::DrivePresent() const
       
   453 /**
       
   454 Tests whether a drive is present.
       
   455 
       
   456 Note that this function refers to a component 
       
   457 in the aName argument specified in calls to TParse::Set(), TParse::SetNoWild() 
       
   458 or RFs::Parse(), not to the resulting fully parsed file specification.
       
   459 
       
   460 @return True if a drive present, false if not.
       
   461 
       
   462 @see TParse
       
   463 @see RFs
       
   464 */
       
   465 	{
       
   466 
       
   467 	return(iField[EDrive].present);
       
   468 	}
       
   469 
       
   470 
       
   471 
       
   472 
       
   473 EXPORT_C TBool TParseBase::PathPresent() const
       
   474 /**
       
   475 Tests whether a path is present.
       
   476 
       
   477 Note that this function refers to a component 
       
   478 in the aName argument specified in calls to TParse::Set(), TParse::SetNoWild() 
       
   479 or RFs::Parse(), not to the resulting fully parsed file specification.
       
   480 
       
   481 @return True if a path present, false if not.
       
   482 
       
   483 @see TParse
       
   484 @see RFs
       
   485 */
       
   486 	{
       
   487 
       
   488 	return(iField[EPath].present);
       
   489 	}
       
   490 
       
   491 
       
   492 
       
   493 
       
   494 EXPORT_C TBool TParseBase::NamePresent() const
       
   495 /**
       
   496 Tests whether a file name is present.
       
   497 
       
   498 Note that this function refers to a component 
       
   499 in the aName argument specified in calls to TParse::Set(), TParse::SetNoWild() 
       
   500 or RFs::Parse(), not to the resulting fully parsed file specification.
       
   501 
       
   502 This function returns true even if the filename specified in aName contains 
       
   503 only wildcards. It only returns false if nothing is specified.
       
   504 
       
   505 @return True if a name present, false if not.
       
   506 */
       
   507 	{
       
   508 
       
   509 	return(iField[EName].present);
       
   510 	}
       
   511 
       
   512 
       
   513 
       
   514 
       
   515 EXPORT_C TBool TParseBase::ExtPresent() const
       
   516 /**
       
   517 Tests whether an extension is present.
       
   518 
       
   519 Note that this function refers to a component
       
   520 in the aName argument specified in calls to TParse::Set(), TParse::SetNoWild() 
       
   521 or RFs::Parse(), not to the resulting fully parsed file specification.
       
   522 
       
   523 This function returns true even if the extension contains only wildcards. 
       
   524 It only returns false if nothing is specified.
       
   525 
       
   526 @return True if an extension present, false if not.
       
   527 */
       
   528 	{
       
   529 
       
   530 	return(iField[EExt].present);
       
   531 	}
       
   532 
       
   533 
       
   534 
       
   535 
       
   536 EXPORT_C TBool TParseBase::NameOrExtPresent() const
       
   537 /**
       
   538 Tests whether a filename or an extension are present.
       
   539 
       
   540 Note that this function refers to a component in the aName argument
       
   541 specified in calls to TParse::Set(), TParse::SetNoWild() or RFs::Parse(), not
       
   542 to the resulting fully parsed file specification.
       
   543 
       
   544 This function returns true even if the filename or extension specified in 
       
   545 aName contain only wildcards. It only returns false if nothing is specified.
       
   546 
       
   547 @return True if either a name or an extension or both are present,
       
   548         otherwise false.
       
   549 */
       
   550 	{
       
   551 
       
   552 	return(iField[EName].present || iField[EExt].present);
       
   553 	}
       
   554 
       
   555 
       
   556 
       
   557 
       
   558 
       
   559 EXPORT_C TBool TParseBase::IsRoot() const
       
   560 /**
       
   561 Tests whether the path in the fully parsed specification is the root directory.
       
   562 
       
   563 @return True if path is root, false if not.
       
   564 */
       
   565 	{
       
   566 
       
   567 	return(iWild&EIsRoot);
       
   568 	}
       
   569 
       
   570 
       
   571 
       
   572 
       
   573 EXPORT_C TBool TParseBase::IsWild() const
       
   574 /**
       
   575 Tests whether the filename or the extension in the fully parsed specification 
       
   576 contains one or more wildcard characters.
       
   577 
       
   578 @return True if wildcards are present, false if not.
       
   579 */
       
   580 	{
       
   581 
       
   582 	return(iWild&EWildEither);	
       
   583 	}
       
   584 
       
   585 
       
   586 
       
   587 
       
   588 EXPORT_C TBool TParseBase::IsKMatchOne() const
       
   589 /**
       
   590 Tests whether the name or the extension contains a question mark wildcard.
       
   591 
       
   592 @return True if either the name or extension has a ? wild card,
       
   593         false otherwise.
       
   594 */
       
   595 	{
       
   596 
       
   597 	return(iWild&EWildIsKMatchOne);	
       
   598 	}
       
   599 
       
   600 
       
   601 
       
   602 
       
   603 EXPORT_C TBool TParseBase::IsKMatchAny() const
       
   604 /**
       
   605 Tests whether the name or the extension contains asterisk wildcards.
       
   606 
       
   607 @return True if either the name or extension has a * wild card,
       
   608         false otherwise.
       
   609 */
       
   610 	{
       
   611 
       
   612 	return(iWild&EWildIsKMatchAny);	
       
   613 	}
       
   614 
       
   615 
       
   616 
       
   617 
       
   618 EXPORT_C TBool TParseBase::IsNameWild() const
       
   619 /**
       
   620 Tests whether the filename in the fully parsed specification contains one or 
       
   621 more wildcard characters.
       
   622 
       
   623 @return True if the filename contains wildcard characters, false if not.
       
   624 */
       
   625 	{
       
   626 
       
   627 	return(iWild&EWildName);
       
   628 	}
       
   629 
       
   630 
       
   631 
       
   632 
       
   633 EXPORT_C TBool TParseBase::IsExtWild() const
       
   634 /**
       
   635 Tests whether the extension in the fully parsed specification contains one 
       
   636 or more wildcard characters.
       
   637 
       
   638 @return True if the extension contains wildcard characters, false if not.
       
   639 */
       
   640 	{
       
   641 
       
   642 	return(iWild&EWildExt);
       
   643 	}
       
   644 
       
   645 
       
   646 
       
   647 
       
   648 EXPORT_C TParse::TParse()
       
   649 /**
       
   650 Default constructor.
       
   651 */
       
   652 	{
       
   653 	iMod=1;
       
   654 	}
       
   655 
       
   656 
       
   657 
       
   658 
       
   659 EXPORT_C TInt TParse::Set(const TDesC& aName,const TDesC* aRelated,const TDesC* aDefault)
       
   660 /**
       
   661 Parses a file specification, allowing wildcards in the filename and extension.
       
   662 
       
   663 This function sets up the TParse object so that it can be used to provide 
       
   664 useful information.
       
   665 
       
   666 @param aName    The file specification to be parsed.
       
   667 @param aRelated The related file specification. This is optional,
       
   668                 set to NULL to  omit.
       
   669 @param aDefault The default file specification. This is optional,
       
   670                 set to NULL to omit.
       
   671                 
       
   672 @return KErrNone, if successful, otherwise one of the other system-wide error
       
   673         codes.
       
   674 */
       
   675 	{
       
   676 
       
   677 	return(TParseBase::Set(&aName,aRelated,aDefault,ETrue));
       
   678 	}
       
   679 
       
   680 
       
   681 
       
   682 
       
   683 EXPORT_C TInt TParse::SetNoWild(const TDesC& aName,const TDesC* aRelated,const TDesC* aDefault)
       
   684 /**
       
   685 Parses a file specification; disallows wildcards in any part of the file name 
       
   686 or extension.
       
   687 
       
   688 If you need to specify wildcards use Set(). Otherwise, this 
       
   689 function behaves in the same way as Set().
       
   690 
       
   691 @param aName    The file specification to be parsed.
       
   692 @param aRelated The related file specification. This is optional,
       
   693                 set to NULL to omit.
       
   694 @param aDefault The default file specification. This is optional,
       
   695                 set to NULL to omit.
       
   696                 
       
   697 @return KErrNone, if successful, otherwise one of the other system-wide error 
       
   698         codes.
       
   699 
       
   700 @see TParse::Set
       
   701 */
       
   702 	{
       
   703 
       
   704 	return(TParseBase::Set(&aName,aRelated,aDefault,EFalse));
       
   705 	}
       
   706 
       
   707 
       
   708 
       
   709 
       
   710 EXPORT_C TDes& TParse::NameBuf()
       
   711 /**
       
   712 Gets a reference to the descriptor containing the file specification passed to
       
   713 the constructor of this object. 
       
   714 
       
   715 @return A reference to the descriptor containing the filename.
       
   716 */
       
   717 	{
       
   718 
       
   719 	return(iNameBuf);
       
   720 	}
       
   721 
       
   722 
       
   723 
       
   724 
       
   725 EXPORT_C const TDesC& TParse::NameBufC() const
       
   726 /**
       
   727 Gets a const reference to the descriptor containing the file specification
       
   728 passed to the constructor of this object. 
       
   729 
       
   730 @return A const reference to the descriptor containing the file specification.
       
   731 */
       
   732 	{
       
   733 
       
   734 	return(iNameBuf);
       
   735 	}
       
   736 
       
   737 
       
   738 
       
   739 
       
   740 EXPORT_C TParsePtr::TParsePtr(TDes& aName)
       
   741 	: iNameBuf((TText*)aName.Ptr(),aName.Length(),aName.MaxLength())
       
   742 /**
       
   743 Constructor taking a reference to a filename.
       
   744 
       
   745 The specified filename is parsed and if this fails, a panic is raised.
       
   746 
       
   747 @param aName Reference to the filename to be parsed. On return contains
       
   748              the fully parsed path specification. If a filename and extension
       
   749              are specified, they may both contain wildcards.
       
   750              The maximum length is KMaxFileName characters.
       
   751              
       
   752 @panic FSCLIENT 24 if the the specified name fails to parse.
       
   753              
       
   754 @see KMaxFileName
       
   755 */
       
   756 	{
       
   757 	iMod=1;
       
   758 	TInt r=TParseBase::Set(&aName,NULL,NULL,ETrue);
       
   759 	__ASSERT_ALWAYS(r==KErrNone,Panic(EParsePtrBadDescriptor0));
       
   760 	}
       
   761 
       
   762 
       
   763 
       
   764 
       
   765 EXPORT_C TDes& TParsePtr::NameBuf()
       
   766 /**
       
   767 Gets a reference to the descriptor containing the filename passed to
       
   768 the constructor of this object. 
       
   769 
       
   770 @return A reference to the descriptor containing the filename.
       
   771 */
       
   772 	{
       
   773 
       
   774 	return(iNameBuf);
       
   775 	}
       
   776 
       
   777 
       
   778 
       
   779 
       
   780 EXPORT_C const TDesC& TParsePtr::NameBufC() const
       
   781 /**
       
   782 Gets a const reference to the descriptor containing the filename passed to
       
   783 the constructor of this object. 
       
   784 
       
   785 @return A const reference to the descriptor containing the filename.
       
   786 */
       
   787 	{
       
   788 
       
   789 	return(iNameBuf);
       
   790 	}
       
   791 
       
   792 
       
   793 
       
   794 
       
   795 EXPORT_C TParsePtrC::TParsePtrC(const TDesC& aName)
       
   796 /**
       
   797 Constructor taking a constant reference to a filename.
       
   798 
       
   799 The filename is parsed and if this fails, a panic is raised.
       
   800 Note that the filename cannot be modified using this class.
       
   801 
       
   802 @param aName Constant reference to the filename to be parsed.
       
   803              On return contains the fully parsed filename.
       
   804              If a file and extension are specified, they may both
       
   805              contain wildcards.
       
   806              The maximum length is KMaxFileName characters.
       
   807              
       
   808 @panic FSCLIENT 24 if the the specified name fails to parse.
       
   809 
       
   810 @see KMaxFileName
       
   811 */
       
   812 	{
       
   813 	iMod=0;
       
   814 	iNameBuf.Set(aName);
       
   815 	TInt r = TParseBase::Set(&aName,NULL,NULL,ETrue);
       
   816 	__ASSERT_ALWAYS(r==KErrNone,Panic(EParsePtrBadDescriptor0));
       
   817 	}
       
   818 
       
   819 
       
   820 
       
   821 
       
   822 EXPORT_C TDes& TParsePtrC::NameBuf()
       
   823 /**
       
   824 Gets a reference to the descriptor containing the filename passed to
       
   825 the constructor of this object. 
       
   826 
       
   827 @return A reference to the descriptor containing the filename.
       
   828 */
       
   829 	{
       
   830 
       
   831 	Panic(EParsePtrCAccessError);
       
   832 	return(*(TDes*)&iNameBuf);
       
   833 	}
       
   834 
       
   835 
       
   836 
       
   837 
       
   838 EXPORT_C const TDesC& TParsePtrC::NameBufC() const
       
   839 /**
       
   840 Gets a const reference to the descriptor containing the filename passed to
       
   841 the constructor of this object. 
       
   842 
       
   843 @return A const reference to the descriptor containing the filename.
       
   844 */
       
   845 	{
       
   846 
       
   847 	return(iNameBuf);
       
   848 	}
       
   849