Syndication

resourcewrapper.h
1 /*
2  This file is part of the syndication library
3  SPDX-FileCopyrightText: 2006 Frank Osterfeld <[email protected]>
4 
5  SPDX-License-Identifier: LGPL-2.0-or-later
6 */
7 
8 #ifndef SYNDICATION_RDF_RESOURCEWRAPPER_H
9 #define SYNDICATION_RDF_RESOURCEWRAPPER_H
10 
11 #include <QSharedPointer>
12 
13 #include <syndication_export.h>
14 
15 namespace Syndication
16 {
17 namespace RDF
18 {
19 class Resource;
20 typedef QSharedPointer<Resource> ResourcePtr;
21 
22 /**
23  * A wrapper for RDF resources. Base class for convenience wrappers
24  * such as Document, Item etc.
25  *
26  * @author Frank Osterfeld
27  */
28 class SYNDICATION_EXPORT ResourceWrapper
29 {
30 public:
31  /**
32  * creates a wrapper wrapping a null resource, isNull() will be
33  * @p true.
34  */
35  ResourceWrapper();
36 
37  /**
38  * Copy constructor.
39  * Due to the shared d pointer, this is a cheap operation.
40  *
41  * @param other resource wrapper to copy
42  */
43  ResourceWrapper(const ResourceWrapper &other);
44 
45  /**
46  * creates a resource wrapper for a given resource.
47  * If a null pointer is passed, a null resource is
48  * created internally (resource() will _not_ return a null
49  * pointer!)
50  * @param resource a resource wrapper instance
51  */
52  explicit ResourceWrapper(ResourcePtr resource);
53 
54  /**
55  * destructor
56  */
57  virtual ~ResourceWrapper();
58 
59  /**
60  * Assignment oeprator
61  * Due to the shared d pointer, this is a cheap operation.
62  *
63  * @param other resource wrapper to assign.
64  */
65  ResourceWrapper &operator=(const ResourceWrapper &other);
66 
67  /**
68  * compares two resource wrapper instances.
69  * Two resource wrappers are equal when the wrapped resources
70  * are equal, i.e. they have the same URI.
71  * @see Resource::uri()
72  * @param other resource wrapper instance to compare to
73  */
74  bool operator==(const ResourceWrapper &other) const;
75 
76  /**
77  * returns the wrapped resource. Whether a null resource or
78  * not, the returned pointer itself is never a null
79  * _pointer_!
80  */
81  ResourcePtr resource() const;
82 
83  /**
84  * returns whether the wrapped resource is a null resource
85  * @return @c true if isNull() is true for the wrapped resource,
86  * @c false otherwise
87  */
88  bool isNull() const;
89 
90 private:
91  class ResourceWrapperPrivate;
93 };
94 
95 } // namespace RDF
96 } // namespace Syndication
97 
98 #endif // SYNDICATION_RDF_RESOURCEWRAPPER_H
bool operator==(const Qt3DRender::QGraphicsApiFilter &reference, const Qt3DRender::QGraphicsApiFilter &sample)
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Dec 5 2023 03:58:07 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.