resource.h
00001 /* 00002 * This file is part of the syndication library 00003 * 00004 * Copyright (C) 2006 Frank Osterfeld <osterfeld@kde.org> 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Library General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Library General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Library General Public License 00017 * along with this library; see the file COPYING.LIB. If not, write to 00018 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00019 * Boston, MA 02110-1301, USA. 00020 * 00021 */ 00022 00023 #ifndef SYNDICATION_RDF_RESOURCE_H 00024 #define SYNDICATION_RDF_RESOURCE_H 00025 00026 #include <syndication/rdf/node.h> 00027 00028 #include <boost/shared_ptr.hpp> 00029 00030 class QString; 00031 00032 template <class T> class QList; 00033 00034 namespace Syndication { 00035 namespace RDF { 00036 00037 class Model; 00038 class Property; 00039 typedef boost::shared_ptr<Property> PropertyPtr; 00040 class Resource; 00041 class Statement; 00042 typedef boost::shared_ptr<Statement> StatementPtr; 00043 00044 typedef boost::shared_ptr<Resource> ResourcePtr; 00045 00051 class SYNDICATION_EXPORT Resource : public Node 00052 { 00053 friend class Model; 00054 00055 public: 00056 00060 Resource(); 00061 00067 Resource(const Resource& other); 00068 00075 explicit Resource(const QString& uri); 00076 00080 virtual ~Resource(); 00081 00087 Resource& operator=(const Resource& other); 00088 00095 bool operator==(const Node& other) const; 00096 00103 virtual void accept(NodeVisitor* visitor, NodePtr ptr); 00104 00108 virtual Resource* clone() const; 00109 00113 virtual Model model() const; 00114 00121 virtual bool hasProperty(PropertyPtr property) const; 00122 00132 virtual StatementPtr property(PropertyPtr property) const; 00133 00142 virtual QList<StatementPtr> properties(PropertyPtr property) const; 00143 00147 virtual bool isNull() const; 00148 00153 virtual unsigned int id() const; 00154 00158 virtual bool isResource() const; 00159 00163 virtual bool isLiteral() const; 00164 00169 virtual bool isProperty() const; 00170 00174 virtual bool isAnon() const; 00175 00180 virtual bool isSequence() const; 00181 00185 virtual QString text() const; 00186 00190 virtual QString uri() const; 00191 00192 00197 virtual void setModel(const Model& model); 00198 00203 virtual void setId(unsigned int id); 00204 00205 private: 00206 00207 class ResourcePrivate; 00208 typedef boost::shared_ptr<ResourcePrivate> ResourcePrivatePtr; 00209 ResourcePrivatePtr d; 00210 }; 00211 00212 } // namespace RDF 00213 } // namespace Syndication 00214 00215 #endif // SYNDICATION_RDF_RESOURCE_H