forked from videoP/jaPRO
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathComment.cpp
76 lines (65 loc) · 955 Bytes
/
Comment.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// Comment.cpp
#include "StdAfx.h"
#include "Includes.h"
CComment::CComment()
{
}
CComment::~CComment()
{
}
void CComment::Delete()
{
if (m_comment != NULL)
{
free(m_comment);
m_comment = NULL;
}
delete this;
}
CComment* CComment::Create(LPCTSTR comment)
{
CComment* retval = new CComment();
retval->Init(comment);
return retval;
}
void CComment::SetComment(LPCTSTR comment)
{
if (m_comment != NULL)
{
free(m_comment);
}
if (comment == NULL)
{
m_comment = NULL;
}
else
{
m_comment = (char*)malloc(strlen(comment) + 1);
strcpy(m_comment, comment);
}
}
LPCTSTR CComment::GetComment()
{
return m_comment;
}
void CComment::SetNext(CComment* next)
{
m_next = next;
}
CComment* CComment::GetNext()
{
return m_next;
}
void CComment::Init(LPCTSTR comment)
{
m_next = NULL;
m_comment = NULL;
SetComment(comment);
}
void CComment::Write(CTxtFile* file)
{
if (m_comment != NULL)
{
file->WriteComment(m_comment);
}
}