当前位置: 首页>>代码示例>>C++>>正文


C++ TParse::AddDir方法代码示例

本文整理汇总了C++中TParse::AddDir方法的典型用法代码示例。如果您正苦于以下问题:C++ TParse::AddDir方法的具体用法?C++ TParse::AddDir怎么用?C++ TParse::AddDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TParse的用法示例。


在下文中一共展示了TParse::AddDir方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: InitializeQualityProfileInfoL

void CQualityProfileApi_ProfileReadStep::InitializeQualityProfileInfoL()
	{
	RFs fs;
	User::LeaveIfError(fs.Connect());
	CleanupClosePushL(fs);

	TBuf<32> privatePath;
	User::LeaveIfError(fs.PrivatePath(privatePath));

	TParse parse;
	parse.Set(privatePath, NULL, NULL);
	parse.AddDir(KLbsDir);
	
	RArray<TQualityProfile> qualityArray;
	CleanupClosePushL(qualityArray);
	
	qualityArray.Reserve(5);

	// Only want to use the first file that is found.
	// The way TFindFile::FindByDir works, it will search
	// C: and D: before Z:, which is what we want.
	TFindFile findFile(fs);
	TInt err = findFile.FindByDir(KQualityProfileIniName, parse.Path());
	if (err == KErrNone)
		{
		GetQualityProfileInfoL(fs, qualityArray, findFile.File());
		}
	
	// Publish the quality profile info
	LbsQualityProfile::InitializeL(qualityArray);
	
	CleanupStack::PopAndDestroy(&qualityArray);
	CleanupStack::PopAndDestroy(&fs);
	}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:34,代码来源:QualityProfileApi_ProfileReadStep.cpp

示例2: AddRelativePath

GLDEF_C TInt AddRelativePath(TParse& dirParse,const TDesC& aRelativePath)
//
// Add a relative path of the form "AAA\\BBB\\CCC\\" to dirParse
//
	{

	TPtrC path=aRelativePath;
	TInt r=KErrNone;
	while (path.Length())
		{
		TInt bsPos=path.Locate(KPathDelimiter);
		__ASSERT_DEBUG(bsPos!=0 && bsPos!=KErrNotFound,Panic(EShellBadRelativePath));
		r=dirParse.AddDir(path.Mid(0,bsPos));
		if (r!=KErrNone)
			break;
		path.Set(path.Right(path.Length()-bsPos-1));
		}
	return r;
	}			
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:19,代码来源:ts_utl.cpp

示例3: GetFullPath

GLDEF_C TInt GetFullPath(TParse& aParse, const TText16* upath, RFs& aSession, TDes* aFileName)
//
// Parse a path of the form "[C:][\]AAA\..\.\BBB\xxx" where:
// .  indicates the current directory
// .. indicates move to the parent directory
// An optional "\" at the start of the path indicates the path is not relative to the current path,
// and is implied if the drive specifier is present
// If aFileName is non-NULL then the final component is a filename and should be copied into 
// the aFileName descriptor.
//
	{

	TInt r;
	TBuf<3> drive;
	TFileName nextBit;
	TText16 c=*upath;

	if (c && upath[1]==KDriveDelimiter) 
		{
		// drive name specified
		if (c==L'?')
			drive.Zero();			// use "?:" to mean scan across drives
		else
			{
			drive.Copy(TPtrC16(upath, 2));
			drive.UpperCase();
			}
		upath+=2;
		drive.Append(TChar(KPathDelimiter));	// enforce absoluteness
		}
	else
		{
		// no leading drive specifier
		drive.Zero();
		if (c==KPathDelimiter||c==L'/')
			{
			upath+=1;
			drive.Append(TChar(KPathDelimiter));
			}
		}
	r = aSession.Parse(drive, aParse);

	// upath now looks like a relative pathname, to be added onto
	// aParse a directory at a time. Note that '/' is not allowed in
	// EPOC32 file or directory names, so treat it as an alternative separator

	c=*upath;
	while (c && (r==KErrNone))
		{
		const TText16* ustart=upath;
		do 
			c=*upath++;
		while (c && c!=KPathDelimiter && c!=L'/');

		TInt len=(upath-ustart)-1;		// excludes delimiter
		if (len==0)
			continue;
		if (ustart[0]==L'.')
			{
			if (len==1)
				continue;	// directory . ignored
			if (len==2 && ustart[1]==L'.')
				{
				// directory ..
				(void) aParse.PopDir();	// just stick at root dir, no errors
				continue;
				}
			}
		if (len>=KMaxFileName)
			return ENAMETOOLONG;
		if (c==L'\0' && aFileName!=NULL)
			{
			// it's the trailing filename
			aFileName->Copy(TPtrC16(ustart, len));
			break;
			}
		else	
			{
			// it's a component of the accumulating path
			nextBit.Copy(TPtrC16(ustart, len));
			r = aParse.AddDir(nextBit);
			}
		}
	return(r);
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:85,代码来源:POSIX.CPP


注:本文中的TParse::AddDir方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。