File: knowledgebaseentry.cpp

package info (click to toggle)
attica 0.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 644 kB
  • sloc: cpp: 5,227; makefile: 3
file content (203 lines) | stat: -rw-r--r-- 3,936 bytes parent folder | download | duplicates (2)
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
/*
    This file is part of KDE.
    
    Copyright (C) 2009 Marco Martin <notmart@gmail.com>

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) version 3, or any
    later version accepted by the membership of KDE e.V. (or its
    successor approved by the membership of KDE e.V.), which shall
    act as a proxy defined in Section 6 of version 3 of the license.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with this library.  If not, see <http://www.gnu.org/licenses/>.

*/

#include "knowledgebaseentry.h"

#include <QMap>

using namespace Attica;

class KnowledgeBaseEntry::Private : public QSharedData {
    public:
        QString m_id;
        int m_contentId;
        QString m_user;
        QString m_status;
        QDateTime m_changed;
        QString m_name;
        QString m_description;
        QString m_answer;
        int m_comments;
        QUrl m_detailPage;

        QMap<QString,QString> m_extendedAttributes;

        Private()
            : m_contentId(0),
              m_comments(0)
        {
        }
};

KnowledgeBaseEntry::KnowledgeBaseEntry()
    : d(new Private)
{
}


KnowledgeBaseEntry::KnowledgeBaseEntry(const KnowledgeBaseEntry& other)
    : d(other.d)
{
}


KnowledgeBaseEntry& KnowledgeBaseEntry::operator=(const Attica::KnowledgeBaseEntry & other)
{
    d = other.d;
    return *this;
}


KnowledgeBaseEntry::~KnowledgeBaseEntry()
{
}


void KnowledgeBaseEntry::setId(QString id)
{
    d->m_id = id;
}

QString KnowledgeBaseEntry::id() const
{
    return d->m_id;
}


void KnowledgeBaseEntry::setContentId(int id)
{
    d->m_contentId = id;
}

int KnowledgeBaseEntry::contentId() const
{
    return d->m_contentId;
}


void KnowledgeBaseEntry::setUser(const QString &user)
{
    d->m_user = user;
}

QString KnowledgeBaseEntry::user() const
{
    return d->m_user;
}


void KnowledgeBaseEntry::setStatus(const QString status)
{
    d->m_status = status;
}

QString KnowledgeBaseEntry::status() const
{
    return d->m_status;
}


void KnowledgeBaseEntry::setChanged(const QDateTime &changed)
{
    d->m_changed = changed;
}

QDateTime KnowledgeBaseEntry::changed() const
{
    return d->m_changed;
}


void KnowledgeBaseEntry::setName(const QString &name)
{
    d->m_name = name;
}

QString KnowledgeBaseEntry::name() const
{
    return d->m_name;
}


void KnowledgeBaseEntry::setDescription(const QString &description)
{
    d->m_description = description;
}

QString KnowledgeBaseEntry::description() const
{
    return d->m_description;
}


void KnowledgeBaseEntry::setAnswer(const QString &answer)
{
    d->m_answer = answer;
}

QString KnowledgeBaseEntry::answer() const
{
    return d->m_answer;
}


void KnowledgeBaseEntry::setComments(int comments)
{
    d->m_comments = comments;
}

int KnowledgeBaseEntry::comments() const
{
    return d->m_comments;
}


void KnowledgeBaseEntry::setDetailPage(const QUrl &detailPage)
{
    d->m_detailPage = detailPage;
}

QUrl KnowledgeBaseEntry::detailPage() const
{
    return d->m_detailPage;
}

void KnowledgeBaseEntry::addExtendedAttribute( const QString &key, const QString &value )
{
  d->m_extendedAttributes.insert( key, value );
}

QString KnowledgeBaseEntry::extendedAttribute( const QString &key ) const
{
  return d->m_extendedAttributes.value( key );
}

QMap<QString,QString> KnowledgeBaseEntry::extendedAttributes() const
{
  return d->m_extendedAttributes;
}


bool KnowledgeBaseEntry::isValid() const {
  return !(d->m_id.isEmpty());
}