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


C++ TBuf8::LocateReverse方法代码示例

本文整理汇总了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());
//.........这里部分代码省略.........
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:101,代码来源:upnptmserverdevicexmlparser.cpp


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