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


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

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


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

示例1: RecognizeFileL

TBool CRefTestAgentManager::RecognizeFileL(const TDesC& aFileName, const TDesC8& aBuffer, TDes8& aFileMimeType, TDes8& aContentMimeType) const
	{
	TBool result = EFalse;
	
	// Check filename extension
	TPtrC extension(aFileName.Right(KRtaExtensionContent().Length()));
	if(extension.CompareF(KRtaExtensionContent) == 0)
		{
		// It's a content file ready for applications to read
		aFileMimeType.Copy(KRtaMimeContent());
		CRefTestAgentArchive::GetDefaultMimeTypeFromHeaderL(aBuffer, aContentMimeType);
		result = ETrue;	
		}
	else
		{
		extension.Set(aFileName.Right(KRtaExtensionContentRights().Length()));
		if(extension.CompareF(KRtaExtensionContentRights) == 0)
			{
			// It's a content and rights file ready for the supplier API
			aFileMimeType.Copy(KRtaMimeContentRights());
			result = ETrue;
			}
		else
			{
			extension.Set(aFileName.Right(KRtaExtensionRights().Length()));
			if(extension.CompareF(KRtaExtensionRights) == 0)
				{
				// It's a content and rights file ready for the supplier API
				aFileMimeType.Copy(KXmlRORights());
				result = ETrue;
				}
			}
		}
	return result;
	}
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:35,代码来源:Reftestagentmanager.cpp

示例2: DoRecognizeL

void CApaDRMRecognizer::DoRecognizeL( const TDesC& aName, const TDesC8& aBuffer )
{
    if ( aBuffer.Size() < 3)
        {
        return;
        }

#ifdef RECOGNIZE_KEY_CHAIN
    // Recognize device key chain
    if ( aName.Length() > 3 && aName.Right(4).CompareF(_L(".dkc")) == 0)
        {
        iConfidence = ECertain;
        iDataType = TDataType( _L8("application/x-device-key-chain") );
        return;
        }
#endif

#ifdef DRM_OMA2_ENABLED
    // Recognize ROAP Trigger
    if ( RecognizeRoapTrigger( aBuffer ) )
        {
        return;
        }

    // Recognize DCFv2
    if ( RecognizeODF( aBuffer ) )
        {
        return;
        }
#endif
    // Recognize DCFv1
    TUint8 version = aBuffer[0];
    TUint8 contentTypeLen = aBuffer[1];
    TUint8 contentURILen = aBuffer[2];

    if ( contentTypeLen < KMinContentTypeLen || contentURILen == 0 )
    {
        return;
    }
    if ( version != KDCFVersionSupported )
    {
        return;
    }

    // Too little data received
    if ( aBuffer.Size() < ( contentTypeLen + KDCFHeaderLength ) )
    {
        return;
    }

    TPtrC8 mimeType = aBuffer.Mid( KDCFHeaderLength, contentTypeLen );
    if ( mimeType.Locate( '/' ) != KErrNotFound )
    {
        iConfidence = ECertain;
        iDataType=TDataType( mimeType );
    }


    return;
}
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:60,代码来源:RecDRM.cpp

示例3: GetSubStringCount

/**
Counts the number of substrings (separated by KSubStringSeparators) in the text. 
Needed for correct memory allocations.
*/
TInt CResourceLoader::GetSubStringCount(const TDesC& aText)
    {
    TInt subCount = 0;
    TInt i = 0;

    while (i < aText.Length())
        {
        TPtrC remainder = aText.Right(aText.Length() - i);
        TInt nextKey = remainder.Locate(KSubStringSeparator);
        i += nextKey;

        // Always increase subcount, as a string without any separators counts as one substring.
        // However, if string length is zero, then there are no substrings.
        subCount++;

        if (nextKey != KErrNotFound && i < aText.Length() - 1)
            {
            i++; // skip separator
            }
        else
            break;
        }

    return subCount;
    }
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:29,代码来源:basepluginresourceloader.cpp

示例4: CombineURILC

// ------------------------------------------------------------------------------------------------
// CNSmlDsProvisioningAdapter::CombineURILC()
// Combines address and port to URI 
// ------------------------------------------------------------------------------------------------
TInt CNSmlDsProvisioningAdapter::CombineURILC( const TDesC& aAddr, const TDesC& aPort, HBufC*& aRealURI )
	{
	TInt offset = 0;
	TInt i = 0;
	if( aAddr.Find( KNSmlDsProvisioningHTTP ) == 0 )
		{
		offset = KNSmlDsProvisioningHTTP().Length();
		}
	else if( aAddr.Find( KNSmlDsProvisioningHTTPS ) == 0 )
		{
		offset = KNSmlDsProvisioningHTTPS().Length();
		}
		
	// after skipping double slashes seek next single slash
	for( i = offset; i < aAddr.Length(); i++ )
		{
		if( aAddr[i] == KNSmlDMUriSeparator )
			{
			break;
			}
		}
	
	aRealURI = HBufC::NewLC( aAddr.Length() + aPort.Length() + 1 );
	TPtr uriPtr = aRealURI->Des();

	uriPtr.Copy( aAddr.Ptr(), i );
	uriPtr.Append( KNSmlDMColon );
	uriPtr.Append( aPort );
	uriPtr.Append( aAddr.Right( aAddr.Length() - i ) );
		
	return KErrNone;
	}
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:36,代码来源:NSmlDsProvisioningAdapter.cpp

示例5: ParsePackageUid

TInt CSwisExpressionEnvironment::ParsePackageUid(const TDesC& aUidString, TUid& aUid)
	{	
	// Check that the UID string matches the format
	_LIT(KVersionUidFormat,"0x????????");
	if(aUidString.MatchF(KVersionUidFormat) != 0)
		{
		return KErrNotFound;
		}
	 	
	/** 
	 *  Convert the string into a TUint32 representation and check that
	 *  the string is a valid hexadecimal value
	 */
	TLex lexUid(aUidString.Right(8));
	TUint32 uidValue = 0;
	
	if(lexUid.Val(uidValue,EHex) == KErrNone && lexUid.Eos())
		{
		aUid.iUid = uidValue;
		return KErrNone; 
		}
	
	// Return an error if the UID value is not parsed correctly
	return KErrNotFound;
	}
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:25,代码来源:expressionevaluator.cpp

示例6: ExtractInt

static TBuf<20> ExtractInt(const TDesC& aBuf, TInt& aExtractedInt)
	{
	TBuf<20> buf = aBuf.Right(aBuf.Length() - aBuf.Locate(':')-1);
	TBuf<5> handle;
	handle.FillZ();
	handle = buf.Left(buf.Locate(':'));
	aExtractedInt = Str2Int(handle);
	return buf;
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:9,代码来源:tschsvrclient.cpp

示例7: CharsThatFitOnRight

EXPORT_C TInt AknPhoneNumberTextUtils::CharsThatFitOnRight(
    const TDesC& aText, 
    TInt aLineWidth, 
    const CFont& aFont )
    {
    // Current candidate text for fitting text
    TPtrC currentText(aText); 

    // These two variables are converged by this algorithm until they differ by one
    // Set max chars to be total length + 1, for the sake of the algorithm
    TInt minCharsFromRightThatDoNotFit( aText.Length() + 1 );
    TInt maxCharsFromRightThatFit(0); // must start at 0

    // some incidentally used lengths 
    TInt currentLength(0);      // arbitrary init value
    TInt charsThatFitOnLeft(0); // arbitrary init value
    TInt newLength(0);          // arbitrary init value

    while ( (minCharsFromRightThatDoNotFit - maxCharsFromRightThatFit) != 1 )
        {
        // At the top of the loop, all state is held by currentText itself, and the two 
        // maxCharsXXX variables.
        currentLength = currentText.Length();
        charsThatFitOnLeft = aFont.TextCount( currentText, aLineWidth);  

        if ( charsThatFitOnLeft == currentLength ) // Does this text fit ?
            {
            maxCharsFromRightThatFit = Max( maxCharsFromRightThatFit, charsThatFitOnLeft );

            // If this text cannot be made any bigger, and still fit, then bail out
            if ( (maxCharsFromRightThatFit + 1) >= minCharsFromRightThatDoNotFit )
                {
                // We can exit the loop now. Just fall out and the while test will handle it.
                break;
                }
            else // if this string did fit, and it might have been too small, try making it bigger
                {
                // we know this is still be < minCharsFromRightThatDoNotFit
                newLength = maxCharsFromRightThatFit + 1; 
                }
            }
        else // currentText does not fit. Repeat loop 
            {
            // we know that this many characters did not fit on the line
            minCharsFromRightThatDoNotFit = Min( minCharsFromRightThatDoNotFit, currentLength );

            // Try using the number that fit on the left as the number we will fit on the right.
            newLength = charsThatFitOnLeft;
            }

        currentText.Set(aText.Right(newLength)); 
        }

    return maxCharsFromRightThatFit;
    }
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:55,代码来源:AknPhoneNumberTextUtils.cpp

示例8: ThumbnailPath

// ============================= LOCAL FUNCTIONS ===============================
// -----------------------------------------------------------------------------
// ThumbnailPath
// -----------------------------------------------------------------------------
//
static TBool ThumbnailPath( const TDesC& aFullPath )
    {
    FUNC_LOG

    TInt len( KImagesThumbnailPath().Length() );
    if ( aFullPath.Length() >= len &&
        !aFullPath.Right( len ).CompareF( KImagesThumbnailPath ) )
        {
        return ETrue;
        }
    return EFalse;
    }
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:17,代码来源:PathInfo.cpp

示例9: CheckPermittedFileName

TInt CRtaServer::CheckPermittedFileName(const TDesC& aFileName)
	{
	_LIT(KContentExtension,".content");
	TInt err = KErrNone;
	if(aFileName.Length() >= KRightsDatabaseFileName().Length())
		{
		TPtrC rightsDb = aFileName.Right(KRightsDatabaseFileName().Length());
		if(rightsDb.CompareF(KRightsDatabaseFileName()) == 0)
			{
			err = KErrPermissionDenied;	
			}
		}
	if(err == KErrNone && aFileName.Length() >= KContentExtension().Length())
		{
		TPtrC ext = aFileName.Right(KContentExtension().Length());
		if(ext.CompareF(KContentExtension()) != 0)
			{
			err = KErrNotSupported;	
			}
		}	
	return err;
	}
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:22,代码来源:RTAserver.cpp

示例10: DoRecognizeL

// ---------------------------------------------------------
// RecognizerEx::DoRecognizeL()
// Recognizes the file by name and/or head buffer
// ---------------------------------------------------------
//
void CApaRecognizerEx::DoRecognizeL(const TDesC& aName, const TDesC8& /*aBuffer*/)
    {
    // To keep code simple, we only check file name extension
    if (aName.Length()>KRecRtFileExtensionsMightBeValid)
    {
        if (aName.Right(KRecRtFileExtensionsMightBeValid).CompareF(KExtension1)==0)
        {
            iConfidence=ECertain;   // is certainly something totally new
            iDataType=TDataType(KDataType);
            return;
        }
    }
    }
开发者ID:kolayuk,项目名称:TweakS,代码行数:18,代码来源:PyRecognizer.cpp

示例11: IsRecognizedL

TBool CRefTestAgentManager::IsRecognizedL(const TDesC& aUri, TContentShareMode /*aShareMode*/) const
	{
	TBool result = EFalse;
	
	// Check that the file has content only, otherwise it should
	// be put through the supplier API before it can be used
	TPtrC extension(aUri.Right(KRtaExtensionContent().Length()));
	if(extension.CompareF(KRtaExtensionContent) == 0)
		{
		result = ETrue;
		}
	return result;
	}
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:13,代码来源:Reftestagentmanager.cpp

示例12: CreatePhoneMatchNumberL

/**
Returns the hash code(s) to use when matching the supplied phone number.  If the
number supplied has more actual phone digits (i.e. not including spaces) than
KLowerSevenDigits, a second hash is generated to hold the remaining most
significant phone digits.  Extracts DTMF digits from the phone number if a
parser is available, otherwise just removes the non-digit characters.

@param aText Descriptor containing contacts phone number field.
@param aLowerMatchlength Number of least significant phone digits to use.
@param aUpperMatchLength Number of most significant phone digits to use.

@return The hash code(s) to use when matching the supplied phone number.
*/
CPplCommAddrTable::TMatch CPplCommAddrTable::CreatePhoneMatchNumberL(const TDesC& aText, TInt aLowerMatchLength, TInt aUpperMatchLength)
	{
	__ASSERT_DEBUG( ((aLowerMatchLength == KLowerSevenDigits) && (aUpperMatchLength > 0) )		// upper 8 digits
					|| ((aLowerMatchLength <= KLowerSevenDigits) && (aUpperMatchLength == 0) ),	// lower 7 digits
					User::Leave(KErrNotSupported) );

	const TInt KBufLength = KCntMaxTextFieldLength+1;
	TBuf<KBufLength> buf;

	CContactPhoneNumberParser* parser = iProperties.ContactPhoneParserL().Parser();

	if (parser)
		{
		parser->ExtractRawNumber(aText.Left(KCntMaxTextFieldLength),buf);
		}
	else
		{
		if(aText.Length() <= KBufLength)
			{
			buf = aText;
			}
		else
			{
			buf = aText.Right(KBufLength);
			}
		TMatch::StripOutNonDigitChars(buf);
		}

	TMatch phoneNumber;

	if (buf.Length() == 0)
		{
		return phoneNumber;
		}

	// Generate a hash for the upper digits only if the phone number string is
	// large enough and more than 7 digits are to be matched.
	TInt phoneNumberlength = buf.Length();
	if ( (phoneNumberlength > KLowerSevenDigits) && (aUpperMatchLength > 0) )
		{
		TPtrC upperPart = buf.Left(phoneNumberlength - KLowerSevenDigits);
		phoneNumber.iUpperDigits = TMatch::CreateHashL(upperPart,
			aUpperMatchLength, phoneNumber.iNumUpperDigits);
		}

	// Generate a hash of the lower digits.
	phoneNumber.iLowerSevenDigits = TMatch::CreateHashL(buf, aLowerMatchLength, phoneNumber.iNumLowerDigits);

	return phoneNumber;
	}
开发者ID:bavanisp,项目名称:qtmobility-1.1.0,代码行数:63,代码来源:cpplcommaddrtable.cpp

示例13: DoRecognizeL

void CTNonNativeRec::DoRecognizeL(const TDesC& aName, const TDesC8&)
	{

	// Compare if the file extension is known
	if (aName.Length() < 5)
		{
    	iDataType = TDataType(KNullDesC8); 	
    	iConfidence = ENotRecognized;
		return;
		}

	if (aName.Right(5).CompareF(KLitMimeExtensionNnt1) == 0)
		{
		iDataType = TDataType(KLit8_DataType_Gif);
		iConfidence = ECertain;
		}
	else if (aName.Right(5).CompareF(KLitMimeExtensionNnt2) == 0)
		{
		iDataType = TDataType(KLit8_DataType_Html);
		iConfidence = ECertain;
		}
	else if (aName.Right(5).CompareF(KLitMimeExtensionNnt3) == 0)
		{
		iDataType = TDataType(KLit8_DataType_Vcard);
		iConfidence = ECertain;
		}
	else if (aName.Right(5).CompareF(KLitMimeExtensionNnt4) == 0)
		{
		iDataType = TDataType(KLit8_DataType_plainText);
		iConfidence = ECertain;
		}
    else
    	{
    	iDataType = TDataType(KNullDesC8); 	
    	iConfidence = ENotRecognized;
    	}
	}
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:37,代码来源:TNonNativeRec.cpp

示例14: FormatDateTime

TTime CTestImpExvCardSuiteStepBase::FormatDateTime(const TDesC& aParamString)
	{
	// Format of buffer to construct a TTime is YYYYMMDD:HHMMSS (15 characters).
	// TTime uses zero-based values for month and day - which is confusing for scripting.
	// In our script, we use actual month and day numbers to make things simpler so we
	// must modify the string here to take account of this.
	TBuf<32> buf;
	TInt m, d;

	buf.Zero();
	buf.Copy(aParamString.Left(4));		// The year
	TLex lexMonth = aParamString.Mid(4, 2);
	lexMonth.Val(m);
	TLex lexDay = aParamString.Mid(6, 2);
	lexDay.Val(d);
	buf.AppendFormat(_L("%02d%02d"), m - 1, d - 1);	// The month and day
	buf.Append(aParamString.Right(7));

	return TTime(buf);
	}
开发者ID:Esclapion,项目名称:qt-mobility,代码行数:20,代码来源:testimpexvcardsuitestepbase.cpp

示例15: KtxType

/*
-------------------------------------------------------------------------------
Y-Browser will use this function to recognize file data

NOTE: This is non-leaving functions, thus do not use leaving code
or you have to use TRAP to trap the leaves..
-------------------------------------------------------------------------------
*/
void CYBRecognizer1::RecognizeFile(CYBRecognitionResult& aResult,const TDesC& aFileName,const TDesC8& aBuffer)
{		
	// better to be sure that the pointer is actually non-NULL
	// before using it to avoif KERN-EXEC 3 happening							
	if(aResult.iIdString)
	{
		aResult.iIdString->Des().Zero();
	}
	
	// first we say that its not recognized by us...
	aResult.iConfidence = CYBRecognitionResult::ERecNotRecognized;
	
	_LIT(KtxZipExtension	,".zip");
	
	// filenames can actually be shorter 
	// than normal extension lenght, thus it needs to be checked
	if(aFileName.Length() > 4)
	{
		TBuf<4> ZipExt;
		
		// the extension can be in any case
		// thus we copy it to be in lower case 
		// to make the identification easier
		ZipExt.CopyLC(aFileName.Right(4));
		
		//this recognizer only recognize extensions
		// but you could also use aBuffer data to recognize the file
		if(ZipExt == KtxZipExtension)
		{
			aResult.iConfidence = CYBRecognitionResult::ERecProbable;

			// incase it was constructed before
			// we better delete it to avoid memory leak..
			// I think this might change in future editions...
			delete aResult.iIdString;
			aResult.iIdString = NULL;
			aResult.iIdString = KtxType().Alloc();// non leaving !!!
							
		}
	}
}
开发者ID:DrJukka,项目名称:Symbian_Codes,代码行数:49,代码来源:YToolsZipper.cpp


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