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

📄 noteinfo.cpp

📁 个人手机助理套件:包含1、记事本(备忘录)、名片夹、名片夹的上传下载(异地备份)、短消息模块
💻 CPP
字号:
// NoteInfo.cpp: implementation of the CNoteInfo class.
//
//////////////////////////////////////////////////////////////////////

#include "Noteinfo.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
#define  DELPTR(p) if(p!=NULL){ delete p;p=NULL;}
CNoteInfo::CNoteInfo()
{
m_bufTitle = NULL;
m_bufContent = NULL;
}

CNoteInfo::~CNoteInfo()
{
// 	DELPTR(m_bufTitle);
// 	DELPTR(m_bufContent);
}
void CNoteInfo::Delete()
{
	DELPTR(m_bufTitle);
	DELPTR(m_bufContent);
}
void CNoteInfo::SetTitle( TDes &aTitle )
{
	if(m_bufTitle!= NULL)
	{
		delete m_bufTitle;
		m_bufTitle = NULL;
	}
	TInt nlength = aTitle.Length();
	m_bufTitle = HBufC::NewL(nlength);
	m_bufTitle->Des().Copy(aTitle);
}

void CNoteInfo::SetContent( TDes &aContent )
{
	if(m_bufContent!= NULL)
	{
		delete m_bufContent;
		m_bufContent = NULL;
	}
	TInt nlength = aContent.Length();
	if(nlength)
	{
		m_bufContent = HBufC::NewL(nlength);
		m_bufContent->Des().Copy(aContent);
	}

}
	
void  CNoteInfo::GetTitle( TDes& aTitle )
{
	aTitle.Copy( *m_bufTitle);
}

void  CNoteInfo::GetContent( TDes& aContent )
{
	aContent.Copy( *m_bufContent);
}

TDesC& CNoteInfo::GetNoteTitle() const
{
	return *m_bufTitle;
}
TDesC& CNoteInfo::GetNoteContent() const
{
	return *m_bufContent;

}

void CNoteInfo::ExternalizeL(RWriteStream& aStream)
{
	if(NULL != m_bufTitle)
	{
		aStream.WriteInt32L(m_bufTitle->Length());
		aStream << m_bufTitle->Des();
	}
	else
	{
		aStream.WriteInt32L(0);
	}
	
	if(NULL != m_bufContent)
	{
		aStream.WriteInt32L(m_bufContent->Length());
		aStream << m_bufContent->Des();
	}
	else
	{
		aStream.WriteInt32L(0);
	}
}

void CNoteInfo::InternalizeL(RReadStream& aStream)
{
	TInt32 nLength = aStream.ReadInt32L();
	if(nLength > 0)
	{
		DELPTR(m_bufTitle);
		m_bufTitle = HBufC::NewL(nLength);
		TPtr16 ptr16 = m_bufTitle->Des();
		aStream >> ptr16;
	//	DELPTR(m_bufTitle);
	}	
	nLength = aStream.ReadInt32L();
	if(nLength > 0)
	{
		DELPTR(m_bufContent);
		m_bufContent = HBufC::NewL(nLength);
		TPtr16 ptr16 = m_bufContent->Des();
		aStream >> ptr16;
	}
}

⌨️ 快捷键说明

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