clientserver.cpp

来自「hercules v9 symbian os application devel」· C++ 代码 · 共 46 行

CPP
46
字号
//	client-server.cpp

#include "client-server.h"
#include <s32mem.h>

EXPORT_C CHerculesData* CHerculesData::NewLC(const TDesC8& aDes1, const TDesC8& aDes2, TInt aVal)
	{
	CHerculesData* data = new (ELeave)CHerculesData(aVal);
	CleanupStack::PushL(data);
	data->ConstructL(aDes1, aDes2);
	return (data);
	}

// Creates a CHerculesData initialized with the contents of the
// descriptor parameter
CHerculesData* CHerculesData::NewLC(const TDesC8& aStreamData)
	{
	CHerculesData* data = new (ELeave)CHerculesData();
	CleanupStack::PushL(data);
	
	// Open a read stream for the descriptor
	RDesReadStream stream(aStreamData);
	CleanupClosePushL(stream);
	data->InternalizeL(stream);
	CleanupStack::PopAndDestroy(&stream); // finished with the stream
	return (data);
	}


EXPORT_C CHerculesData::~CHerculesData()
	{
	delete iDes1;
	delete iDes2;
	}

CHerculesData::CHerculesData(TInt aVal)
:	iVal(aVal){}

void CHerculesData::ConstructL(const TDesC8& aDes1, const TDesC8& aDes2)
	{
	iDes1 = aDes1.AllocL();
	iDes2 = aDes2.AllocL();
	}

	
// Creates and returns a heap descriptor which holds contents of 抰his

⌨️ 快捷键说明

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