File indexing completed on 2024-12-22 04:59:44
0001 /* 0002 SPDX-FileCopyrightText: 2019 Volker Krause <vkrause@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "kitinerary_export.h" 0010 0011 #include <QVariant> 0012 0013 namespace KItinerary { 0014 0015 /** Utilities for dealing with documents attached to objects. 0016 * @see https://schema.org/subjectOf 0017 */ 0018 namespace DocumentUtil 0019 { 0020 /** Determine a document identifier for the given content. */ 0021 KITINERARY_EXPORT QString idForContent(const QByteArray &data); 0022 0023 /** Add a document id to the object @p obj. 0024 * @returns @c true if the document id wasn't present yet and the object changed, @p false otherwise. 0025 */ 0026 KITINERARY_EXPORT bool addDocumentId(QVariant &obj, const QString &id); 0027 0028 /** Removes the document identifier @p id from object @p res. 0029 * @returns @c true if the document id was present and the object changed, @p false otherwise. 0030 */ 0031 KITINERARY_EXPORT bool removeDocumentId(QVariant &obj, const QString &id); 0032 0033 /** Returns all document identifiers associated with object @p obj. */ 0034 KITINERARY_EXPORT QVariantList documentIds(const QVariant &obj); 0035 0036 /** Sets the list of document identifiers for object @p obj. */ 0037 KITINERARY_EXPORT void setDocumentIds(QVariant &obj, const QVariantList &docIds); 0038 } 0039 0040 } 0041