-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathweburl.cpp
47 lines (42 loc) · 856 Bytes
/
weburl.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
#include "weburl.h"
weburl::weburl(bool favorite,
const QString &link,
const QString &info)
{
infavorite = favorite;
inlink = link;
ininfo = info;
}
weburl::~weburl()
{
if (tags != nullptr) {
tags->clear();
delete tags;
}
}
void weburl::addTag(QString *tag)
{
if (tags == nullptr) {
tags = new QList<QString*>();
}
tags->append(tag);
}
void weburl::removeTag(QString *tag)
{
if (tags != nullptr) {
tags->removeAll(tag);
}
}
bool weburl::containsTag(const QString &tag)
{
if (tags != nullptr) {
QList<QString*>::iterator it = tags->begin();
for (; it != tags->end(); ++it) {
QString *aTag = *it;
if (aTag->compare(tag) == 0) {
return true;
}
}
}
return false;
}