本文整理汇总了C++中TDes8::Right方法的典型用法代码示例。如果您正苦于以下问题:C++ TDes8::Right方法的具体用法?C++ TDes8::Right怎么用?C++ TDes8::Right使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TDes8
的用法示例。
在下文中一共展示了TDes8::Right方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ParseExtension
// -----------------------------------------------------------------------------
// CUpnpHttpChunkParser::ParseL
// Decoding the chunked-encoded buffer
// -----------------------------------------------------------------------------
//
TBool CUpnpHttpChunkParser::ParseExtension( TDes8& aBuffer, TInt& aPos )
{
if ( IsEmpty( aBuffer, aPos ) )
{
return ETrue;
}
//if '\r\n' exists
TInt lineFeed = aBuffer.Right( aBuffer.Length() - aPos ).FindF( UpnpString::KLineFeed );
if ( lineFeed != KErrNotFound )
{
aBuffer.Delete( aPos, lineFeed + UpnpString::KLineFeed().Length() );
if ( !iChunkSize )
{
iContext = ETrailer;
return EFalse;
}
else
{
iContext = EBody;
return EFalse;
}
}
else
{
//one character left - possible linefeed
if ( aPos + 1 < aBuffer.Length() )
{
aBuffer.Delete( aPos, aBuffer.Length() - aPos - 1 );
}
return ETrue;
}
}
示例2: AppendWildCardChar
void CATBase::AppendWildCardChar(TDes8& aString)
//
// A utility function to append a '*' to aString if there's not one already there
//
{
_LIT8(KAsterisk,"*");
if(aString.Right(1)!=KAsterisk)
aString.Append(KAsterisk);
}
示例3: ParseBody
// -----------------------------------------------------------------------------
// CUpnpHttpChunkParser::ParseL
// Decoding the chunked-encoded buffer
// -----------------------------------------------------------------------------
//
TBool CUpnpHttpChunkParser::ParseBody( TDes8& aBuffer, TInt& aPos )
{
if ( IsEmpty( aBuffer, aPos ) )
{
return ETrue;
}
TPtrC8 pointer( aBuffer.Right( aBuffer.Length() - aPos ) );
if ( iBytesAppended + pointer.Length() >= iChunkSize )
{
aPos += ( iChunkSize - iBytesAppended );
pointer.Set( aBuffer.Right( aBuffer.Length() - aPos ) );
TInt lineFeed = pointer.FindF(UpnpString::KLineFeed());
//linefeed found
if ( !lineFeed )
{
aBuffer.Delete( aPos, UpnpString::KLineFeed().Length() );
iContext = EEndChunkBody;
return ( aPos == aBuffer.Length() );
}
//linefeed not found, end of buffer
else if ( lineFeed == KErrNotFound &&
( ( aPos + UpnpString::KLineFeed().Length() ) > aBuffer.Length() )
)
{
iBytesAppended = iChunkSize;
return ETrue;
}
//size doesn't comply with the header value
iError = KErrGeneral;
iContext = EError;
return EFalse;
}
else
{
iBytesAppended += pointer.Length();
aPos = aBuffer.Length();
return ETrue;
}
}
示例4: ParseLastChunk
// -----------------------------------------------------------------------------
// CUpnpHttpChunkParser::ParseL
// Decoding the chunked-encoded buffer
// -----------------------------------------------------------------------------
//
TBool CUpnpHttpChunkParser::ParseLastChunk( TDes8& aBuffer, TInt& aPos )
{
//if empty or only one character present
if ( (aBuffer.Length() - aPos) < UpnpString::KLineFeedLength )
{
return ETrue;
}
//if '\r\n' exists
TInt lineFeed = aBuffer.Right( aBuffer.Length() - aPos ).FindF( UpnpString::KLineFeed );
if ( !lineFeed )
{
aBuffer.Delete( aPos, lineFeed + UpnpString::KLineFeed().Length() );
iContext = EFinish;
return ETrue;
}
else
{
iContext = ETrailer;
return EFalse;
}
}
示例5: ParseTrailer
// -----------------------------------------------------------------------------
// CUpnpHttpChunkParser::ParseL
// Decoding the chunked-encoded buffer
// -----------------------------------------------------------------------------
//
TBool CUpnpHttpChunkParser::ParseTrailer( TDes8& aBuffer, TInt& aPos )
{
if ( IsEmpty( aBuffer, aPos ) )
{
return ETrue;
}
//if double '\r\n' exists
TInt doublelineFeed = aBuffer.Right( aBuffer.Length() - aPos ).FindF( UpnpString::KDoubleLineFeed );
if (doublelineFeed != KErrNotFound )
{
aBuffer.Delete( aPos, doublelineFeed + UpnpString::KDoubleLineFeed().Length() );
iContext = EFinish;
return ETrue;
}
else
{
//waiting,3 characters reserved for double linefeed
if ( aPos + UpnpString::KCRLFCRLength < aBuffer.Length() )
{
aBuffer.Delete( aPos, aBuffer.Length() - aPos - UpnpString::KCRLFCRLength );
}
return ETrue;
}
}
示例6: ParseHeader
// -----------------------------------------------------------------------------
// CUpnpHttpChunkParser::ParseL
// Decoding the chunked-encoded buffer
// -----------------------------------------------------------------------------
//
TBool CUpnpHttpChunkParser::ParseHeader( TDes8& aBuffer, TInt& aPos )
{
if ( IsEmpty( aBuffer, aPos ) )
{
return ETrue;
}
iChunkSize = KErrNotFound;
iBytesAppended = 0;
TPtrC8 pointer(NULL,0);
//if '\r\n' exists
TInt lineFeed = aBuffer.Right( aBuffer.Length() - aPos ).FindF( UpnpString::KLineFeed );
//if ';' exists
TInt semiColon = aBuffer.Right( aBuffer.Length() - aPos ).FindF( UpnpString::KSemiColon );
//semicolon ignored if occurs after the linefeed
if ( semiColon !=KErrNotFound && lineFeed !=KErrNotFound && lineFeed<semiColon )
{
semiColon = KErrNotFound;
}
if ( semiColon !=KErrNotFound )
{
pointer.Set(aBuffer.Right( aBuffer.Length() - aPos ).Mid( 0,semiColon ) );
}
else if ( lineFeed !=KErrNotFound )
{
pointer.Set( aBuffer.Right( aBuffer.Length() - aPos ).Mid( 0,lineFeed ) );
}
else
{
pointer.Set( aBuffer.Right( aBuffer.Length() - aPos ) );
}
TLex8 lex( pointer );
//skip white spaces
lex.SkipSpace();
TUint size;
//neither semicolon nor linefeed found
if ( lineFeed == KErrNotFound && semiColon == KErrNotFound )
{
//remember the num of cut spaces
TInt len = lex.Offset();
if ( !lex.Eos() )
{
//check the chunk header size for the limit
TInt error = lex.Val( size, EHex );
if ( error!= KErrNone || size > KMaxTInt )
{
//size too big
iError = ( error ) ? error: EHttpInsufficientStorage;
iContext = EError;
return EFalse;
}
}
aBuffer.Delete( aPos,len );
return ETrue;
}
//get size
TInt error = lex.Val( size, EHex );
if ( error!= KErrNone || size > KMaxTInt )
{
//unexpected characters or size too big
iError = ( error ) ? error: EHttpInsufficientStorage ;
iContext = EError;
return EFalse;
}
iChunkSize = size;
//skip white spaces
lex.SkipSpace();
if ( !lex.Eos() )
{
//unexpected characters
iError = KErrGeneral;
iContext = EError;
return EFalse;
}
if ( lineFeed != KErrNotFound )
{
//the whole chunk header is parsed
aBuffer.Delete( aPos, lineFeed + UpnpString::KLineFeed().Length() );
//chunk size == 0
if ( !iChunkSize )
{
iContext = ELastChunk;
}
else
{
iContext = EBody;
}
return ( aPos == aBuffer.Length() );
}
else if ( semiColon != KErrNotFound )
{
//extension found,
//one character left - possible linefeed
//.........这里部分代码省略.........