本文整理汇总了C++中TBuf8::LocateReverse方法的典型用法代码示例。如果您正苦于以下问题:C++ TBuf8::LocateReverse方法的具体用法?C++ TBuf8::LocateReverse怎么用?C++ TBuf8::LocateReverse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TBuf8
的用法示例。
在下文中一共展示了TBuf8::LocateReverse方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: StartL
// ---------------------------------------------------------------------------------
// CUpnpTmServerDeviceXmlParser::StartL
// Method which inputs xml formatted buffer content to the XML Parser
// and invokes parsing
// ---------------------------------------------------------------------------------
//
void CUpnpTmServerDeviceXmlParser::StartL()
{
OstTraceFunctionEntry0( CUPNPTMSERVERDEVICEXMLPARSER_STARTL_ENTRY );
TDriveNumber drive = RFs::GetSystemDrive(); //Find system's drive
TBuf<UpnpString::KMaxFilenameLength> privatePath;
TInt err = iFs.PrivatePath(privatePath); //Find the application's private path
// a) If the Private Path is not found (for whatever reasons),
// Create a private path in the System Drive
if( err == KErrNotFound )
{
User::LeaveIfError( iFs.CreatePrivatePath(drive) );
}
// b) If Private Path is found but is a read-only or non-persistent drive
// Create a private path in the system drive else use it
else if( err == KErrNone )
{
TDriveInfo driveInfo;
User::LeaveIfError( iFs.Drive(driveInfo));
TUint driveAttr = driveInfo.iDriveAtt;
if ( driveAttr == KDriveAttRom )
{
User::LeaveIfError( iFs.CreatePrivatePath(drive) );
}
}
else
{
OstTrace1( TRACE_ERROR, CUPNPTMSERVERDEVICEXMLPARSER_STARTL, "CUpnpTmServerDeviceXmlParser::StartL;err=%d", err );
User::Leave(err);
}
privatePath.Append(KPublicDevicePath());
err = iFs.MkDirAll(privatePath);
if( err && err != KErrAlreadyExists )
{
OstTrace1( TRACE_ERROR, DUP1_CUPNPTMSERVERDEVICEXMLPARSER_STARTL, "CUpnpTmServerDeviceXmlParser::StartL;err=%d", err );
User::LeaveIfError(err);
}
iDeviceDir.CreateL(privatePath);
RBuf8 rootDeviceBuf;
CleanupClosePushL(rootDeviceBuf);
rootDeviceBuf.CreateL(KBufSize);
rootDeviceBuf.Append(KRootDeviceXmlLead());
// Appends the device icon list to the device xml buffer
const RPointerArray<CUpnpTerminalModeIcon>& deviceList = iDeviceInfo.DeviceIconList();
TInt iconCount = deviceList.Count();
if ( iconCount > KErrNone )
{
privatePath.Append(KIconDirectory());
err = iFs.MkDir(privatePath); // Creates icon directory
if( err && err != KErrAlreadyExists )
{
OstTrace1( TRACE_ERROR, DUP2_CUPNPTMSERVERDEVICEXMLPARSER_STARTL, "CUpnpTmServerDeviceXmlParser::StartL;err=%d", err );
User::LeaveIfError(err);
}
iIconDirectory.CreateL(privatePath);
OstTrace1( TRACE_ERROR, DUP3_CUPNPTMSERVERDEVICEXMLPARSER_STARTL, "CUpnpTmServerDeviceXmlParser::StartL;iconCount=%d", iconCount );
rootDeviceBuf.Append(KStartIconList);
for ( TInt i(0); i < iconCount; i++ )
{
rootDeviceBuf.Append(KStartIcon);
rootDeviceBuf.Append(KStartMimeType);
rootDeviceBuf.Append(deviceList[i]->MimeType());
rootDeviceBuf.Append(KEndMimeType);
rootDeviceBuf.Append(KStartWidth);
rootDeviceBuf.AppendNum(deviceList[i]->Width());
rootDeviceBuf.Append(KEndWidth);
rootDeviceBuf.Append(KStartHeight);
rootDeviceBuf.AppendNum(deviceList[i]->Height());
rootDeviceBuf.Append(KEndHeight);
rootDeviceBuf.Append(KStartDepth);
rootDeviceBuf.AppendNum(deviceList[i]->Depth());
rootDeviceBuf.Append(KEndDepth);
rootDeviceBuf.Append(KStartUrl);
TBuf8<KMaxPath> iconBuf;
const TDesC& fileName = deviceList[i]->IconFilename();
iconBuf.Copy(fileName);
TBuf8<UpnpString::KDefaultStringLength> iconRelativeUrl(KScpdUrl());
// Extracts the actual input filepath and creates the relative url for the icon
// to be provided in the device xml file
iconRelativeUrl.Append(KIconPath());
// Extracts only filename and appends the same to url
iconRelativeUrl.Append(iconBuf.Mid((iconBuf.LocateReverse(KDirectorySeparator))+1));
rootDeviceBuf.Append(iconRelativeUrl);
delete iFileMan;
iFileMan = NULL;
iFileMan = CFileMan::NewL(iFs) ;
// copies icon files to the private device directory
User::LeaveIfError(iFileMan->Copy(fileName,iIconDirectory));
rootDeviceBuf.Append(KEndUrl);
rootDeviceBuf.Append(KEndIcon);
}
rootDeviceBuf.Append(KEndIconList);
}
rootDeviceBuf.Append( iDeviceInfo.DeviceInfo());
//.........这里部分代码省略.........