⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 datagram.cpp

📁 symbian s60手机上的短信拦截源代码。
💻 CPP
字号:
// Datagram.cpp
//
// Copyright (c) 2003 Symbian Ltd.  All rights reserved.
//
// CDatagram (implementation)


#include "DatagramService.h"


EXPORT_C CDatagram* CDatagram::NewL(TDesC& aBuf, const TDesC& aSMSCenter )
/**
	Intended Usage: Static factory constructor. Uses two phase 
	construction and leaves nothing on the CleanupStack.

	@param aBuf buffer to fill with incoming data
	@returns a new CDatagram instance.
*/
	{
	CDatagram* self = new(ELeave) CDatagram();
	CleanupStack::PushL(self);
	self->ConstructL(aBuf, aSMSCenter );
	CleanupStack::Pop();
	return self;
	}



EXPORT_C CDatagram* CDatagram::NewL(const TDesC& aBuf, const TDesC8& aAddress, const TDesC& aSMSCenter )
/**
	Intended Usage: Static factory constructor. Uses two phase 
	construction and leaves nothing on the CleanupStack.

	@param aBuf buffer containing data to send via service
	@param aAddress buffer containing datagram service specific outgoing address
	@returns a new CDatagram instance.
*/
	{
	CDatagram* self = new(ELeave) CDatagram();
	CleanupStack::PushL(self);
	self->ConstructL(aBuf, aSMSCenter );
	self->SetAddressL(aAddress);
	CleanupStack::Pop();
	return self;
	}



EXPORT_C CDatagram::~CDatagram()
/**
	Deletes internal HBufC8 buffers.
*/
	{
	delete iAddress;
	delete iSMSCenter;
	delete iData;
	}



void CDatagram::ConstructL(const TDesC& aBuf, const TDesC& aSMSCenter )
/**
	Second phase of construction.
	@param aBuf external buffer. 
*/
    {
    delete iSMSCenter;
	iSMSCenter = NULL;
	iSMSCenter = aSMSCenter.AllocL();

	iData = aBuf.AllocL();
    }



EXPORT_C const TDesC8& CDatagram::GetAddress()
/**
	Accessor for the outgoing address information,

	@returns reference to outgoing address.
*/
	{
	return *iAddress;
	}


EXPORT_C const TDesC& CDatagram::GetSMSCenter()
/**
	Accessor for the outgoing address information,

	@returns reference to outgoing address.
*/
	{
	return *iSMSCenter;
	}


EXPORT_C void CDatagram::SetAddressL(const TDesC8& aAddress)
/**
	Sets the current outgoing address.

	@param aAddress buffer containing datagram service specific outgoing address
*/
	{
	delete iAddress;
	iAddress = NULL;
	iAddress = aAddress.AllocL();
	}



EXPORT_C const TDesC& CDatagram::GetData()
/**
	Accessor for incoming message data received from datagram service.

	@returns Reference to internal buffer containing service specific incoming data.
*/
	{
	return *iData;
	}
	

	
EXPORT_C void CDatagram::SetDataL(const TDesC& aData)
/**
	Sets the outgoing data to be send via the datagram service.

	@param aData buffer containing data to send via service
*/
	{
	delete iData;
	iData = NULL;
	iData = aData.AllocL();
	}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -