本文整理汇总了C++中TDesC16::Left方法的典型用法代码示例。如果您正苦于以下问题:C++ TDesC16::Left方法的具体用法?C++ TDesC16::Left怎么用?C++ TDesC16::Left使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TDesC16
的用法示例。
在下文中一共展示了TDesC16::Left方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: generatedFirstPartOfUnicode
/**
@SYMTestCaseID SYSLIB-CHARCONV-CT-0538
@SYMTestCaseDesc Splitting and converting from EucJpPacked to Unicode test
@SYMTestPriority Medium
@SYMTestActions Tests for conversion after splitting, from EucJpPacked to Unicode and back to EucJpPacked
@SYMTestExpectedResults Test must not fail
@SYMREQ REQ0000
*/
void CT_EUCJP_PACKED_2::TestSplittingConvertingToUnicodeFromEucJpPacked(CCnvCharacterSetConverter& aCharacterSetConverter, TInt aMaximumLengthLowerLimit, TInt aMaximumLengthUpperLimit, TInt aExpectedNumberOfEucJpPackedBytesNotConvertedAtSplit, TInt aExpectedLengthOfFirstPartOfUnicode, const TDesC16& aExpectedUnicode, const TDesC8& aOriginalEucJpPacked)
{
INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-CHARCONV-CT-0538 "));
test(aMaximumLengthLowerLimit<=aMaximumLengthUpperLimit);
test(aMaximumLengthUpperLimit<=KBufferLength);
TUint16 unicodeBuffer[KBufferLength];
for (TInt i=aMaximumLengthLowerLimit; i<=aMaximumLengthUpperLimit; ++i)
{
TPtr16 generatedFirstPartOfUnicode(unicodeBuffer, i);
TInt state=CCnvCharacterSetConverter::KStateDefault;
test(aCharacterSetConverter.ConvertToUnicode(generatedFirstPartOfUnicode, aOriginalEucJpPacked, state)==aExpectedNumberOfEucJpPackedBytesNotConvertedAtSplit);
test(generatedFirstPartOfUnicode==aExpectedUnicode.Left(aExpectedLengthOfFirstPartOfUnicode));
test(state==CCnvCharacterSetConverter::KStateDefault);
TBuf16<KBufferLength> generatedSecondPartOfUnicode;
test(aCharacterSetConverter.ConvertToUnicode(generatedSecondPartOfUnicode, aOriginalEucJpPacked.Right(aExpectedNumberOfEucJpPackedBytesNotConvertedAtSplit), state)==0);
test(generatedSecondPartOfUnicode==aExpectedUnicode.Mid(aExpectedLengthOfFirstPartOfUnicode));
test(state==CCnvCharacterSetConverter::KStateDefault);
TBuf8<KBufferLength> generatedEucJpPacked;
test(aCharacterSetConverter.ConvertFromUnicode(generatedEucJpPacked, generatedFirstPartOfUnicode)==0);
TBuf8<KBufferLength> generatedSecondPartOfEucJpPacked;
test(aCharacterSetConverter.ConvertFromUnicode(generatedSecondPartOfEucJpPacked, generatedSecondPartOfUnicode)==0);
generatedEucJpPacked.Append(generatedSecondPartOfEucJpPacked);
test(generatedEucJpPacked==aOriginalEucJpPacked);
}
}
示例2: Write
EXPORT_C void TcLog::Write( const TDesC16& aBuf )
{
// Convert to narrow
TBuf8< KTcBufferSize > buf;
buf.Copy( aBuf.Left( KTcBufferSize ) );
Write( buf );
}
示例3: ReadAndHashFileL
TInt TMD5Checker::CheckFileL(class RFs& aFs, const TDesC& aFile, const TDesC16& aHash)
{
TInt ret = ReadAndHashFileL(aFs, aFile);
_LIT16(KMd5Prefix, "md5:");
TInt offset = 0;
if(aHash.Left(KMd5Prefix().Length()).CompareF(KMd5Prefix) == 0){
offset = KMd5Prefix().Length();
}
for(TUint i = 0; i < sizeof(m_hex_md5_checksum) && ret == KErrNone; ++i){
ret = (aHash[i+offset] == m_hex_md5_checksum[i]) ? KErrNone :KMd5NoMatch;
}
return ret;
}
示例4: prefix
/** Gets a matching scheme for the prefix contained in the URI.
@param aUri descriptor to URI
@return Scheme
@panic KErrBadName URI should contain a '.'
*/
const TPtrC16 TUriShortcutParser16::MatchingScheme( const TDesC16& aUri ) const
{
TInt pos = aUri.Locate( KSeparatorDot );
//make sure it contains at least one '.'
__ASSERT_DEBUG( pos > 0 ,User::Panic( KPanicDescriptor,KErrBadName ) );
TPtrC16 prefix( aUri.Left( pos ) );
TPtrC16 scheme ( DefaultScheme() );
if ( KWww().CompareF( prefix ) == 0 )
{
scheme.Set( KHttp() );
}
else if ( KFtp().CompareF( prefix ) == 0 )
{
scheme.Set( KFtp() );
}
else if( CheckUncommonSchemes() )
{
if ( KGopher().CompareF( prefix ) == 0 )
{
scheme.Set( KGopher() );
}
else if ( KTelnet().CompareF( prefix ) == 0 )
{
scheme.Set( KTelnet() );
}
else if ( KWais().CompareF( prefix ) == 0 )
{
scheme.Set( KWais() );
}
else if ( KProspero().CompareF( prefix ) == 0 )
{
scheme.Set( KProspero() );
}
else if ( KNews().CompareF( prefix ) == 0 || KNntp().CompareF( prefix ) == 0 )
{
scheme.Set( KNntp() );
}
}
return scheme;
}
示例5: generatedFirstPartOfUnicode
void CT_ISO2022JP1_2::TestSplittingConvertingToUnicodeFromIso2022Jp(
CCnvCharacterSetConverter& aCharacterSetConverter,
TInt aMaximumLengthLowerLimit,
TInt aMaximumLengthUpperLimit,
TInt aExpectedNumberOfIso2022JpBytesNotConvertedAtSplit,
TInt aExpectedLengthOfFirstPartOfUnicode,
const TDesC16& aExpectedUnicode,
const TDesC8& aOriginalIso2022Jp)
{
INFO_PRINTF1(_L(" TestSplittingConvertingToUnicodeFromIso2022Jp "));
test(aMaximumLengthLowerLimit<=aMaximumLengthUpperLimit);
test(aMaximumLengthUpperLimit<=KBufferLength);
TUint16 unicodeBuffer[KBufferLength];
for (TInt i=aMaximumLengthLowerLimit; i<=aMaximumLengthUpperLimit; ++i)
{
TPtr16 generatedFirstPartOfUnicode(unicodeBuffer, i);
TInt state=CCnvCharacterSetConverter::KStateDefault;
const TInt returnValue=aCharacterSetConverter.ConvertToUnicode(generatedFirstPartOfUnicode, aOriginalIso2022Jp, state);
test(generatedFirstPartOfUnicode==aExpectedUnicode.Left(aExpectedLengthOfFirstPartOfUnicode));
test(returnValue==aExpectedNumberOfIso2022JpBytesNotConvertedAtSplit);
TBuf16<KBufferLength> generatedSecondPartOfUnicode;
test(aCharacterSetConverter.ConvertToUnicode(generatedSecondPartOfUnicode, aOriginalIso2022Jp.Right(aExpectedNumberOfIso2022JpBytesNotConvertedAtSplit), state)==0);
test(generatedSecondPartOfUnicode==aExpectedUnicode.Mid(aExpectedLengthOfFirstPartOfUnicode));
TBuf8<KBufferLength> generatedIso2022Jp;
test(aCharacterSetConverter.ConvertFromUnicode(generatedIso2022Jp, generatedFirstPartOfUnicode)==0);
TBuf8<KBufferLength> generatedSecondPartOfIso2022Jp;
test(aCharacterSetConverter.ConvertFromUnicode(generatedSecondPartOfIso2022Jp, generatedSecondPartOfUnicode)==0);
generatedIso2022Jp.Append(generatedSecondPartOfIso2022Jp);
TBuf16<KBufferLength> regeneratedUnicode;
state=CCnvCharacterSetConverter::KStateDefault;
test(aCharacterSetConverter.ConvertToUnicode(regeneratedUnicode, generatedIso2022Jp, state)==0);
// test(regeneratedUnicode==aExpectedUnicode);
state=CCnvCharacterSetConverter::KStateDefault;
test(aCharacterSetConverter.ConvertToUnicode(regeneratedUnicode, aOriginalIso2022Jp, state)==0);
test(regeneratedUnicode==aExpectedUnicode);
}
}
示例6:
void CT_ISO2022JP1_2::TestTruncatedConversionFromUnicodeToIso2022Jp(
CCnvCharacterSetConverter& aCharacterSetConverter,
const TDesC16& aOriginalUnicode)
{
INFO_PRINTF1(_L(" TestTruncatedConversionFromUnicodeToIso2022Jp "));
for (TInt i=aOriginalUnicode.Length(); i>=0; --i)
{
TBuf8<KBufferLength> generatedIso2022Jp;
const TInt returnValue=aCharacterSetConverter.ConvertFromUnicode(generatedIso2022Jp, aOriginalUnicode.Left(i));
test(returnValue>=0);
TBuf8<KBufferLength> generatedsecondPartOfIso2022Jp;
test(aCharacterSetConverter.ConvertFromUnicode(generatedsecondPartOfIso2022Jp, aOriginalUnicode.Mid(i-returnValue))==0);
generatedIso2022Jp.Append(generatedsecondPartOfIso2022Jp);
TInt state=CCnvCharacterSetConverter::KStateDefault;
TBuf16<KBufferLength> generatedUnicode;
test(aCharacterSetConverter.ConvertToUnicode(generatedUnicode, generatedIso2022Jp, state)==0);
test(generatedUnicode==aOriginalUnicode);
}
}
示例7: TokenizeCSV
TBool TAzenqosEngineUtils::TokenizeCSV(const TDesC16& whole,TPtrC16& ret, TPtrC16& remainder, TChar aDelim)
{
TPtrC16 afterFristQuote(0,0);
TBuf<3> aDelimStr;
aDelimStr.Append(aDelim);
TInt firstQuotePos = whole.Find(KQuote16);
TInt CommaPos = whole.Find(aDelimStr);
TInt secondQuotePos = -1;
TBool encounteredQuote = EFalse;
if(firstQuotePos>=0 && firstQuotePos<CommaPos)
{
encounteredQuote = ETrue;
afterFristQuote.Set(whole.Right(whole.Length()-firstQuotePos-1));
secondQuotePos = afterFristQuote.Find(KQuote16);
if(secondQuotePos<0)
{
TBuf<32> countbuf;
countbuf =_L("Parse Error: Mis-Quote");
/*
CAknErrorNote* informationNote = new (ELeave) CAknErrorNote(ETrue);
informationNote->SetTimeout(CAknNoteDialog::EShortTimeout);
informationNote->ExecuteLD(countbuf);*/
return EFalse;//misquote
}
secondQuotePos += (firstQuotePos+1);
CommaPos = secondQuotePos+1;
}
else
{
//csv.Set(incsv);
}
if(CommaPos>=0)
{
/*if(encounteredQuote)
{
ret.Set(incsv.Mid(1,CommaPos-1));
}
else
{
}*/
ret.Set(whole.Left(CommaPos));
if(ret.Length()>=2 && ret[0] == '"' && ret[ret.Length()-1] == '"' )
{
if(ret.Length()>2)
{
TPtrC16 tmp(0,0);
tmp.Set(whole.Left(CommaPos));
ret.Set(tmp.Mid(1,tmp.Length()-2));
}
else //ret==2
{
ret.Set(0,0);
}
}
remainder.Set(whole.Right(whole.Length()-CommaPos-1));
return ETrue;
}
//remainder.Set(incsv);
return EFalse;
}
示例8:
/**
@SYMTestCaseID SYSLIB-CHARCONV-CT-0535
@SYMTestCaseDesc Tests for truncated conversion from Unicode to EucJpPacked
@SYMTestPriority Medium
@SYMTestActions Tests for truncated conversion from Unicode to EucJpPacked and back to Unicode
@SYMTestExpectedResults Test must not fail
@SYMREQ REQ0000
*/
void CT_EUCJP_PACKED_2::TestTruncatedConversionFromUnicodeToEucJpPacked(CCnvCharacterSetConverter& aCharacterSetConverter, const TDesC16& aOriginalUnicode)
{
INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-CHARCONV-CT-0535 "));
for (TInt i=aOriginalUnicode.Length(); i>=0; --i)
{
TBuf8<KBufferLength> generatedEucJpPacked;
const TInt returnValue=aCharacterSetConverter.ConvertFromUnicode(generatedEucJpPacked, aOriginalUnicode.Left(i));
test(returnValue>=0);
TBuf8<KBufferLength> generatedsecondPartOfEucJpPacked;
test(aCharacterSetConverter.ConvertFromUnicode(generatedsecondPartOfEucJpPacked, aOriginalUnicode.Mid(i-returnValue))==0);
generatedEucJpPacked.Append(generatedsecondPartOfEucJpPacked);
TInt state=CCnvCharacterSetConverter::KStateDefault;
TBuf16<KBufferLength> generatedUnicode;
test(aCharacterSetConverter.ConvertToUnicode(generatedUnicode, generatedEucJpPacked, state)==0);
test(generatedUnicode==aOriginalUnicode);
}
}