1 | #include "References.h" |
---|---|
2 | |
3 | void References::addReference(Type type, const QString &value) |
4 | { |
5 | const auto references = mReferences.value(type, QStringList()); |
6 | |
7 | if (!references.contains(value)) |
8 | mReferences[type].append(value); |
9 | } |
10 | |
11 | QStringList References::getReferences(Type type) const |
12 | { |
13 | return mReferences.value(type, QStringList()); |
14 | } |
15 | |
16 | int References::removeReference(References::Type type, const QString &value) |
17 | { |
18 | const auto removedItems = mReferences[type].removeAll(value); |
19 | |
20 | if (mReferences[type].isEmpty()) |
21 | mReferences.remove(type); |
22 | |
23 | return removedItems; |
24 | } |
25 |