?? datagram.cpp
字號:
// Datagram.cpp
//
// Copyright (c) 2003 Symbian Ltd. All rights reserved.
//
// CDatagram (implementation)
#include "DatagramService.h"
EXPORT_C CDatagram* CDatagram::NewL(TDesC8& aBuf)
/**
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);
CleanupStack::Pop();
return self;
}
EXPORT_C CDatagram* CDatagram::NewL(const TDesC8& aBuf, const TDesC8& aAddress)
/**
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);
self->SetAddressL(aAddress);
CleanupStack::Pop();
return self;
}
EXPORT_C CDatagram::~CDatagram()
/**
Deletes internal HBufC8 buffers.
*/
{
delete iAddress;
delete iData;
}
void CDatagram::ConstructL(const TDesC8& aBuf)
/**
Second phase of construction.
@param aBuf external buffer.
*/
{
iData = aBuf.AllocL();
}
EXPORT_C const TDesC8& CDatagram::GetAddress()
/**
Accessor for the outgoing address information,
@returns reference to outgoing address.
*/
{
return *iAddress;
}
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 TDesC8& 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 TDesC8& 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 + -