当前位置: 首页>>代码示例>>C++>>正文


C++ TPtrC8::Set方法代码示例

本文整理汇总了C++中TPtrC8::Set方法的典型用法代码示例。如果您正苦于以下问题:C++ TPtrC8::Set方法的具体用法?C++ TPtrC8::Set怎么用?C++ TPtrC8::Set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TPtrC8的用法示例。


在下文中一共展示了TPtrC8::Set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetNextData

/**
 Retrieve the EIR data for the next Data Type 
 @param aOffset Offset to current data type (0 to start traversing)
 @param aDes Pointer descriptor that will point to the EIR data for the Data Type requested if successful 
 (please note this does not contain the Data Type byte) 
 @return TExtendedInquiryResponseDataType (TExtendedInquiryResponseDataType::EEirInvalid means there is no more eir data to get)
 @internalTechnology
 */
EXPORT_C TExtendedInquiryResponseDataType TExtendedInquiryResponseDataCodec::GetNextData(TPtrC8& aDes)
	{
	LOG_FUNC
	TExtendedInquiryResponseDataType dataType;
	iOffset = NextDataType(iOffset);

	if(iOffset >= KErrNone && iEir.Length() >= (iOffset +iEir[iOffset - KEIRLengthToTagOffset]))
		{
		aDes.Set(iEir.Mid(iOffset + KEIRTagToDataOffset, iEir[iOffset-KEIRLengthToTagOffset] - KEIRLengthToTagOffset));
		dataType = static_cast<TExtendedInquiryResponseDataType>(iEir[iOffset]);
		}
	else
		{
		// Data must be malformed or corrupted
		dataType = EEirInvalid;
		}

	return dataType;
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:27,代码来源:eirdatacodec.cpp

示例2: FindZoneL

CTzDbZone* CTzDbLinksTable::FindZoneL(const TDesC8& aLinkName)
	{
	const TInt KLinkCount = iPersistedEntity.iNumberOfLinks;
	TPtrC8 name;
	TTzLink* link(NULL);
	TInt linkAddress = reinterpret_cast<TInt>(&iPersistedEntity) + sizeof(iPersistedEntity.iNumberOfLinks);
	for (TInt i = 0; i < KLinkCount; i++, linkAddress += sizeof(TTzLink))
		{
		link = reinterpret_cast<TTzLink*>(linkAddress);
		name.Set(iReadOnlyTzDb.GetStringL(link->iOffsetToLinkName));
		if (!name.CompareC(aLinkName))
			{ // we found our link
			return iReadOnlyTzDb.GetZoneL(link->iOffsetToZone);
			}
		}

	// if it gets here, it means that the zone has not been found
	return NULL;
	}
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:19,代码来源:tzdbentities.cpp

示例3: RunL

void CDebugRouterClient::RunL()
	{
	TUint chunkSize = iSharedChunk.Size();
	const TUint KDataStartOffset = sizeof(SDebugChunkHeader);
	SDebugChunkHeader* chunkHeader = (SDebugChunkHeader*)iSharedChunk.Base();
	TUint start = chunkHeader->iStartOffset;
	TUint end = chunkHeader->iEndOffset;
	TUint overflows = chunkHeader->iOverflows;

	TBool wrap = (start > end);
	TUint endLen = wrap ? chunkSize - start : end - start;
	TUint startLen = wrap ? end - KDataStartOffset : 0;

	TPtrC8 endData(iSharedChunk.Base() + start, endLen);
	TPtrC8 startData;
	if (wrap) startData.Set(iSharedChunk.Base() + KDataStartOffset, startLen);
	TPtrC8 data(endData);

	while (data.Length())
		{
		TPtrC8 header = Read(iTempBuf, data, sizeof(SCloggerTraceInfo), startData);
		if (header.Length() < (TInt)sizeof(SCloggerTraceInfo))
			{
			ASSERT(EFalse); // for udeb
			break; // Something's broken
			}
		SCloggerTraceInfo info;
		Mem::Copy(&info, header.Ptr(), sizeof(SCloggerTraceInfo));
		ASSERT(info.iTraceType == 'K' || info.iTraceType == 'U' || info.iTraceType == 'P');
		TPtrC8 msg = Read(iTempBuf, data, info.iLength, startData);
		iServer.LogKernMessage(info.iTraceType, info.iTickCount, info.iThreadId, msg);
		}
	if (overflows)
		{
		_LIT8(KErr, "RDebug::Print buffer overflowed, %u calls not logged");
		iServer.LogError(KErr, overflows);
		}
	// Zero the memory so it's easier to read in the crashlog
	memclr(iSharedChunk.Base() + start, endLen);
	if (startLen) memclr(iSharedChunk.Base() + KDataStartOffset, startLen);
	
	StartRouting(-1); // Magic number to indicate no need to call EnableDebugRouting again
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:43,代码来源:MiscServer.cpp

示例4: CountSeparators

TInt CExampleCookieManager::CountSeparators(const TDesC8& aDes)
	{
	const TChar pathSeparator('/');
	TInt numSeps = 0;

	// Get all the descriptor to start with
	TPtrC8 desPtr = aDes.Mid(0);
	TInt sepPos = desPtr.Locate(pathSeparator);
	while(sepPos != KErrNotFound)
		{
		++numSeps;

		// Get the rest of the descriptor without the separator that we have found
		desPtr.Set(desPtr.Mid(sepPos + 1));
		sepPos = desPtr.Locate(pathSeparator);
		}

	return numSeps;
	}
开发者ID:kuailexs,项目名称:symbiandump-mw2,代码行数:19,代码来源:examplecookiemanager.cpp

示例5: AddInfoFromNotificationTypeHeaderL

// -----------------------------------------------------------------------------
// CUpnpDeviceLibraryElement::AddInfoFromNotificationTypeHeaderL
//
// Supported NT (Notification Type) messages:
// "uuid:"                         (length: 5 )
// "upnp:rootdevice"               (length: 15)
// "urn:schemas-upnp-org:device:"  (length: 28)
// "urn:schemas-upnp-org:service:" (length: 29)
// -----------------------------------------------------------------------------
//
TBool CUpnpDeviceLibraryElement::AddInfoFromNotificationTypeHeaderL(
    CUpnpSsdpMessage* aMessage )
    {
    TPtrC8 nt = aMessage->St( );

    if ( nt.Length( ) == 0 )
        {
        nt.Set( aMessage->Nt( ) );
        }

    if ( HasPrefix( nt, KUPnPUuid ) )
        {
        // an uuid advertisement
        return ETrue;
        }

    if ( iDeviceType->Length( ) == 0 )
        {
        if ( nt == KUPnPRootDevice )
            {
            // a root device advertisement
            SetDeviceTypeL( nt );
            return ETrue;
            }

        if ( HasPrefix( nt, KUPnPDeviceSchema ) )
            {
            // a device advertisement
            SetDeviceTypeL( nt );
            return ETrue;
            }
        }

    if ( HasPrefix( nt, KUPnPServiceSchema ) )
        {
        // a service advertisement
        AddServiceTypeL( nt );
        return ETrue;
        }

    return EFalse;
    }
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:52,代码来源:upnpdevicelibraryelement.cpp

示例6: CheckBuf

TInt TMetaVarLenBase::CheckBuf( TPtrC8& aBuffer )
	{
	// Check if the descriptor is long enough
	if (aBuffer.Length() < (TInt)sizeof(TUint32))
		{
		return KErrArgument;
		}
	
	// Check if the descriptor is long enough
    TBuf8<sizeof(TUint32)> lenSubBuf;
    lenSubBuf.Copy(aBuffer.Ptr(), sizeof(TUint32));
    TUint length = *((TUint32*)lenSubBuf.Ptr());	
	if (aBuffer.Length() < (TInt)length)
		{
		return KErrArgument;
		}

	aBuffer.Set(aBuffer.Ptr() + sizeof(TUint32), aBuffer.Length() - sizeof(TUint32)); //update pointer
	return length;
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:20,代码来源:MetaType.cpp

示例7: size

/**
   @SYMTestCaseID T-RApaLsSessionTestStep-TestServiceDiscovery7L
  
   @SYMPREQ 538
  
   @SYMTestCaseDesc Given the size of data that is returned from the server is greater than the default 
   1024 bytes of the buffer, test if a larger buffer is assigned in such cases
   
   @SYMTestPriority 
  
   @SYMTestStatus Implemented
   
   @SYMTestActions Call GetAppServicesLC with the app uid as parameter. The size of the resource data in 
   the registration file should be greater than the default size.
   on z: drive.\n
   API Calls:\n	
   RApaLsSession::GetAppServicesLC(TUid aAppUid) const
   
   @SYMTestExpectedResults A larger buffer is allocated. The size of the buffer can be tested by checking 
   the size of the returned data.
    
 */
void CT_ServicesTestStep::TestServiceDiscovery7L()
	{
	INFO_PRINTF1(_L("TestServiceDiscovery7 about to start..."));
	const TUid KUidServerApp = {0x10004c57};
	// get all services for a particular app
	CApaAppServiceInfoArray* array = iApaLsSession.GetAppServicesLC(KUidServerApp);
	TArray<TApaAppServiceInfo> serviceArray(array->Array());
	TInt count = serviceArray.Count();
	TEST(count == 16);
	TPtrC8 opaqueData;
	TInt size(0);
	for(TInt i=0;i<count;i++)
		{
			opaqueData.Set(serviceArray[i].OpaqueData());
			size +=opaqueData.Length(); 
		}
	TEST(size>=1024);
	CleanupStack::PopAndDestroy(array); // the servicearray	
	array = NULL;
	}
开发者ID:fedor4ever,项目名称:default,代码行数:42,代码来源:T_ServicesStep.cpp

示例8: GetData

/**
 Retrieve the EIR data for a particular Data Type 
 @param aDataType Data Type to look for
 @param aDes Pointer descriptor that will point to the EIR data for the Data Type requested if successful 
 (please note this does not contain the Data Type byte) 
 @return an error code
 @internalTechnology
 */
EXPORT_C TInt TExtendedInquiryResponseDataCodec::GetData(TExtendedInquiryResponseDataType aDataType, TPtrC8& aDes) const
	{
	LOG_FUNC
	TInt offset = NextDataType(0);

	while(offset >= KErrNone)
		{
		if(iEir[offset] == aDataType)
			{
			aDes.Set(iEir.Mid(offset + KEIRTagToDataOffset, iEir[offset - KEIRLengthToTagOffset] - KEIRLengthToTagOffset));
			return KErrNone;
			}
		else
			{
			offset = NextDataType(offset);
			}
		}

	return offset;
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:28,代码来源:eirdatacodec.cpp

示例9: CreateSignatureL

HBufC8* CmsUtils::CreateSignatureL(const TDesC8& aDataToBeSigned, TBool aIsHash, TAlgorithmId aAlgorithm, const CDSAPrivateKey& aKey)
	{
	HBufC8* signature(NULL);
	
	if (!aIsHash)
		{
		TPtrC8 hashValue;
		// Create hash first
		CMessageDigest* hash=CreateHashLC(aAlgorithm);
		hashValue.Set(hash->Hash(aDataToBeSigned));
		signature=CreateSignatureL(hashValue, aKey);
		CleanupStack::PopAndDestroy(); // hash
		}
	else
		{
		signature=CreateSignatureL(aDataToBeSigned, aKey);
		}
		
	return signature;
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:20,代码来源:cmsutils.cpp

示例10: FindRegionL

//
// Looks for a region given its name.
// Returns the region wrapped in a CTzDbRegion object.
// Returns NULL if region is not found
//
CTzDbRegion* CTzDbRegionsTable::FindRegionL(const TDesC8& aRegionName)
	{
	const TInt KRegionCount = iPersistedEntity.iNumberOfRegions;
	TTzRegion* region(NULL);
	TPtrC8 name;
	TInt regionAddress = reinterpret_cast<TInt>(&iPersistedEntity) + sizeof(iPersistedEntity.iNumberOfRegions);
	for (TInt i = 0; i < KRegionCount; i++, regionAddress += sizeof(TTzRegion))
		{
		region = reinterpret_cast<TTzRegion*>(regionAddress);
		name.Set(iReadOnlyTzDb.GetStringL(region->iOffsetToRegionName));

		// compare both strings
		if (aRegionName.Compare(name) == 0) // found our region
			{
			return CTzDbRegion::NewL(iReadOnlyTzDb,*region);
			}
		}

	// if it gets here, it means that the region has not been found
	return NULL;
	}
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:26,代码来源:tzdbentities.cpp

示例11: val

/**
   @SYMTestCaseID T-RApaLsSessionTestStep-TestServiceDiscovery17L
  
   @SYMPREQ 538
  
   @SYMTestCaseDesc Test the functionality of GetAppServicesLC on a app that has a localised 
   resource defined in the registration file
  
   @SYMTestStatus Implemented

   @SYMTestPriority  High
   
   @SYMTestActions  Call GetAppServicesLC with the app uid as parameter
   on z: drive.\n
   API Calls:\n	
   RApaLsSession::GetAppServicesLC(TUid aAppUid) const
   
   @SYMTestExpectedResults Returns an array of TApaAppServiceInfo objects. 
   Each TApaAppServiceInfo contains details about a service uid and corresponding opaque data. 
   The returned data should be the same as that defined in the registration files.
    
 */
void CT_ServicesTestStep::TestServiceDiscovery17L() 
	{
	INFO_PRINTF1(_L("TestServiceDiscovery17 about to start..."));
	const TUid KUidService1235 = {0x01020305};
	const TUid KUidServerApp = {0x10004c55};
	CApaAppServiceInfoArray* array = iApaLsSession.GetAppServicesLC(KUidServerApp);
	TArray<TApaAppServiceInfo> serviceArray(array->Array());
	TInt count = serviceArray.Count();
	TEST(count == 1);
	TPtrC8 opaqueData;
	TResourceReader reader;
	TPtrC16 theText;
	TInt val(0);
	_LIT(KSecondService,"Localised text for service UID 0x01020305");
	TEST(serviceArray[0].Uid()==KUidService1235);
	opaqueData.Set(serviceArray[0].OpaqueData());
	reader.SetBuffer(&opaqueData);
	theText.Set(reader.ReadTPtrC16());
	User::LeaveIfError(val=theText.Compare(KSecondService));
	TEST(val==KErrNone);
	CleanupStack::PopAndDestroy(array); // the servicearray
	}
开发者ID:fedor4ever,项目名称:default,代码行数:44,代码来源:T_ServicesStep.cpp

示例12: ReadLine

TInt CKeytoolFileView::ReadLine(const TDesC8& aBuffer, TInt& aPos, TPtrC8& aLine)
	{
	TBool endOfBuffer = EFalse;
	const TChar KCarriageReturn = '\r';
	const TChar KLineReturn = '\n';

	TInt bufferLength = aBuffer.Length();
	if ( aPos > bufferLength || aPos < 0 )
		{	
		return ETrue; // End of buffer
		}
		
	// find the position of the next delimter		
	TInt endPos = aPos;	
	while (endPos < bufferLength)
		{
		TChar c = aBuffer[endPos];

		if (c == KCarriageReturn || c == KLineReturn) 
			{
			break;
			}	
		endPos++;
		}

	if (endPos != aPos)	
		{
		TInt tokenLen = endPos - aPos;
		aLine.Set(&aBuffer[aPos], tokenLen);
		endPos += 2;
		}
	else
		{
		return ETrue; // End of buffer
		}

	aPos = endPos;
	return endOfBuffer;
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:39,代码来源:keytoolfileview.cpp

示例13: FindAuthTypeL

// -----------------------------------------------------------------------------
// CSTSAccessControl::FindAuthTypeL
// Saves found authType to member variable, which will be returned
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
void CSTSAccessControl::FindAuthTypeL(TInt aPinID)
{

    CSTSAuthType* authType = NULL;
    TPtrC8 authIdPtr;

    //go through all authTypes in loop and find correct authId
    TInt authTypesCount = iAuthTypes->Count();
    TBool authTypeNotFound = ETrue;
    for (TInt x = 0; x < authTypesCount && authTypeNotFound; x++)
    {

        //points to array's object
        authType = iAuthTypes->At(x);

        //get CommonAuthenticationObjectAttributes.authID
        authIdPtr.Set(authType->AuthID());
        if (authIdPtr.Length() != 0)
        {

            if (authIdPtr[0] == aPinID) //first value can be compared to PinID
            {
                authTypeNotFound = EFalse;

                CSTSAuthType* tmp = CSTSAuthType::NewLC();
                tmp->CopyL(*authType);

                CleanupStack::Pop(tmp);
                delete iAuthType;
                iAuthType = tmp;
            }
        }
    }
    if (authTypeNotFound)
    {
        User::Leave(KSTSErrSecurity);
    }
}
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:44,代码来源:cstsaccesscontrol.cpp

示例14: SetSlPushMsgEntryFieldsL

/**
 *	Set SL entry fields prior to storing message.
 *	@param aSlPushMsgEntry
 *		entry represents message format to use when storing it
 */
void CSLContentHandler::SetSlPushMsgEntryFieldsL(CSLPushMsgEntry& aSlPushMsgEntry)
	{
	
	//set URL and Action fields
	aSlPushMsgEntry.SetUrlL(*iHrefBuf);
	aSlPushMsgEntry.SetAction(iPushMsgAction);
	
	// Set all the relevant header fields
	TPtrC8 msgHeaderPtr;
	iMessage->GetHeader(msgHeaderPtr);
	aSlPushMsgEntry.SetHeaderL(msgHeaderPtr); 

	TPtrC8 from;
	if (!iMessage->GetBinaryHeaderField(EHttpFrom,from) &&
		!iMessage->GetBinaryHeaderField(EHttpXWapInitiatorURI,from) &&
		!iMessage->GetBinaryHeaderField(EHttpContentLocation,from) )
		{
		from.Set(KNullDesC8);
		}
		aSlPushMsgEntry.SetFromL(from);
		
	if(iMessage->MessageAllowed())
		{
		aSlPushMsgEntry.SetTrusted(ETrue);
		}
	else
		{
		aSlPushMsgEntry.SetTrusted(EFalse);	
		}
		
	TPtrC8 serverAddress8;
	iMessage->GetServerAddress(serverAddress8);
	aSlPushMsgEntry.SetMsgOriginUriL(serverAddress8);
		
	TTime puchMsgDate;
	if(iMessage->GetHeaderField(EHttpDate, puchMsgDate))
		aSlPushMsgEntry.SetTimeSent(puchMsgDate );
	}
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:43,代码来源:CSLContentHandler.cpp

示例15: GetContentTypeValue

// --------------------------------------------------------------------------------------
// Verifies if container's parent node has xmlmime:contentType 
// attribute information item. If found, the function returns ETrue 
// and xmlmime:contentType attribute value. Otherwise, function
// returns EFalse and aContentType is undefined.
// --------------------------------------------------------------------------------------
//
TBool CXmlEngSerializerXOP::GetContentTypeValue(TXmlEngDataContainer aContainer, TPtrC8& aContentType)
	{
	_LIT8(KMimeNsUri, "http://www.w3.org/2004/11/xmlmime");
	_LIT8(KContentTypeName, "contentType");
	
	TXmlEngElement parent = aContainer.ParentNode().AsElement();
	if(parent.HasAttributes())
		{
		RXmlEngNodeList<TXmlEngAttr> attrList;
		parent.GetAttributes(attrList);
		for(TInt i = 0; i < attrList.Count(); i++)
			{
			TXmlEngAttr attr = attrList.Next();
			if(attr.Name().Compare(KContentTypeName) == 0 
				&& attr.NamespaceUri().Compare(KMimeNsUri) == 0)
				{
				aContentType.Set(attr.Value());
				return ETrue;
				}
			}
		}
	return EFalse;
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:30,代码来源:xmlengserializerxop.cpp


注:本文中的TPtrC8::Set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。