📄 noteinfo.cpp
字号:
#include "NoteInfo.h"
CNoteInfo::CNoteInfo()
{
m_pDate = NULL;
m_pTitle = NULL;
m_pContent = NULL;
}
CNoteInfo::~CNoteInfo()
{
MEMORY_FREE(m_pDate);
MEMORY_FREE(m_pTitle);
MEMORY_FREE(m_pContent);
}
void CNoteInfo::SetDate(const TDesC& aDate)
{
MEMORY_FREE(m_pDate);
m_pDate = HBufC::NewLC(aDate.Length());
m_pDate->Des().Copy(aDate);
CleanupStack::Pop();
}
HBufC* CNoteInfo::GetDate()
{
return m_pDate;
}
void CNoteInfo::SetTitle(const TDesC& aTitle)
{
MEMORY_FREE(m_pTitle);
m_pTitle = HBufC::NewLC(aTitle.Length());
m_pTitle->Des().Copy(aTitle);
CleanupStack::Pop();
}
HBufC* CNoteInfo::GetTitle()
{
return m_pTitle;
}
void CNoteInfo::SetContent(const TDesC& aContent)
{
MEMORY_FREE(m_pContent);
m_pContent = HBufC::NewLC(aContent.Length());
m_pContent->Des().Copy(aContent);
CleanupStack::Pop();
}
HBufC* CNoteInfo::GetContent()
{
return m_pContent;
}
void CNoteInfo::InternalizeL(RReadStream& aReadStream)
{
TInt nLen;
nLen = aReadStream.ReadInt32L();
if(nLen > 0)
{
MEMORY_FREE(m_pDate);
m_pDate = HBufC::NewLC(nLen);
aReadStream >> m_pDate->Des();
CleanupStack::Pop();
}
nLen = aReadStream.ReadInt32L();
if(nLen > 0)
{
MEMORY_FREE(m_pTitle);
m_pTitle = HBufC::NewLC(nLen);
aReadStream >> m_pTitle->Des();
CleanupStack::Pop();
}
nLen = aReadStream.ReadInt32L();
if(nLen > 0)
{
MEMORY_FREE(m_pContent);
m_pContent = HBufC::NewLC(nLen);
aReadStream >> m_pContent->Des();
CleanupStack::Pop();
}
}
void CNoteInfo::ExternalizeL(RWriteStream& aWriteStream)
{
if(m_pDate)
{
aWriteStream.WriteInt32L(m_pDate->Length());
aWriteStream << m_pDate->Des();
}
else
{
aWriteStream.WriteInt32L(0);
}
if(m_pTitle)
{
aWriteStream.WriteInt32L(m_pTitle->Length());
aWriteStream << m_pTitle->Des();
}
else
{
aWriteStream.WriteInt32L(0);
}
if(m_pContent)
{
aWriteStream.WriteInt32L(m_pContent->Length());
aWriteStream << m_pContent->Des();
}
else
{
aWriteStream.WriteInt32L(0);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -