Warning, file /frameworks/syndication/src/rdf/resourcewrapper.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002     This file is part of the syndication library
0003     SPDX-FileCopyrightText: 2006 Frank Osterfeld <osterfeld@kde.org>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #ifndef SYNDICATION_RDF_RESOURCEWRAPPER_H
0009 #define SYNDICATION_RDF_RESOURCEWRAPPER_H
0010 
0011 #include <QSharedPointer>
0012 
0013 #include "../syndication_export.h"
0014 
0015 namespace Syndication
0016 {
0017 namespace RDF
0018 {
0019 class Resource;
0020 typedef QSharedPointer<Resource> ResourcePtr;
0021 
0022 /**
0023  * A wrapper for RDF resources. Base class for convenience wrappers
0024  * such as Document, Item etc.
0025  *
0026  * @author Frank Osterfeld
0027  */
0028 class ResourceWrapper
0029 {
0030 public:
0031     /**
0032      * creates a wrapper wrapping a null resource, isNull() will be
0033      * @p true.
0034      */
0035     ResourceWrapper();
0036 
0037     /**
0038      * Copy constructor.
0039      * Due to the shared d pointer, this is a cheap operation.
0040      *
0041      * @param other resource wrapper to copy
0042      */
0043     ResourceWrapper(const ResourceWrapper &other);
0044 
0045     /**
0046      * creates a resource wrapper for a given resource.
0047      * If a null pointer is passed, a null resource is
0048      * created internally (resource() will _not_ return a null
0049      * pointer!)
0050      * @param resource a resource wrapper instance
0051      */
0052     explicit ResourceWrapper(ResourcePtr resource);
0053 
0054     /**
0055      * destructor
0056      */
0057     virtual ~ResourceWrapper();
0058 
0059     /**
0060      * Assignment oeprator
0061      * Due to the shared d pointer, this is a cheap operation.
0062      *
0063      * @param other resource wrapper to assign.
0064      */
0065     ResourceWrapper &operator=(const ResourceWrapper &other);
0066 
0067     /**
0068      * compares two resource wrapper instances.
0069      * Two resource wrappers are equal when the wrapped resources
0070      * are equal, i.e. they have the same URI.
0071      * @see Resource::uri()
0072      * @param other resource wrapper instance to compare to
0073      */
0074     bool operator==(const ResourceWrapper &other) const;
0075 
0076     /**
0077      * returns the wrapped resource. Whether a null resource or
0078      * not, the returned pointer itself is never a null
0079      * _pointer_!
0080      */
0081     ResourcePtr resource() const;
0082 
0083     /**
0084      * returns whether the wrapped resource is a null resource
0085      * @return @c true if isNull() is true for the wrapped resource,
0086      * @c false otherwise
0087      */
0088     bool isNull() const;
0089 
0090 private:
0091     class ResourceWrapperPrivate;
0092     QSharedPointer<ResourceWrapperPrivate> d;
0093 };
0094 
0095 } // namespace RDF
0096 } // namespace Syndication
0097 
0098 #endif // SYNDICATION_RDF_RESOURCEWRAPPER_H