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


C++ TDesC::Left方法代码示例

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


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

示例1: id

TBool
LaunchWapBrowserUtil::LaunchWapBrowser(const TDesC& aUrl)
{
#if defined NAV2_CLIENT_SERIES60_V2 || defined NAV2_CLIENT_SERIES60_V3
   TInt urlLen = aUrl.Length();
   HBufC* fixedUrl;

   if (KFourHttpString().Compare(aUrl.Left(KFourHttpString().Length()))) {
      /* Not 4 http:// at the beginning. */

      if (KHttpString().Compare(aUrl.Left(KHttpString().Length()))) {
         /* Not http:// at the beginning. */
         urlLen += KFourHttpString().Length() + 1;
         fixedUrl = HBufC::NewLC(urlLen);
         fixedUrl->Des().Copy(KFourHttpString);
      } else {
         urlLen += KFourString().Length() + 1;
         fixedUrl = HBufC::NewLC(urlLen);
         fixedUrl->Des().Copy(KFourString);
      }
      fixedUrl->Des().Append(aUrl);
   } else {
      fixedUrl = aUrl.AllocLC();
   }

   RApaLsSession aApaLsSession;

   TUid id( KPhoneUidWmlBrowser );
   TApaTaskList taskList( CEikonEnv::Static()->WsSession() );
   TApaTask task = taskList.FindApp( id );

   if ( task.Exists() ) {
      HBufC8* param8 = HBufC8::NewLC( fixedUrl->Length() );
      param8->Des().Append( *fixedUrl );
      task.SendMessage( TUid::Uid( 0 ), *param8 ); // UID is not used
      CleanupStack::PopAndDestroy( param8 );
   } else {
      if ( !aApaLsSession.Handle() )
      {
         User::LeaveIfError( aApaLsSession.Connect() );
      }
      TThreadId thread;
      User::LeaveIfError( aApaLsSession.StartDocument( *fixedUrl,
               KPhoneUidWmlBrowser, thread ) );
   }
   CleanupStack::PopAndDestroy(fixedUrl);

   aApaLsSession.Close();

#elif defined NAV2_CLIENT_SERIES60_V1
   return EFalse;
#else
# error This code not implemented!
#endif
   return ETrue;
}
开发者ID:VLjs,项目名称:Wayfinder-S60-Navigator,代码行数:56,代码来源:LaunchWapBrowserUtil.cpp

示例2: GetTBoolL

void CParsedFieldCollection::GetTBoolL(const TDesC& aDes, TBool& aBool) const
	{
	__ASSERT_DEBUG(aDes.Length() > 0 ,User::Panic(KIACP,EIacpEmptyBuffer));

 	if ((aDes.Left(1).CompareF(KIacpLowerT)==0) || (aDes.Left(1).CompareF(KIacpLowerY)==0))
		aBool= ETrue;
	else if ((aDes.Left(1).CompareF(KIacpLowerF)==0) || (aDes.Left(1).CompareF(KIacpLowerN)==0))
		aBool= EFalse;
	else
		User::Leave(KIacpErrRightToken);
	}
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:11,代码来源:IACP.CPP

示例3: SetDriveL

/** Set the drive on which to store the attachment
*/
EXPORT_C void CAgnAttachmentFile::SetDriveL(const TDesC& aDrive)
	{
	if ( ! iFileName || iFileName->Length() <= KMaxDriveName)
		{
		SetFileNameL(aDrive.Left(KMaxDriveName));
		}
	else
		{
		if (iFileName->Left(1) != aDrive.Left(1))
			{
			TPtr ptr(iFileName->Des());
			ptr.Replace(0, aDrive.Length(), aDrive);
			}
		}
	}
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:17,代码来源:agmattachment.cpp

示例4: GetPhysicalPathL

/**
Utility method used to construct physical path for a given file name

@param aPhysicalFileName in/out paramter; file name to which physical path will be append
@param aSecuredFileName secured file name
*/
void CPplContactsFile::GetPhysicalPathL(TDes& aPhysicalFileName, const TDesC& aSecuredFileName)
	{
	const TUint16 KDriveDelimiter = ':';

	// Check for the drive delimiter.
	__ASSERT_ALWAYS(aSecuredFileName.Length() > 2 &&
		aSecuredFileName[1] == KDriveDelimiter, User::Leave(KErrBadName)); 

	// Check for malformed file name (path included explicitly).
	__ASSERT_ALWAYS(aSecuredFileName.Locate('\\') == KErrNotFound, User::Leave(KErrBadName)); 

	// Get the private path from the file session.
	const TInt KMaxPrivatePathLength = 32;
	TBuf<KMaxPrivatePathLength> privatePath;
	
  	LocalFsL();
  	iLocalFs.PrivatePath(privatePath);
	
	aPhysicalFileName = aSecuredFileName.Left(KDriveNameWidth);
		
	// Set current drive.
	iDatabaseDrive = aPhysicalFileName;

	aPhysicalFileName.Append(privatePath);

  	// Make sure private path exists.
  	TInt err = iLocalFs.MkDirAll(aPhysicalFileName);
	if (err != KErrNone && err != KErrAlreadyExists)
		{
		User::Leave(err);
		}
	}
开发者ID:bavanisp,项目名称:qtmobility-1.1.0,代码行数:38,代码来源:cplcontactsfile.cpp

示例5: DoConnect

TInt RConsoleProxy::DoConnect(TServerParams* aParams, const TDesC& aThreadNameBase, TInt aStackSize, TInt aHeapMinSize, TInt aHeapMaxSize, RServer2& aServer, RThread& aServerThread)
	{
	TName threadName;
	RThread server;
	TInt threadId = 0;
	_LIT(KThreadIdFmt, "%08x");
	TInt err;
	do
		{
		threadName = aThreadNameBase.Left(threadName.MaxLength()-8);
		threadName.AppendFormat(KThreadIdFmt, threadId);
		err = server.Create(threadName, &ServerThreadFunction, aStackSize, aHeapMinSize, aHeapMaxSize, aParams);
		++threadId;
		} while (err==KErrAlreadyExists);
	if (err!=KErrNone) return err;
	
	TRequestStatus rendezvous;
	server.Rendezvous(rendezvous);
	if (rendezvous == KRequestPending)
		{
		server.Resume();
		}
	User::WaitForRequest(rendezvous);
	err = rendezvous.Int();
	if (server.ExitType() != EExitPending && err >= 0) err = KErrDied;
	if (err==KErrNone)
		{
		err = Connect(aParams->iServer);
		}
	aServer = aParams->iServer;
	aServerThread = server;
	return err;
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:33,代码来源:client.cpp

示例6: SetClockAlarmToneL

// -----------------------------------------------------------------------------
// CProfileExtraTonesImpl::SetClockAlarmToneL
//
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
void CProfileExtraTonesImpl::SetClockAlarmToneL(
    const TDesC& aClockAlarmTone )
{
    HBufC* tmp = aClockAlarmTone.Left( KMaxFileName ).AllocL();
    delete iClockAlarmTone;
    iClockAlarmTone = tmp;
}
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:13,代码来源:CProfileExtraTonesImpl.cpp

示例7: IsMimeTypeSupportedL

// -----------------------------------------------------------------------------
// Implements checking if a given MIME type is supported or not
// -----------------------------------------------------------------------------
//
TBool CAknsWallpaperPlugin::IsMimeTypeSupportedL(const TDesC& aMimeTypeString)
    {
    // Check for a type separator in the string
    TInt pos = aMimeTypeString.Find(KAknsWallpaperPluginSeparator);

    // Leave if no separator was found.. the MIME
    // standard requires it
    if (pos == KErrNotFound)
        {
        User::Leave(KErrArgument);
        }

    // Copy the full Mime type string (needed for uppercase)
    HBufC* fullBuf = aMimeTypeString.AllocLC();
    TPtr fullString = fullBuf->Des();
    fullString.UpperCase();

    // Construct the compare string
    TPtrC compareString(aMimeTypeString.Left(pos));

    // Perform the comparison
    TBool ret = EFalse;

    // Mime type case:  IMAGE/* except IMAGE/X-OTA-BITMAP
    if (compareString.CompareF(KAknsWallpaperPluginMimeTypeImage) == 0 &&
        !(fullString.CompareF(KAknsWallpaperPluginMimeTypeOTABitmap) == 0))
        {
        ret = ETrue;
        }
    CleanupStack::PopAndDestroy(fullBuf);

    return ret;
    }
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:37,代码来源:aknswallpaperplugin.cpp

示例8: Replace

EXPORT_C void TConsoleLine::Replace(TInt aFrom, const TDesC& aDes)
	{
	// a) Hide the cursor.
	// b) Move the cursor to aFrom.
	// c) Overwrite chars up to iBufPos.
	// d) Insert remaining chars (if any).
	// e) Make the cursor visible again.
	aFrom += iPromptLength;
	ASSERT(iBufPos >= aFrom);
	iConsole.SetCursorVisible(EFalse);
	iConsole.SetCursorPosAbs(iConsole.PosFrom(iStartPos, aFrom));
	const TInt desLength = aDes.Length();
	const TInt numOverwriteChars = iBufPos - aFrom;
	TInt lengthAdjust = 0;
	if (numOverwriteChars > 0)
		{
		iBuf.Replace(aFrom, numOverwriteChars, aDes.Left(numOverwriteChars));
		if (desLength < numOverwriteChars)
			{
			lengthAdjust = numOverwriteChars - desLength;
			iBuf.AppendFill(' ', lengthAdjust);
			iBufPos -= lengthAdjust;
			}
		}
	const TInt numInsertChars = desLength - numOverwriteChars;
	if (numInsertChars > 0)
		{
		iBuf.Insert(iBufPos, aDes.Mid(numOverwriteChars));
		iBufPos += numInsertChars;
		}
	iConsole.Write(iBuf.Mid(aFrom));
	iBuf.SetLength(iBuf.Length() - lengthAdjust);
	iConsole.SetCursorPosAbs(iConsole.PosFrom(iStartPos, aFrom + aDes.Length()));
	iConsole.SetCursorVisible(ETrue);
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:35,代码来源:line_editor.cpp

示例9: ConvertSEIDs

TBool CT_DataRGavdp::ConvertSEIDs(TDesC &aSEIDsStr, RArray<TUint>& aSEIDs)
{

    TBool ret = ETrue;

    TLex lex(aSEIDsStr);
    TInt tempSEID;
    if (lex.Val(tempSEID) == KErrNone)
    {
        aSEIDs.Append(tempSEID);
    }
    else
    {
        TInt location = aSEIDsStr.Match(_L("*,*"));
        if( location != KErrNotFound )
        {
            //Converting Left part of the data
            TPtrC	tempStr = aSEIDsStr.Left(location);
            ret = ConvertSEIDs(tempStr, aSEIDs);
            if(ret)
            {
                //Converting right data can be with another ","
                tempStr.Set(aSEIDsStr.Mid(location + 1));
                ret = ConvertSEIDs(tempStr, aSEIDs);
            }
        }
        else
        {
            ret = EFalse;
        }
    }

    return ret;
}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:34,代码来源:t_data_rgavdp.cpp

示例10: DatabaseDrive

// ---------------------------------------------------------
// CPosLmLocalDatabaseManager::DatabaseDrive
//
// (other items were commented in a header).
// ---------------------------------------------------------
//
TChar CPosLmLocalDatabaseManager::DatabaseDrive(
    const TDesC&  aDatabaseUri)
    {
    TChar sysDriveChar = RFs::GetSystemDriveChar();
    
    // if protocol delimiter present,
    // verify that URI starts with "file://"
    TInt offset = aDatabaseUri.Find(KProtocolDelimiter);
    if (offset != KErrNotFound && aDatabaseUri.Left(offset) != KFileProtocol)
        {
        // wrong protocol
        return 0;
        }

    // adjust offset depending on whether or not protocol is present
    offset = offset == KErrNotFound ?
             0 :
             KFileProtocol().Length() + KProtocolDelimiter().Length();

    if (aDatabaseUri.Length() < offset + KDriveAndDelimiterLength)
        {
        return 0;
        }

    // if second character is ":", return first character
    // otherwise return default drive
    if (aDatabaseUri[offset + 1] == KDriveDelimiter)
        {
        return TChar(aDatabaseUri[offset]).GetUpperCase();
        }
    return sysDriveChar;
    }
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:38,代码来源:EPos_CPosLmLocalDatabaseManager.cpp

示例11: SetIMMessageAlertToneL

// -----------------------------------------------------------------------------
// CProfileExtraTonesImpl::SetIMMessageAlertToneL
//
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
void CProfileExtraTonesImpl::SetIMMessageAlertToneL(
    const TDesC& aIMMessageAlertTone )
{
    HBufC* tmp = aIMMessageAlertTone.Left( KMaxFileName ).AllocL();
    delete iIMMessageAlertTone;
    iIMMessageAlertTone = tmp;
}
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:13,代码来源:CProfileExtraTonesImpl.cpp

示例12: Print

//----------------------------------------------------------------------------
// PhSrvDebugInfo::Print
//----------------------------------------------------------------------------
//
void PhSrvDebugInfo::Print(TInt/* aArea*/,const TDesC& aText )
{
    


            // LOG TO FILE
#ifdef __PHSRV_DEBUG_WRITE_LOG__

            TBuf8<128> toFile;
            CnvUtfConverter::ConvertFromUnicodeToUtf8( toFile, aText.Left(126) );
            toFile.Append( KPhSrvDebugEOF );
            
            PhSrvDebugInfo::CPhSrvDebugData* data = NULL;
    if( !data )
        {
        data = CreateData();
        }
    if( data )
        {
        data->CreateFile();           
        data->WriteFile( toFile );
        }
#endif  // __PHSRV_DEBUG_WRITE_LOG__
#ifdef __PHSRV_PRINT_DEBUG_INFO__
            RDebug::Print( aText );
#endif // __PHSRV_PRINT_DEBUG_INFO__
          //  }   
      //  }
    }
开发者ID:kuailexs,项目名称:symbiandump-mw2,代码行数:33,代码来源:phsrvdebuginfo.cpp

示例13: parser

int
TcpipComm::Open(CConsoleBase *cons, TDes &name, TDesC &destination,
			TRequestStatus &st)
{
  int r;
  TInetAddr addr;
  TPtrC servername;
  int port = 0;

  if((r = iServ.Connect()) != KErrNone)
    return r;
  if((r = iSock.Open(iServ,KAfInet,KSockStream,KProtocolInetTcp)) != KErrNone)
    return r;


  //////////////
  // Parse the destination, which is of the form ip.adress:port
  for(r = 0; r < destination.Length(); r++)
    if(destination[r] == ':')
      break;
  servername.Set(destination.Left(r)); // Wont include ':'
  TLex parser(destination.Mid(r+1));
  parser.Val(port);

  addr.SetPort(port);
  if(addr.Input(servername) != KErrNone) // Its a real hostname, wont resolv
    return 1;

  iSock.Connect(addr, st);

  TPckgBuf<int> one(1);
  iSock.SetOpt(KSoTcpNoDelay, KSolInetTcp, one);

  return 0;
}
开发者ID:BackupTheBerlios,项目名称:p3nfs-svn,代码行数:35,代码来源:tcpip.cpp

示例14: WriteFileL

TInt CFileOperate::WriteFileL(const TDesC& aFileName)
	{
	int pos = aFileName.LocateReverse( '\\');
	if (pos!=KErrNotFound)
		{
		TPtrC dirName = aFileName.Left(pos+1);
		CCoeEnv::Static()->FsSession().MkDirAll(dirName);
		}

	RFile file;

	TInt err = file.Replace(CCoeEnv::Static()->FsSession(), aFileName, EFileWrite);
	CleanupClosePushL(file);
	if (KErrNone != err)
		{
		CleanupStack::PopAndDestroy(1); // file
		return err;
		}

	RFileWriteStream outputFileStream(file);
	CleanupClosePushL(outputFileStream);

	iNotifier->FileWriteData(outputFileStream);

	CleanupStack::PopAndDestroy(2); // outputFileStream, file
	return KErrNone;
	}
开发者ID:flaithbheartaigh,项目名称:lemonplayer,代码行数:27,代码来源:FileOperate.cpp

示例15: FirstL

TBool CTupleStoreImpl::FirstL(TTupleType aTupleType, const TTupleName& aTupleName, const TDesC& aSubName, 
		TBool aExact)
{
	CALLSTACKITEM_N(_CL("CTupleStoreImpl"), _CL("FirstL"));

	iCurrentSearchMode=ETuple;
	iCurrentSearchType=aTupleType;
	iCurrentSearchTuple=aTupleName;
	iCurrentSearchSubName=aSubName;
	TDbSeekMultiKey<4> rk;
	rk.Add(aTupleType);
	if (aTupleName.iModule!=KBBAnyUid) {
		rk.Add((TInt)aTupleName.iModule.iUid);
		if (aTupleName.iId != KBBAnyId) {
			rk.Add(aTupleName.iId);
			if (aSubName.Length()>0 || aExact) {
				rk.Add(aSubName.Left(iSubNameIndexLength));
			}
		}
	}
	SwitchIndexL(EIndexTuple);
	TBool ret=EFalse;
	ret=iTable.SeekL(rk);
	if (!ret) return EFalse;
	TPartialMatch m=MatchesL(aTupleType, aTupleName, aSubName);
	while (m==EMatchPartial) {
		if (!iTable.NextL()) return EFalse;
		m=MatchesL(aTupleType, aTupleName, aSubName);
	}
	if (m>EMatchPartial) return ETrue;
	return EFalse;
}
开发者ID:flaithbheartaigh,项目名称:jaikuengine-mobile-client,代码行数:32,代码来源:tuplestore.cpp


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