本文整理汇总了C++中TPtrC8::Right方法的典型用法代码示例。如果您正苦于以下问题:C++ TPtrC8::Right方法的具体用法?C++ TPtrC8::Right怎么用?C++ TPtrC8::Right使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TPtrC8
的用法示例。
在下文中一共展示了TPtrC8::Right方法的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: GetTokenValue
// -----------------------------------------------------------------------------
// Get value for given id.
// -----------------------------------------------------------------------------
//
HBufC8* CConfigurationHandler::GetTokenValue( const TDesC8& aData,
const TDesC8& aKey )
{
if( aData.Find(aKey)==KErrNotFound )
{
return NULL;
}
// id is in the string
TLex8 lex(aData);
while( !lex.Eos() )
{
TPtrC8 token = lex.NextToken();
TInt spos = token.Find(aKey);
if( spos==KErrNotFound )
{
continue;
}
// key was found return value
TPtrC8 value = token.Right(token.Length()-aKey.Length());
HBufC8* retval = HBufC8::NewL(value.Length());
TPtr8 des = retval->Des();
des.Append(value);
return retval;
}
return NULL;
}
示例3: 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 );
}
}
示例4: DescriptionUrlPort
// -----------------------------------------------------------------------------
// CUpnpDevice::DescriptionUrlPort
// Retrun description URL port.
// -----------------------------------------------------------------------------
//
EXPORT_C TInt CUpnpDevice::DescriptionUrlPort() const
{
if ( iAddress != TInetAddr( INET_ADDR( 0,0,0,0 ), 0) )
{
return iAddress.Port();
}
const TDesC8& url = DescriptionUrl();
if ( url.Length()> KHttp().Length() )
{
TPtrC8 addrAndPath = url.Right( url.Length() - KHttp().Length() );
TInt separIndex = addrAndPath.Find( KSepar() );
if ( separIndex == KErrNotFound )
{
return KDefaultDescriptionUrlPort;
}
TInt slashIndex = addrAndPath.Find( KSlash8() );
if ( slashIndex != KErrNotFound )
{
TPtrC8 port = addrAndPath.Mid(
separIndex + 1, slashIndex - separIndex
);
TLex8 lex( port );
TInt prt;
TInt err = lex.Val( prt );
if( KErrNone != err )
{
return KErrNotFound;
}
return prt;
}
else
{
TPtrC8 port = addrAndPath.Right(
addrAndPath.Length() - ( separIndex + 1 )
);
TLex8 lex( port );
TInt prt;
TInt err = lex.Val( prt );
if( KErrNone != err )
{
return KErrNotFound;
}
return prt;
}
}
return KDefaultDescriptionUrlPort;
}
示例5: 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;
}
示例6: ParseLicenseL
// ---------------------------------------------------------
// CDdEng::ParseLicenseL()
// ---------------------------------------------------------
//
void CDdEng::ParseLicenseL()
{
HBufC8* descriptorBuf = CodUtil::ConvertLC( iCodBuf->Des());
TPtrC8 license;
TPtrC8 descriptor (descriptorBuf->Ptr());
TInt startTag = descriptor.Find(KLicenseStartTag); // "<license"
if (startTag != KErrNotFound)
{
descriptor.Set(descriptor.Right(descriptor.Length()- startTag -1));
TInt endTag = descriptor.Locate(KElementEnd); //'>'
if (endTag != KErrNotFound)
{
license.Set(descriptor.Right(descriptor.Length()-endTag-1));
TInt licenseTagEnd = license.Find(KLicenseEndTag); // "</license"
if (licenseTagEnd != KErrNotFound)
{
license.Set(license.Left(licenseTagEnd));
}
}
}
iSaver->AppendData( license );
CleanupStack::PopAndDestroy( descriptorBuf );
}
示例7: ReadNewVersionFileL
TInt CVersionFileReader::ReadNewVersionFileL(const TDesC& versionFile)
{
iNewVersionArray->Reset();
class RFs& fs = CCoeEnv::Static()->FsSession();
class RFile file;
TInt ret = file.Open(fs, versionFile,
EFileStreamText | EFileRead);
if(ret != KErrNone) {
/* Could not open file, return the error code */
return ret;
}
HBufC8* line = HBufC8::NewLC(40);
TInt pos = -1;
file.Seek(ESeekStart, pos);
TPtr8 pLine = line->Des();
ret = file.Read(pLine);
if(line->Length() == 0) {
// Empty file
file.Close();
return KErrEof;
}
file.Close();
// The file contains a string that should match this regex:
// [0-9]+\.[0-9]+\.[0-9]\+:[0-9]+\.[0-9]+\.[0-9]\+:[0-9]\+
// The string is separated into three parts by ':'.
// The first part is the application version
// The second part is the resource version
// The third part is the mlfw version.
const TChar colon = ':';
const TChar dot = '.';
while(line->Length() > 0) {
if(line->Locate(colon) != KErrNotFound) {
TPtrC8 part = line->Left(line->Locate(colon));
TPtrC8 version = part.Left(part.LocateReverse(dot));
TPtrC8 misc = part.Right(part.Length() - part.LocateReverse(dot) - 1);
iNewVersionArray->AppendL(part);
iNewVersionArray->AppendL(version);
iNewVersionArray->AppendL(misc);
line->Des().CopyF(line->Right(line->Length() - line->Locate(colon) - 1));
} else {
iNewVersionArray->AppendL(*line);
break;
}
}
CleanupStack::PopAndDestroy(line);
return 0;
}
示例8: 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()));
}
示例9: DescriptionUrl
// -----------------------------------------------------------------------------
// CUpnpDevice::DescriptionUrlPath
// Return description URL path.
// -----------------------------------------------------------------------------
//
EXPORT_C const TPtrC8 CUpnpDevice::DescriptionUrlPath() const
{
const TDesC8& url = DescriptionUrl();
if ( url.Length()> KHttp().Length() )
{
TPtrC8 addrAndPath = url.Right( url.Length() - KHttp().Length() );
TInt index = addrAndPath.Find( KSlash8() );
if ( index != KErrNotFound )
{
TPtrC8 addr = addrAndPath.Right( addrAndPath.Length() - index );
return addr;
}
}
return TPtrC8( KNullDesC8 );
}
示例10: 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 );
}
}
}
示例11: pos
void CSatNotifySendSs::CheckCallForwarding
(
TPtrC8 aSource,
RSat::TSsString& aSsString
)
{
OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDSS_CHECKCALLFORWARDING_1, "CSAT:: CSatNotifySendSs::CheckCallForwarding");
_LIT8(KCFU,"*21*"); // Call forwarding unconditional (CFU)
_LIT8(KCFB,"*67*"); // Call forwarding on Mobile Subscriber Busy(CFB)
_LIT8(KCFNRy, "*61*"); // Call forwarding on No Reply (CFNRy)
_LIT8(KCFNRc, "*62*"); // Call forwarding on Mobile Subscriber Not
// Reachable (CFNRc)
// Try to find call forwarding string
TInt pos( aSource.Find( KCFU ) );
if ( KErrNotFound == pos )
{
pos = aSource.Find( KCFB );
}
if ( KErrNotFound == pos )
{
pos = aSource.Find( KCFNRy );
}
if ( KErrNotFound == pos )
{
pos = aSource.Find( KCFNRc );
}
if ( KErrNotFound != pos )
{
OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDSS_CHECKCALLFORWARDING_2, "CSAT:: CSatNotifySendSs::CheckCallForwarding, String is for call forwarding");
aSsString.iSsString.Zero();
aSsString.iSsString.Append( aSource.Left( pos + 4 ) );
aSsString.iSsString.Append( KPlusMarkCharacterCode );
aSsString.iSsString.Append(
aSource.Right( aSource.Length() - ( pos + 4) ) );
}
}
示例12: CMTResponseFirstLineL
// ---------------------------------------------------------------------------
// CAtSmsReceive::CMTResponseFirstLineL
// other items were commented in a header
// ---------------------------------------------------------------------------
void CAtSmsReceive::CMTResponseFirstLineL()
{
LOGTEXT(_L8("CAtSmsReceive::CMTResponseFirstLineL Enter funciton"));
iError = KErrNone;
TPtrC8 firstLineBuf;
firstLineBuf.Set(Buffer());
TInt pos = firstLineBuf.FindF(KCMTResponseString);
if (pos == KErrNotFound)
{
LOGTEXT(_L8("CAtSmsReceive::CMTResponseFirstLineL()\tError - Cannot find '+CMT:' string"));
iError = KErrNotFound;
return;
}
//skip the string of +CMT:
pos += KCMTResponseString().Length();
//skip a "," character
while(!(TChar(firstLineBuf[pos]).IsDigit()))
{
++pos;
}
TInt lenPos = firstLineBuf.Length()-pos;
TPtrC8 pduLenBuf;
pduLenBuf.Set(firstLineBuf.Right(lenPos));
TLex8 lex(pduLenBuf);
TUint16 val;
TInt ret = lex.Val(val,EDecimal);
if(ret != KErrNone)
{
iError = ret;
return;
}
iPduLen = val;
LOGTEXT2(_L8("New SMS detected of length %d"),iPduLen);
}
示例13: SendHeadersL
// ---------------------------------------------------------------------------
// CUpnpHttpFileTransferWriter::StartL
// Sends the HTTP headers of the content
// ---------------------------------------------------------------------------
//
void CUpnpHttpFileTransferWriter::SendHeadersL()
{
if(iState == EHeaders)
if( iSession.FileAccess() )
if(!IsActive())
{
//in case session not connected,waiting...
if(!iSession.IsConnected())
{
iWaiting = ETrue;
return;
}
iSendBuffer.Zero();
if ( ( iSession.FileAccess()->GetHeaders().Length() -
iSession.FileAccess()->TransferredBytes()) <=
iSendBuffer.MaxLength() )
{
TPtrC8 headerPointer;
headerPointer.Set(iSession.FileAccess()->GetHeaders());
headerPointer.Set( headerPointer.Right(
iSession.FileAccess()->GetHeaders().Length()-
iSession.FileAccess()->TransferredBytes()) );
iSendBuffer.Append( headerPointer );
iSession.FileAccess()->SetHeadersSent();
// Adding file content to the header
TInt length = iSendBuffer.MaxLength()-iSendBuffer.Length();
HBufC8* tmpBuffer = HBufC8::NewLC(length);
iSendPointer.Set(tmpBuffer->Des());
if( iSession.FileAccess()->GetL(iSendPointer,length) )
{
iState = EFinished;
}
iSendBuffer.Append(iSendPointer);
CleanupStack::PopAndDestroy( tmpBuffer );
}
else
{
TPtrC8 headerPointer;
headerPointer.Set( iSession.FileAccess()->GetHeaders() );
headerPointer.Set( headerPointer.Right(
iSession.FileAccess()->GetHeaders().Length() -
iSession.FileAccess()->TransferredBytes() ) );
headerPointer.Set( headerPointer.Left(
iSendBuffer.Length() ) );
iSendBuffer.Append( headerPointer );
iSession.FileAccess()->SetPosOfHeader(
iSession.FileAccess()->TransferredBytes() + headerPointer.Length() );
}
iSendPointer.Set((TUint8*)iSendBuffer.Ptr(),iSendBuffer.Length(),iSendBuffer.MaxLength());
iSession.TimerCancel();
WriteToSocket();
iSession.StartTimeoutTimer(ETrue);
if(!iHttpPostStarted)
{
iSession.NotifyUpperLayersOnPostL();
iHttpPostStarted = ETrue;
}
}
}
示例14: ParseL
// ---------------------------------------------------------------------------
// CNSmlDmACLParser::ParseL()
// Parses ACL data and keeps data until Reset() is called or instance
// is destructed
// ---------------------------------------------------------------------------
TInt CNSmlDmACLParser::ParseL(const TDesC8& aACL)
{
Reset();
for(TInt i=EAclExecute;i>=EAclAdd;i--)
{
TInt aclStart = 0;
TBool found=EFalse;
switch(i)
{
case EAclAdd:
aclStart = aACL.Find(KNSmlDmAclAddEqual);
found = aclStart>=0;
aclStart=aclStart+KNSmlDmAclAddEqual().Length();
break;
case EAclReplace:
aclStart = aACL.Find(KNSmlDmAclReplaceEqual);
found = aclStart>=0;
aclStart=aclStart+KNSmlDmAclReplaceEqual().Length();
break;
case EAclDelete:
aclStart = aACL.Find(KNSmlDmAclDeleteEqual);
found = aclStart>=0;
aclStart=aclStart+KNSmlDmAclDeleteEqual().Length();
break;
case EAclGet:
aclStart = aACL.Find(KNSmlDmAclGetEqual);
found = aclStart>=0;
aclStart=aclStart+KNSmlDmAclGetEqual().Length();
break;
case EAclExecute:
aclStart = aACL.Find(KNSmlDmAclExecEqual);
found = aclStart>=0;
aclStart=aclStart+KNSmlDmAclExecEqual().Length();
break;
default:
User::Panic(KSmlDmTreeDbHandlerPanic,KErrArgument);
break;
}
if(found)
{
TInt aclStop = aACL.Right(aACL.Length()-aclStart).
Locate(KNSmlDMAclCommandSeparator);
if(aclStop<0)
{
aclStop = aACL.Length()-aclStart;
}
TPtrC8 commandAcl = aACL.Mid(aclStart,aclStop);
CNSmlAclElement* aclElement = new(ELeave) CNSmlAclElement();
aclElement->iCommandType = (TNSmlDmCmdType)i;
aclElement->iNext = iCommandAcls;
iCommandAcls=aclElement;
if(commandAcl.Compare(KNSmlDmAclAll)==0)
{
aclElement->iAllServers=ETrue;
}
else
{
TBool end = EFalse;
TInt serverIdStart=0;
while(!end)
{
TPtrC8 serverIdPtr =
commandAcl.Right(commandAcl.Length()-serverIdStart);
TInt serverIdStop =
serverIdPtr.Locate(KNSmlDMAclSeparator);
if(serverIdStop == KErrNotFound)
{
serverIdStop=commandAcl.Length();
end=ETrue;
}
HBufC8* serverId =
serverIdPtr.Left(serverIdStop).AllocL();
aclElement->iServerIds.AppendL(serverId);
serverIdStart=serverIdStart+serverIdStop+1;
}
}
}
}
return KErrNone;
}
示例15: HandleNotifyL
// Parses Ecmt packets
void CEcmtMidpDebugPlugin::HandleNotifyL(const CEcmtMessageEvent& aEvent)
{
static const TInt KMinMsgSize[] = {
0,
ECMT_MIDP_DEBUG_OPEN_SIZE,
ECMT_MIDP_DEBUG_CLOSE_SIZE,
ECMT_MIDP_DEBUG_SEND_MIN_SIZE,
ECMT_MIDP_DEBUG_CONNECT_SIZE,
ECMT_MIDP_DEBUG_RESET_SIZE
};
static const TInt KMaxMsgSize[] = {
0,
ECMT_MIDP_DEBUG_OPEN_SIZE,
ECMT_MIDP_DEBUG_CLOSE_SIZE,
ECMT_MIDP_DEBUG_SEND_MAX_SIZE,
ECMT_MIDP_DEBUG_CONNECT_SIZE,
ECMT_MIDP_DEBUG_RESET_SIZE
};
const TPtrC8 msg = iMessaging->Message(aEvent);
TInt msglen = msg.Length();
if (msglen >= ECMT_MIDP_DEBUG_HEADER_SIZE)
{
// Decode the header
TUint opcode = msg[ECMT_MIDP_DEBUG_HEADER_OPCODE_OFFSET];
TUint sid = (msg[ECMT_MIDP_DEBUG_HEADER_SID_OFFSET] << 24) |
(msg[ECMT_MIDP_DEBUG_HEADER_SID_OFFSET+1] << 16) |
(msg[ECMT_MIDP_DEBUG_HEADER_SID_OFFSET+2] << 8) |
(msg[ECMT_MIDP_DEBUG_HEADER_SID_OFFSET+3]);
// Check opcode
if (opcode < ECMT_MIDP_DEBUG_OPCODE_MIN ||
opcode > ECMT_MIDP_DEBUG_OPCODE_MAX)
{
TRACE1("invalid opcode: %u",opcode);
return;
}
// Check message size
if (msglen < KMinMsgSize[opcode] ||
msglen > KMaxMsgSize[opcode])
{
TRACE2("opcode %u, invalid message size %u",opcode,msglen);
return;
}
// Try to find existing session
TInt index = -1;
CEcmtMidpDebugSession* session = FindSession(sid, index);
switch (opcode) {
case ECMT_MIDP_DEBUG_OPCODE_OPEN:
if (session)
{
TRACE2("OPEN: destroying session %08X (%d)",session,sid);
delete session;
iSessions.Remove(index);
}
session = CEcmtMidpDebugSession::NewL(sid,this,iMessaging);
CleanupStack::PushL(session);
LEAVE_IF_ERROR(iSessions.Append(session));
CleanupStack::Pop(session);
TRACE2("OPEN: created new session %08X (%u)",session,sid);
break;
case ECMT_MIDP_DEBUG_OPCODE_CLOSE:
if (session)
{
TRACE2("CLOSE: destroying session %08X (%u)",session,sid);
delete session;
iSessions.Remove(index);
}
else
{
TRACE1("CLOSE: no such session: %u",sid);
}
break;
case ECMT_MIDP_DEBUG_OPCODE_SEND:
if (session)
{
TUint cid = (msg[ECMT_MIDP_DEBUG_SEND_CID_OFFSET] << 24) |
(msg[ECMT_MIDP_DEBUG_SEND_CID_OFFSET+1] << 16) |
(msg[ECMT_MIDP_DEBUG_SEND_CID_OFFSET+2] << 8) |
(msg[ECMT_MIDP_DEBUG_SEND_CID_OFFSET+3]);
TUint seq = (msg[ECMT_MIDP_DEBUG_SEND_SEQ_OFFSET] << 24) |
(msg[ECMT_MIDP_DEBUG_SEND_SEQ_OFFSET+1] << 16) |
(msg[ECMT_MIDP_DEBUG_SEND_SEQ_OFFSET+2] << 8) |
(msg[ECMT_MIDP_DEBUG_SEND_SEQ_OFFSET+3]);
session->Send(cid, seq,
msg.Right(msglen - ECMT_MIDP_DEBUG_SEND_DATA_OFFSET));
}
else
{
// Tell the other side that this session id is invalid
TRACE1("SEND: invalid sid %u",sid);
SendSessionCloseMessage(sid);
}
break;
//.........这里部分代码省略.........