本文整理汇总了C++中TPtrC8::Left方法的典型用法代码示例。如果您正苦于以下问题:C++ TPtrC8::Left方法的具体用法?C++ TPtrC8::Left怎么用?C++ TPtrC8::Left使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TPtrC8
的用法示例。
在下文中一共展示了TPtrC8::Left方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WriteComment
EXPORT_C
#if defined (_DEBUG)
/**
Function to do a write of the supplied data, literally where possible.
@param aData The descriptor that holds the supplied data.
*/
void THttpLogger::WriteComment(const TDesC8& aData)
//Do a write of the supplied data, literally where possible
{
if(iLogger)
{
// If the connection to flogger was made
if(iLogger->Handle() != 0)
{
TPtrC8 line;
line.Set(aData);
while (line.Length() > KMaxLogLineLength)
{
iLogger->Write(line.Left(KMaxLogLineLength));
line.Set(line.Right(line.Length() - KMaxLogLineLength));
}
iLogger->Write(line.Left(line.Length()));
}
}
}
示例2: GetHttpHeaderInfo
TPtrC8 CSocketEngine::GetHttpHeaderInfo(const TDesC8 &aHeaderData,const TDesC8 &aHeaderInfo){
_LIT8(KEnter,"\r\n");
TBuf8<256> bufInfo(aHeaderInfo);
bufInfo.Append(_L8(": "));
TPtrC8 ret;
TPtrC8 ptr;
ptr.Set(aHeaderData);
TInt pos=ptr.FindF(bufInfo);
if(pos>0){
TInt start=pos+bufInfo.Length();
ptr.Set(ptr.Mid(start));
pos=ptr.FindF(KEnter);
if(pos>0){
ptr.Set(ptr.Left(pos));
ret.Set(ptr);
}else if(-1==pos){
pos=ptr.FindF(_L8("\n"));
if(pos>0){
ptr.Set(ptr.Left(pos));
ret.Set(ptr);
}
}
}
return ret;
}
示例3: Read
TPtrC8 Read(TDes8& aTempBuf, TPtrC8& aData, TInt aLength, TPtrC8& aOverflowData)
{
if (aLength <= aData.Length())
{
// Can read it from this buffer
TPtrC8 res(aData.Left(aLength));
aData.Set(aData.Mid(aLength));
return res;
}
else /*if (aLength > aData.Length())*/
{
// Descriptor spans wrap point, so need to copy into temp buf
aTempBuf.Copy(aData.Left(aTempBuf.MaxLength())); // If anyone's crazy enough to write a platsec diagnostic string longer than 2k, it gets truncated
TInt overflowLen = aLength - aData.Length();
aData.Set(aOverflowData); // Wrap aData
aOverflowData.Set(TPtrC8());
if (overflowLen > aData.Length())
{
ASSERT(EFalse); // Shouldn't happen
// in urel, return everything we've got
return aData;
}
aTempBuf.Append(aData.Left(overflowLen));
aData.Set(aData.Mid(overflowLen));
return TPtrC8(aTempBuf);
}
}
示例4: WriteComment
EXPORT_C
#if defined (_DEBUG)
void TInuLogger::WriteComment(const TDesC8& aData)
//Do a write of the supplied data, literally where possible
{
TPtrC8 line;
line.Set(aData);
while (line.Length() > KMaxLogLineLength)
{
iLogger.Write(line.Left(KMaxLogLineLength));
line.Set(line.Right(line.Length() - KMaxLogLineLength));
}
iLogger.Write(line.Left(line.Length()));
}
示例5: ValidateElementNsL
TBool CPolicyNormalizer::ValidateElementNsL(CSenElement* aAssertion)
{
CSenElement& element = AsElement();
RPointerArray<CSenNamespace>& namespaces = element.NamespacesL();
if(aAssertion->NamespaceURI().Length() < 1 )
{
TPtrC8 elementName = aAssertion->LocalName();
TInt location = elementName.Find(KColon);
if (location)
{
TPtrC8 nsPrefix = elementName.Left(location);
CSenNamespace* ns = NULL;
TInt count = namespaces.Count();
for (TInt i=0; i < count; i++)
{
ns = (namespaces)[i];
if(ns->Prefix().Compare(nsPrefix) == 0)
{
aAssertion->SetNamespaceL(ns->Prefix(),ns->URI());
return ETrue;
}
}
}
}
return EFalse;
}
示例6: DecodeGenericNumberL
void CUPnPHeaderReader::DecodeGenericNumberL(RHeaderField& aHeader) const
{
TPtrC8 buffer;
aHeader.RawDataL(buffer);
TInt number = KErrNotFound;
TInt decimalPos = buffer.Locate('.');
if(decimalPos == 0)
{
// first character is decimal. So, set the value as zero.
SetNewIntegerPartL(aHeader, 0, 0);
}
else
{
// Search for '\n' separator. In the case when a duplicate header has been received,
// only use the fist instance of the valid data.
TInt newLinePos = buffer.Locate('\n');
if (newLinePos != KErrNotFound)
{
buffer.Set(buffer.Left(newLinePos));
}
TInt value = KErrNotFound;
TInt ret = InetProtTextUtils::ConvertDescriptorToInt(buffer, value);
if ( ret > KErrNone )
{
// Extract an integer. Do not permit terminators other than WS or EOL.
InetProtTextUtils::ExtractIntegerValueL(buffer, number, EFalse);
}
SetNewIntegerPartL(aHeader, 0, number); // part 0, i.e. the first (and only) part
}
}
示例7: DecodeTimeoutHeaderL
void CUPnPHeaderReader::DecodeTimeoutHeaderL(RHeaderField& aHeader) const
{
TPtrC8 buffer;
aHeader.RawDataL(buffer);
// Search for '\n' separator. In the case when a duplicate header has been received,
// only use the fist instance of the valid data.
TInt newLinePos = buffer.Locate('\n');
if (newLinePos != KErrNotFound)
{
buffer.Set(buffer.Left(newLinePos));
}
RStringF infinite = iStringPool.StringF(UPnP::EInfinite, TUPnPTable::Table());
if(buffer.Compare(infinite.DesC()) == 0)
{
SetNewIntegerPartL(aHeader, 0, -(KMaxTInt));
}
else
{
TPtrC8 token;
InetProtTextUtils::ExtractNextTokenFromList(buffer, token, KSemiSpaceSep);
TInt consumed = token.Locate('-');
token.Set(token.Mid(consumed+1));
TInt intVal;
InetProtTextUtils::ConvertDescriptorToInt(token, intVal);
SetNewIntegerPartL(aHeader, 0, intVal); // part 0, i.e. the first (and only) part
}
}
示例8: RunL
// -----------------------------------------------------------------------------
// CContactSubscriber::RunL()
// Assyncronous request handler , on completion of notification
// -----------------------------------------------------------------------------
//
void CContactSubscriber::RunL()
{
__TRACE_CALLSTACK;
SubscribeChangeNotiFication();
// property updated, get new value
TBuf8 <KBufferSize> value;
TPtrC8 id;
TPtrC8 sourceType;
TPtrC8 addressCount;
if ( KErrNone == iProperty.Get( value ) )
{
TInt pos = value.Locate(TChar('-'));
id.Set( value.Left(pos) );
TPtrC8 ptr = value.Right(3);
sourceType.Set(ptr.Left(1));
addressCount.Set(ptr.Right(1));
TInt appId = -1, addressType = -1, addressTypeCount = -1;
TLex8 lex(id);
lex.Val(appId);
TLex8 lex1(sourceType);
lex1.Val( addressType );
TLex8 lex2(addressCount);
lex2.Val(addressTypeCount);
iNotifyChange.GetChangeNotificationL( appId, addressType,addressTypeCount );
}
}
示例9: ReadAssignment
TInt CVBookmarkConverter::ReadAssignment( const TDesC8& aBuffer,
TInt& aPosition, TPtrC8& aTag, TPtrC8& aValue )
{
LOGGER_ENTERFN( "CVBookmarkConverter::ReadAssignment" );
TPtrC8 start = aBuffer.Mid( aPosition );
TInt assignment = start.Find( KVBMKAssignment );
TInt linefeed = start.Find( KVBMKLinefeed );
// Did we find the delimeter and the linefeed
if ( ( assignment == KErrNotFound) || ( linefeed == KErrNotFound ) )
{
return KErrNotFound;
}
// Linefeed must reside behind the delimeter
if ( linefeed <= assignment )
{
return KErrNotFound;
}
// Extract tag
aTag.Set( start.Left( assignment ) );
IgnoreSpaces( aTag );
// Extract value
aValue.Set( start.Mid( assignment + 1, ( linefeed - 1 ) - assignment ) );
IgnoreSpaces( aValue );
// update position
aPosition += ( linefeed + KVBMKLinefeed().Length() );
LOGGER_LEAVEFN( "CVBookmarkConverter::ReadAssignment" );
return KErrNone;
}
示例10: ptr
void
CContentWindowContainer::DataReceived(class MBrCtlLinkContent* aLinkContent,
const isab::DataGuiMess* aMess, const char *aUrl)
{
HBufC8* data = NULL;
HBufC* contentType = NULL;
HBufC* url = WFTextUtil::AllocLC(aUrl);
TPtr8 ptr(const_cast<unsigned char*>(aMess->getData()), aMess->getSize(), aMess->getSize());
TInt neck = ptr.Find(KNeck());
if (neck == KErrNotFound) {
data = HBufC8::NewLC( ptr.Length());
data->Des().Copy(ptr);
contentType = WFTextUtil::AllocLC("text/html");
} else {
TPtrC8 header = ptr.Left(neck);
TPtrC8 body = ptr.Mid(neck+4);
data = HBufC8::NewLC( body.Length());
data->Des().Copy(body);
TInt pos = header.Find(KLineEnd);
TPtrC8 rest = header;
while (pos != KErrNotFound) {
TPtrC8 tmp = rest.Left(pos);
rest.Set(rest.Mid(pos+2));
pos = rest.Find(KLineEnd);
TInt ctpos = tmp.FindF(KContentTypeMarker);
if (ctpos != KErrNotFound) {
TPtrC8 tmp2 = tmp.Mid(ctpos+KContentTypeMarker().Length());
TInt scpos = tmp2.Find(KSemiColon);
if (scpos == KErrNotFound) {
contentType = HBufC::NewLC(tmp2.Length());
contentType->Des().Copy(tmp2);
} else {
contentType = HBufC::NewLC(tmp2.Left(scpos).Length());
contentType->Des().Copy(tmp2.Left(scpos));
}
break;
}
}
if (!contentType) {
contentType = WFTextUtil::AllocLC("text/html");
}
}
/* contentType = RecognizeLC(*url, ptr); */
/* contentType = WFTextUtil::AllocLC("text/html"); */
aLinkContent->HandleResolveComplete(*contentType, KCharSet, data);
CleanupStack::PopAndDestroy(contentType);
CleanupStack::PopAndDestroy(data);
CleanupStack::PopAndDestroy(url);
}
示例11: ProcessPolicyReferenceL
CSenElement* CPolicyNormalizer::ProcessPolicyReferenceL(CSenElement* aPolicy, CPolicyRegistry* aRegistry)
{ //Loop for wsp:PolicyReference element and if found then replace
// it with wsp:All and copy everything from found policy to here
if(aRegistry == NULL)
return NULL;
//Check if there is a reference if yes then resolve it
RPointerArray<CSenElement> referenceChildren;
if(aPolicy->ElementsL(referenceChildren, KWsPolicyReference) == KErrNone)
{
TInt childCount = referenceChildren.Count();
TInt i = 0;
CSenElement* pNextChild;
while (i < childCount)
{
pNextChild = referenceChildren[i];
TPtrC8 localName = pNextChild->LocalName();
TPtrC8 uri = GetReferenceUriL(pNextChild);
_LIT8(KHash, "#");
HBufC8* aRippedUri = NULL;
if(uri.Left(1).Compare(KHash) == 0)
aRippedUri = uri.Right(uri.Length()-1).AllocL();
if(aRippedUri->Length() > 0)
{
CSenElement* referedPolicy = aRegistry->LookupPolicy(aRippedUri->Des());
if(referedPolicy)
{
ReplacePolicyReferenceL(pNextChild,referedPolicy);
}
}
delete aRippedUri;
i++;
}
}
//Check in all children recursively PolicyReferences and resolve them
RPointerArray<CSenElement>& children = aPolicy->ElementsL();
TInt childCount = children.Count();
CSenElement* pNextChild;
TInt i=0;
while (i < childCount)
{
pNextChild = children[i];
TPtrC8 localName = pNextChild->LocalName();
ProcessPolicyReferenceL(pNextChild, aRegistry);
i++;
}
return NULL;
}
示例12: Match
TBool CExampleResolver::Match(const TDesC8& aImplementationType,
const TDesC8& aMatchType,
TBool aUseWildcards) const
{
TInt matchPos = KErrNotFound;
_LIT8(dataSeparator, "||");
const TInt separatorLength = dataSeparator().Length();
// Look for the section separator marker '||'
TInt separatorPos = aImplementationType.Find(dataSeparator);
if(separatorPos == KErrNotFound)
{
// Match against the whole string
if(aUseWildcards)
matchPos = aImplementationType.Match(aMatchType);
else
matchPos = aImplementationType.Compare(aMatchType);
}
else
{
// Find the first section, up to the separator
TPtrC8 dataSection = aImplementationType.Left(separatorPos);
TPtrC8 remainingData = aImplementationType.Mid(separatorPos + separatorLength);
// Match against each section in turn
while(separatorPos != KErrNotFound)
{
// Search this section
if(aUseWildcards)
matchPos = dataSection.Match(aMatchType);
else
matchPos = dataSection.Compare(aMatchType);
// If we found it then no need to continue, so return
if(matchPos != KErrNotFound)
return ETrue;
// Move on to the next section
separatorPos = remainingData.Find(dataSeparator);
if(separatorPos != KErrNotFound)
{
dataSection.Set(remainingData.Left(separatorPos));
remainingData.Set(remainingData.Mid(separatorPos + separatorLength));
}
else
dataSection.Set(remainingData);
}
// Check the final part
if(aUseWildcards)
matchPos = dataSection.Match(aMatchType);
else
matchPos = dataSection.Compare(aMatchType);
}
return matchPos != KErrNotFound;
}
示例13:
/**
Parses the descriptor aUri into uri components.
@param aUri A reference to a descriptor pointer of an Uri.
@param aScheme A reference to a descriptor pointer for retieved
scheme component.
*/
void TUriParser8::RetrieveScheme(const TPtrC8& aUri, TPtrC8& aScheme)
{
TInt schemePos = aUri.Locate(KSchemeDelimiter);
if(schemePos != KErrNotFound)
{
// Got a scheme - store information
aScheme.Set(aUri.Left(schemePos));
}
}
示例14: SetListL
void RElementIdArray::SetListL( const TDesC8& aChilds)
{
TInt index = 0;
TPtrC8 ptr = aChilds;
while ( 0 <= ( index = ptr.Locate( KMessageDelimiterChar)))
{
AppendL( ptr.Left( index).AllocL());
ptr.Set( ptr.Mid(index + 1));
}
}
示例15: ToSIPExtensionHeadersL
// -----------------------------------------------------------------------------
// MceSip::ToSIPExtensionHeadersL
// -----------------------------------------------------------------------------
//
void MceSip::ToSIPExtensionHeadersL( RPointerArray<CSIPHeaderBase>& aSIPHeaders,
const MDesC8Array& aHeaders )
{
for ( int i = 0; i < aHeaders.MdcaCount(); i++ )
{
TPtrC8 param = aHeaders.MdcaPoint( i );
TInt index = param.Locate( KMceSipSeparator );
if ( index != KErrNotFound &&
param.Left( index ) != KMceSipSubscriptionStateHeader )
{
CSIPExtensionHeader* extHeader = CSIPExtensionHeader::NewL(
param.Left(index),
param.Right( param.Length() - ( index + 1 ) ) );
CleanupStack::PushL( extHeader );
User::LeaveIfError( aSIPHeaders.Append( extHeader ) );
CleanupStack::Pop( extHeader );
}
}
}