|
#include "StdAfx.h"
#include "Comment.h"
using namespace Elmax;
Comment::Comment(void)
: m_ptrComment(NULL)
{
}
Comment::~Comment(void)
{
}
std::wstring Comment::GetContent() const
{
if(!m_ptrComment)
throw std::exception("Invalid comment object");
std::wstring comment = (LPCWSTR)(m_ptrComment->data);
return comment;
}
long Comment::GetLength() const
{
if(!m_ptrComment)
throw std::exception("Invalid comment object");
return m_ptrComment->length;
}
bool Comment::Delete()
{
if(!m_ptrComment)
throw std::exception("Invalid comment object");
MSXML2::IXMLDOMNodePtr parent = m_ptrComment->GetparentNode();
if(parent)
{
m_ptrComment = parent->removeChild(m_ptrComment);
}
else
return false;
return true;
}
bool Comment::Update(const std::wstring& data)
{
if(!m_ptrComment)
throw std::exception("Invalid comment");
HRESULT hr = m_ptrComment->replaceData(0, data.length(), data.c_str());
return SUCCEEDED(hr);
}
bool Comment::IsValid()
{
if(!m_ptrComment)
return false;
return true;
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Shao Voon is from Singapore. His interest lies primarily in computer graphics, software optimization, concurrency, security, and Agile methodologies.
In recent years, he shifted focus to software safety research. His hobby is writing a free C++ DirectX photo slideshow application which can be viewed
here.