本文整理汇总了C++中TDesC16::Mid方法的典型用法代码示例。如果您正苦于以下问题:C++ TDesC16::Mid方法的具体用法?C++ TDesC16::Mid怎么用?C++ TDesC16::Mid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TDesC16
的用法示例。
在下文中一共展示了TDesC16::Mid方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
// ==========================================================================
// METHOD: Write
//
// DESIGN: Write the given buffer. Chunk the string if it is longer than
// KMaxTextPerLine.
// ==========================================================================
void CLogFileHandler::Write( const TDesC8& aClassName,
const TDesC8& aFuncName,
const TDesC16& aDes )
{
TRAP_IGNORE( AddTimestampToOutputBufferL() );
TInt prefixLength = iOutputBuffer.Length();
TRAP_IGNORE( AddClassAndFunctionToOutputBufferL( aClassName, aFuncName ) );
TInt curPos = 0;
while( curPos < aDes.Length() )
{
TInt lengthToWrite = Min( KMaxTextPerLine - iOutputBuffer.Length(), aDes.Length() - curPos );
TRAP_IGNORE( WriteLineL( aDes.Mid( curPos, lengthToWrite ) ) );
iOutputBuffer.SetLength( prefixLength );
curPos += lengthToWrite;
} // end while
} // END Write
示例3: LogLit
// ------------------------------------------------
// LogLit
// ------------------------------------------------
//
void CMdSLogger::LogLit( const TDesC16& aText )
{
if (!iValid)
{
return;
}
TInt offset = 0;
TInt linecount = 0;
TInt length = aText.Length();
while( offset < length )
{
TInt partLength = Min( length-offset, KLineLength );
#ifdef MDE_FILE_LOGGING
iLog.Write( aText.Mid( offset, partLength ) );
#else
RDebug::Print( aText.Mid( offset, partLength ) );
#endif
++linecount;
offset += partLength;
}
CheckSize( linecount );
}
示例4:
/**
@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);
}
}
示例5:
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);
}
}
示例6: WriteAll
EXPORT_C void CSenLogger::WriteAll(TInt aChannel, TInt aLevel, const TDesC16& aText)
{
RFileLogger* pLogger = Logger(aChannel, aLevel);
if ( pLogger )
{
TInt i = 0;
TInt lineAmount(KColumnWidth);
TInt length = aText.Length();
while(i<aText.Length())
{
if ( length - i < KColumnWidth )
{
lineAmount = length - i;
}
pLogger->Write(aText.Mid(i, lineAmount));
i += KColumnWidth;
}
}
}
示例7: 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);
}
}