1 | /* |
---|---|
2 | This file is part of the syndication library |
3 | SPDX-FileCopyrightText: 2006 Frank Osterfeld <osterfeld@kde.org> |
4 | |
5 | SPDX-License-Identifier: LGPL-2.0-or-later |
6 | */ |
7 | |
8 | #include "resourcewrapper.h" |
9 | #include "model.h" |
10 | #include "resource.h" |
11 | |
12 | namespace Syndication |
13 | { |
14 | namespace RDF |
15 | { |
16 | class SYNDICATION_NO_EXPORT ResourceWrapper::ResourceWrapperPrivate |
17 | { |
18 | public: |
19 | ResourcePtr resource; |
20 | Model model; |
21 | }; |
22 | |
23 | ResourceWrapper::ResourceWrapper() |
24 | : d(new ResourceWrapperPrivate) |
25 | { |
26 | d->resource = ResourcePtr(new Resource()); |
27 | } |
28 | |
29 | ResourceWrapper::ResourceWrapper(const ResourceWrapper &other) |
30 | { |
31 | *this = other; |
32 | } |
33 | |
34 | ResourceWrapper::ResourceWrapper(ResourcePtr resource) |
35 | : d(new ResourceWrapperPrivate) |
36 | { |
37 | // if a null pointer is passed, we create a null resource |
38 | d->resource = !resource ? ResourcePtr(new Resource()) : resource; |
39 | d->model = d->resource->model(); |
40 | } |
41 | |
42 | ResourceWrapper::~ResourceWrapper() |
43 | { |
44 | } |
45 | |
46 | ResourceWrapper &ResourceWrapper::operator=(const ResourceWrapper &other) |
47 | { |
48 | d = other.d; |
49 | return *this; |
50 | } |
51 | |
52 | bool ResourceWrapper::operator==(const ResourceWrapper &other) const |
53 | { |
54 | return *(d->resource) == *(other.d->resource); |
55 | } |
56 | |
57 | bool ResourceWrapper::isNull() const |
58 | { |
59 | return d->resource->isNull(); |
60 | } |
61 | |
62 | ResourcePtr ResourceWrapper::resource() const |
63 | { |
64 | return d->resource; |
65 | } |
66 | |
67 | } // namespace RDF |
68 | } // namespace Syndication |
69 |