1/*
2 This file is part of KDE.
3
4 SPDX-FileCopyrightText: 2010 Intel Corporation
5 SPDX-FileContributor: Mateu Batle Sastre <mbatle@collabora.co.uk>
6
7 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
8*/
9
10#ifndef ATTICA_COMMENT_H
11#define ATTICA_COMMENT_H
12
13#include "attica_export.h"
14
15#include <QDateTime>
16#include <QSharedDataPointer>
17
18#include <QUrl>
19
20namespace Attica
21{
22
23/*!
24 * \class Attica::Comment
25 * \inheaderfile Attica/Comment
26 * \inmodule Attica
27 *
28 * \brief Represents a comment.
29 */
30class ATTICA_EXPORT Comment
31{
32public:
33 /*!
34 *
35 */
36 typedef QList<Comment> List;
37 class Parser;
38
39 /*!
40 * \value ContentComment
41 * \value ForumComment
42 * \value KnowledgeBaseComment
43 * \value EventComment
44 */
45 enum Type {
46 ContentComment,
47 ForumComment,
48 KnowledgeBaseComment,
49 EventComment,
50 };
51
52 /*!
53 *
54 */
55 static QString commentTypeToString(const Comment::Type type);
56
57 /*!
58 *
59 */
60 Comment();
61 Comment(const Comment &other);
62 Comment &operator=(const Comment &other);
63 ~Comment();
64
65 /*!
66 *
67 */
68 void setId(const QString &id);
69
70 /*!
71 *
72 */
73 QString id() const;
74
75 /*!
76 *
77 */
78 void setSubject(const QString &subject);
79
80 /*!
81 *
82 */
83 QString subject() const;
84
85 /*!
86 *
87 */
88 void setText(const QString &text);
89
90 /*!
91 *
92 */
93 QString text() const;
94
95 /*!
96 *
97 */
98 void setChildCount(const int childCount);
99
100 /*!
101 *
102 */
103 int childCount() const;
104
105 /*!
106 *
107 */
108 void setUser(const QString &user);
109
110 /*!
111 *
112 */
113 QString user() const;
114
115 /*!
116 *
117 */
118 void setDate(const QDateTime &date);
119
120 /*!
121 *
122 */
123 QDateTime date() const;
124
125 /*!
126 This is for internal usage, see Provider::setCommentScore to set scores in comments.
127
128 \a score average comment score in scale from 0 to 100
129 */
130 void setScore(const int score);
131 /*!
132 Returns score of this comment.
133
134 \a score average comment score in scale from 0 to 100
135 */
136 int score() const;
137
138 /*!
139 *
140 */
141 void setChildren(QList<Comment> comments);
142
143 /*!
144 *
145 */
146 QList<Comment> children() const;
147
148 /*!
149 *
150 */
151 bool isValid() const;
152
153private:
154 class Private;
155 QSharedDataPointer<Private> d;
156};
157
158}
159
160#endif
161

source code of attica/src/comment.h