diff --git a/CMakeLists.txt b/CMakeLists.txt index 9d52366f6..a634663ed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,154 +1,154 @@ project(kdepimlibs) set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake/modules ) # Used e.g. in KdepimLibsConfig.cmake, Alex set(KDEPIMLIBS_VERSION_MAJOR 4) set(KDEPIMLIBS_VERSION_MINOR 2) set(KDEPIMLIBS_VERSION_PATCH 0) set(KDEPIMLIBS_VERSION ${KDEPIMLIBS_VERSION_MAJOR}.${KDEPIMLIBS_VERSION_MINOR}.${KDEPIMLIBS_VERSION_PATCH} ) find_package(KDE4 4.2.0 REQUIRED) include (KDE4Defaults) include (MacroLibrary) find_package(Boost REQUIRED) macro_log_feature(Boost_FOUND "boost" "Boost C++ Libraries" "http://www.boost.org" TRUE "1.33.1" "Needed by several critical PIM libraries.") if (NOT ONLY_KLEO) macro_optional_find_package(Sasl2) macro_log_feature(SASL2_FOUND "cyrus-sasl" "Cyrus SASL API" "http://asg.web.cmu.edu/sasl/sasl-library.html" FALSE "" "STRONGLY RECOMMENDED: Needed to support authentication of logins. IMAP and Sieve kioslaves will not be built.") endif (NOT ONLY_KLEO) # gpgme is a hard dependency find_package(Gpgme REQUIRED) include (gpgme++/ConfigureChecks.cmake) include (ConfigureChecks.cmake) add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS}) include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES}) # TODO(move to kdesupport scripts) temporary way to support gpgme-qt under win32 if (EXISTS ${CMAKE_SOURCE_DIR}/gpgme-qt) message(STATUS "gpgme-qt for Windows will be compiled: ${CMAKE_SOURCE_DIR}/gpgme-qt") add_subdirectory(gpgme-qt) endif (EXISTS ${CMAKE_SOURCE_DIR}/gpgme-qt) -macro_optional_add_subdirectory(doc) +#macro_optional_add_subdirectory(doc) add_subdirectory(gpgme++) add_subdirectory(qgpgme) add_subdirectory(kmime) if (NOT ONLY_KLEO) find_package(Akonadi REQUIRED) if(Akonadi_FOUND) add_subdirectory(akonadi) endif(Akonadi_FOUND) # (gpgme++/qgpgme handle their conditions inside their own CMakeLists.txt files) add_subdirectory(kabc) add_subdirectory(kblog) add_subdirectory(kcal) add_subdirectory(kholidays) add_subdirectory(kimap) add_subdirectory(kldap) add_subdirectory(kpimidentities) add_subdirectory(kpimutils) add_subdirectory(kresources) add_subdirectory(ktnef) add_subdirectory(kxmlrpcclient) add_subdirectory(mailtransport) add_subdirectory(syndication) add_subdirectory(kioslave) endif (NOT ONLY_KLEO) add_subdirectory(cmake) macro_display_feature_log() # now create the KdepimLibsConfig.cmake file, which will be loaded by # kdelibs/cmake/modules/FindKdepimLibs.cmake and which has to contain all information # about the installed kdepimlibs anybody would like to have. Alex # we need the absolute directories where stuff will be installed too # but since the variables which contain the destinations can be relative # or absolute paths, we need this macro to make them all absoulte, Alex macro(MAKE_INSTALL_PATH_ABSOLUTE out in) if (IS_ABSOLUTE "${in}") # IS_ABSOLUTE is new since cmake 2.4.8 set(${out} "${in}") else (IS_ABSOLUTE "${in}") set(${out} "\${KDEPIMLIBS_INSTALL_DIR}/${in}") endif (IS_ABSOLUTE "${in}") endmacro(MAKE_INSTALL_PATH_ABSOLUTE out in) # all the following variables are put into KdepimLibsConfig.cmake, so # they are usable by projects using kdepimlibs. Alex make_install_path_absolute(KDEPIMLIBS_DATA_DIR ${DATA_INSTALL_DIR}) make_install_path_absolute(KDEPIMLIBS_DBUS_INTERFACES_DIR ${DBUS_INTERFACES_INSTALL_DIR}) make_install_path_absolute(KDEPIMLIBS_DBUS_SERVICES_DIR ${DBUS_SERVICES_INSTALL_DIR}) make_install_path_absolute(KDEPIMLIBS_INCLUDE_DIR ${INCLUDE_INSTALL_DIR}) make_install_path_absolute(KDEPIMLIBS_LIB_DIR ${LIB_INSTALL_DIR}) make_install_path_absolute(KDEPIMLIBS_BIN_DIR ${BIN_INSTALL_DIR}) make_install_path_absolute(KDEPIMLIBS_LIBEXEC_DIR ${LIBEXEC_INSTALL_DIR}) make_install_path_absolute(KDEPIMLIBS_SBIN_DIR ${SBIN_INSTALL_DIR}) make_install_path_absolute(KDEPIMLIBS_HTML_DIR ${HTML_INSTALL_DIR}) make_install_path_absolute(KDEPIMLIBS_CONFIG_DIR ${CONFIG_INSTALL_DIR}) make_install_path_absolute(KDEPIMLIBS_ICON_DIR ${ICON_INSTALL_DIR}) make_install_path_absolute(KDEPIMLIBS_KCFG_DIR ${KCFG_INSTALL_DIR}) make_install_path_absolute(KDEPIMLIBS_LOCALE_DIR ${LOCALE_INSTALL_DIR}) make_install_path_absolute(KDEPIMLIBS_MIME_DIR ${MIME_INSTALL_DIR}) make_install_path_absolute(KDEPIMLIBS_SOUND_DIR ${SOUND_INSTALL_DIR}) make_install_path_absolute(KDEPIMLIBS_TEMPLATES_DIR ${TEMPLATES_INSTALL_DIR}) make_install_path_absolute(KDEPIMLIBS_WALLPAPER_DIR ${WALLPAPER_INSTALL_DIR}) make_install_path_absolute(KDEPIMLIBS_KCONF_UPDATE_DIR ${KCONF_UPDATE_INSTALL_DIR}) make_install_path_absolute(KDEPIMLIBS_AUTOSTART_DIR ${AUTOSTART_INSTALL_DIR}) make_install_path_absolute(KDEPIMLIBS_XDG_APPS_DIR ${XDG_APPS_INSTALL_DIR}) make_install_path_absolute(KDEPIMLIBS_XDG_DIRECTORY_DIR ${XDG_DIRECTORY_INSTALL_DIR}) make_install_path_absolute(KDEPIMLIBS_SYSCONF_DIR ${SYSCONF_INSTALL_DIR}) make_install_path_absolute(KDEPIMLIBS_MAN_DIR ${MAN_INSTALL_DIR}) make_install_path_absolute(KDEPIMLIBS_INFO_DIR ${INFO_INSTALL_DIR}) make_install_path_absolute(KDEPIMLIBS_SERVICES_DIR ${SERVICES_INSTALL_DIR}) make_install_path_absolute(KDEPIMLIBS_SERVICETYPES_DIR ${SERVICETYPES_INSTALL_DIR}) # Used in configure_file() and install(EXPORT) set(KDEPIMLIBS_TARGET_PREFIX KDEPIMLibs__) # this file is installed and contains all necessary information about the installed kdepimibs, it also loads the file with the exported targets configure_file(KdepimLibsConfig.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/KdepimLibsConfig.cmake" @ONLY) # this file will be installed too and will be used by cmake when searching for the Config.cmake file to check the version of kdepimlibs, Alex macro_write_basic_cmake_version_file(${CMAKE_CURRENT_BINARY_DIR}/KdepimLibsConfigVersion.cmake ${KDEPIMLIBS_VERSION_MAJOR} ${KDEPIMLIBS_VERSION_MINOR} ${KDEPIMLIBS_VERSION_PATCH}) set(_KdepimLibsConfig_INSTALL_DIR ${LIB_INSTALL_DIR}/KdepimLibs-${KDEPIMLIBS_VERSION}/cmake) # places where find_package() looks for FooConfig.cmake files: # CMake >= 2.6.0 looks in lib/Foo*/cmake/, CMake >= 2.6.3 also looks in # lib/cmake/Foo*/, which packagers prefer. So they can set the KDE4_USE_COMMON_CMAKE_PACKAGE_CONFIG_DIR # option to have kdepimlibs install its Config file there. Alex if(KDE4_USE_COMMON_CMAKE_PACKAGE_CONFIG_DIR) set(_KdepimLibsConfig_INSTALL_DIR ${LIB_INSTALL_DIR}/cmake/KdepimLibs-${KDEPIMLIBS_VERSION} ) endif(KDE4_USE_COMMON_CMAKE_PACKAGE_CONFIG_DIR) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/KdepimLibsConfigVersion.cmake ${CMAKE_CURRENT_BINARY_DIR}/KdepimLibsConfig.cmake DESTINATION ${_KdepimLibsConfig_INSTALL_DIR} ) # Install the file with the exported targets, use ${KDEPIMLIBS_TARGET_PREFIX} as prefix for the names of these targets, Alex install(EXPORT kdepimlibsLibraryTargets NAMESPACE ${KDEPIMLIBS_TARGET_PREFIX} DESTINATION ${_KdepimLibsConfig_INSTALL_DIR} FILE KDEPimLibsLibraryTargetsWithPrefix.cmake ) # Install a KDEPimLibsDependencies.cmake so people using kdepimlibs 4.2 with kdelibs < 4.2 get a useful error message, Alex file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/KDEPimLibsDependencies.cmake "\n message(FATAL_ERROR \"For using this version of kdepimlibs (${KDEPIMLIBS_VERSION}) you need a newer version of kdelibs, please update.\")\n") install(FILES ${CMAKE_CURRENT_BINARY_DIR}/KDEPimLibsDependencies.cmake DESTINATION ${DATA_INSTALL_DIR}/cmake/modules) add_subdirectory(includes) diff --git a/syndication/rdf/document.h b/syndication/rdf/document.h index 953f270f8..159f082ef 100644 --- a/syndication/rdf/document.h +++ b/syndication/rdf/document.h @@ -1,188 +1,189 @@ /* * This file is part of the syndication library * * Copyright (C) 2006 Frank Osterfeld * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. * */ #ifndef SYNDICATION_RDF_DOCUMENT_H #define SYNDICATION_RDF_DOCUMENT_H #include #include template class QList; namespace Syndication { namespace RDF { class Document; +class Model; class DublinCore; class Image; class Item; class SyndicationInfo; class TextInput; //@cond PRIVATE typedef boost::shared_ptr DocumentPtr; //@endcond /** * Document implementation for RDF, representing an RSS 1.0 feed. * * @author Frank Osterfeld */ class SYNDICATION_EXPORT Document : public Syndication::SpecificDocument, public ResourceWrapper { - + friend class ::Syndication::RDF::Model; public: /** * creates a wrapper wrapping a null resource */ Document(); /** * creates a document by wrapping a channel resource * * @param resource the channel resource to wrap */ explicit Document(ResourcePtr resource); /** * creates a copy of another document * * @param other the document to copy */ Document(const Document& other); /** * destructor */ virtual ~Document(); /** * compares two documents. Two documents are equal if they wrap * the same resource. See ResourceWrapper::operator==() * * @param other the document to compare to */ bool operator==(const Document& other) const; /** * assigns another document * * @param other the document to assign */ Document& operator=(const Document& other); /** * Used by visitors for double dispatch. See DocumentVisitor * for more information. * @param visitor the visitor calling the method */ virtual bool accept(DocumentVisitor* visitor); /** * returns whether this document is valid or not. * Invalid documents do not contain any useful * information. */ bool isValid() const; /** * title of the feed (required) * * @return feed title as TODO: define format */ QString title() const; /** * A brief description of the channel's content, function, source, etc. * * @return TODO: define format etc. */ QString description() const; /** * The URL to which an HTML rendering of the channel title will link, * commonly the parent site's home or news page. */ QString link() const; /** * returns a dublin core description of the document. */ DublinCore dc() const; /** * returns syndication information describing how often this feed * is updated. */ SyndicationInfo syn() const; /** * list of items contained in this feed */ QList items() const; /** * An image to be associated with an HTML rendering of the channel. */ Image image() const; /** * An optional text input element associated with the channel */ TextInput textInput() const; //@cond PRIVATE /** * @internal * checks the format of titles and returns the results * * @param containsMarkup whether the heuristic found HTML markup in * titles */ void getItemTitleFormatInfo(bool* containsMarkup) const; /** * @internal * checks the format of descriptions and returns the results * * @param containsMarkup whether the heuristic found HTML markup in * descriptions */ void getItemDescriptionFormatInfo(bool* containsMarkup) const; //@endcond PRIVATE /** * Returns a description of the document for debugging purposes. * * @return debug string */ virtual QString debugInfo() const; private: class Private; Private* d; }; } // namespace RDF } // namespace Syndication #endif // SYNDICATION_RDF_DOCUMENT_H diff --git a/syndication/rdf/model.h b/syndication/rdf/model.h index 62ceb15ff..921e7fc5b 100644 --- a/syndication/rdf/model.h +++ b/syndication/rdf/model.h @@ -1,265 +1,268 @@ /* * This file is part of the syndication library * * Copyright (C) 2006 Frank Osterfeld * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. * */ #ifndef SYNDICATION_RDF_MODEL_H #define SYNDICATION_RDF_MODEL_H +#include +#include +#include + #include #include #include #include #include #include #include #include template class QList; namespace Syndication { namespace RDF { -class Document; -class Resource; -class Statement; - /** * An RDF model, a set of RDF statements. * Model objects are implicitely shared. * * @author Frank Osterfeld */ class SYNDICATION_EXPORT Model { friend class ::Syndication::RDF::Document; + friend class ::Syndication::RDF::Document::Private; friend class ::Syndication::RDF::Resource; + friend class ::Syndication::RDF::Resource::ResourcePrivate; friend class ::Syndication::RDF::Statement; + friend class ::Syndication::RDF::Statement::StatementPrivate; public: /** * default constructor, creates an empty model * containing no statements */ Model(); /** * constructs a model from another. * Both models will share the same set of statements, * so adding/removing statements from one model also * modifies the other! * * @param other another model */ Model(const Model& other); /** * destructor */ virtual ~Model(); /** * assigns another model. Both models will share the same * set of statements, so adding/removing statements from * one model also modifies the other! * * @param other another model */ Model& operator=(const Model& other); /** * Returns whether two models objects represent the same model * (i.e. share the same underlying statement set). Currently this * method does _not_ compare the statement list. * Two indepently created models containing the same statements * are not equal! * * @param other the model to compare to */ bool operator==(const Model& other) const; /** * creates a resource and associates it with this model. If the model * already contains a resource with the given URI, the existing instance * is returned. * * @param uri the URI of the resource. If a null string, a blank node * is created. * @return a shared pointer to the requested resource */ virtual ResourcePtr createResource(const QString& uri=QString()); /** * creates a property and associates it with this model. If the model * already contains a property with the given URI, the existing instance * is returned. * * @param uri the URI of the property. This must be non-empty, otherwise * null property is returned * @return a shared pointer to the requested property */ virtual PropertyPtr createProperty(const QString& uri); /** * creates a sequence and associates it with this model. If the model * already contains a sequence with the given URI, the existing * instance is returned. * * @param uri the URI of the sequence, or a null string for an * anonymous instance * @return a shared pointer to the requested sequence */ virtual SequencePtr createSequence(const QString& uri=QString()); /** * creates a literal and associates it with this model. * * @param text the literal text * @return a shared pointer to the requested literal */ virtual LiteralPtr createLiteral(const QString& text); /** * adds a statement to the model. * * @param subject * @param predicate * @param object * @return a shared pointer to a statement associated with this * model, with the given @c subject, @c predicate and @c object */ virtual StatementPtr addStatement(ResourcePtr subject, PropertyPtr predicate, NodePtr object); /** * removes a statement from the model. * * @param subject subject of the statement * @param predicate predicate of the statement * @param object object of the statement */ virtual void removeStatement(ResourcePtr subject, PropertyPtr predicate, NodePtr object); /** * removes a statement from the model. * * @param statement the statement to remove */ virtual void removeStatement(StatementPtr statement); /** * returns whether this model is empty, i.e. contains no statements. */ virtual bool isEmpty() const; /** * returns all resources of a given type. * subClassOf semantics are ignored. * * @param type a resource representing an RDFS class */ virtual QList resourcesWithType(ResourcePtr type) const; /** * returns a list of the statements in this model. * */ virtual QList statements() const; /** * searches the model for a node by ID. * * @param id the ID to search for * @return the node with the given ID, or a null node (which is of type * Literal) if the model doesn't contain the node with this ID */ virtual NodePtr nodeByID(uint id) const; /** * searches the model for a resource by ID. * * @param id the ID to search for * @return the resource with the given ID, or a null resource if the * model doesn't contain a resource with this ID */ virtual ResourcePtr resourceByID(uint id) const; /** * searches the model for a property by ID. * * @param id the ID to search for * @return the property with the given ID, or a null property if the * model doesn't contain a property with this ID */ virtual PropertyPtr propertyByID(uint id) const; /** * searches the model for a literal by ID. * * @param id the ID to search for * @return the literal with the given ID, or a null literal if the * model doesn't contain a literal with this ID */ virtual LiteralPtr literalByID(uint id) const; //@cond PRIVATE /** * @internal * used by Resource::hasProperty() */ virtual bool resourceHasProperty(const Resource* resource, PropertyPtr property) const; /** * @internal * used by Resource::property() */ virtual StatementPtr resourceProperty(const Resource* resource, PropertyPtr property) const; /** * @internal * used by Resource::properties() */ virtual QList resourceProperties(const Resource* resource, PropertyPtr property) const; //@endcond /** * a debug string listing the contained statements for * debugging purposes * * @return debug string */ virtual QString debugInfo() const; private: class ModelPrivate; boost::shared_ptr d; }; } // namespace RDF } // namespace Syndication #endif // SYNDICATION_RDF_MODEL_H diff --git a/syndication/rdf/statement.h b/syndication/rdf/statement.h index a87893bfc..cb5e14897 100644 --- a/syndication/rdf/statement.h +++ b/syndication/rdf/statement.h @@ -1,137 +1,138 @@ /* * This file is part of the syndication library * * Copyright (C) 2006 Frank Osterfeld * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. * */ #ifndef SYNDICATION_RDF_STATEMENT_H #define SYNDICATION_RDF_STATEMENT_H #include #include class QString; namespace Syndication { namespace RDF { //@cond PRIVATE class Statement; typedef boost::shared_ptr StatementPtr; //@endcond /** * An RDF statement, consisting of a triple * (subject, predicate, object). */ class SYNDICATION_EXPORT Statement { + friend class Model; public: /** * creates a null statement */ Statement(); /** * creates a copy of another statement * * @param other the statement to copy */ Statement(const Statement& other); /** * creates a statement * Do not call this in your code, use Model::createStatement() instead. * * @param subject the subject resource of the statement * @param predicate the predicate of the statement * @param object the object node of the statement */ Statement(ResourcePtr subject, PropertyPtr predicate, NodePtr object); /** * destructor */ virtual ~Statement(); /** * assigns another statement * * @param other the statement to assign */ Statement& operator=(const Statement& other); /** * returns whether two statements are equal. * Currently statements are equal, if they are from the same model (!) * and subject, predicate and object are equal. * * @param other the statement to compare to */ virtual bool operator==(const Statement& other) const; /** * returns whether this statement is a null statement (i.e. was created * using Statement()) */ virtual bool isNull() const; /** * the subject of the statement. */ virtual ResourcePtr subject() const; /** * the predicate of the statement */ virtual PropertyPtr predicate() const; /** * the object of the statement */ virtual NodePtr object() const; /** * returns the object of this statement as resource, if possible. * * @return the object node as Resource, or @c null if the object * is not a resource */ virtual ResourcePtr asResource() const; /** * returns the object of this statement as string, if possible. * * @return the literal text as QString, or a null string if the object * is not a literal */ virtual QString asString() const; private: class StatementPrivate; boost::shared_ptr d; }; } // namespace RDF } // namespace Syndication #endif // SYNDICATION_RDF_STATEMENT_H