File indexing completed on 2024-11-24 04:44:28

0001 /*
0002     This file is part of oxaccess.
0003 
0004     SPDX-FileCopyrightText: 2009 Tobias Koenig <tokoe@kde.org>
0005 
0006     SPDX-License-Identifier: LGPL-2.0-or-later
0007 */
0008 
0009 #pragma once
0010 
0011 #include <QDomDocument>
0012 #include <QDomElement>
0013 #include <QDomNode>
0014 #include <QString>
0015 
0016 namespace OXA
0017 {
0018 /**
0019  * Namespace that contains methods for creating or modifying DAV XML documents.
0020  *
0021  * @author Tobias Koenig <tokoe@kde.org>
0022  */
0023 namespace DAVUtils
0024 {
0025 /**
0026  * Adds a new element with the given @p tag inside the DAV namespace under @p parentNode
0027  * to the @p document.
0028  *
0029  * @return The newly added element.
0030  */
0031 QDomElement addDavElement(QDomDocument &document, QDomNode &parentNode, const QString &tag);
0032 
0033 /**
0034  * Adds a new element with the given @p tag and @p value inside the OX namespace under @p parentNode
0035  * to the @p document.
0036  *
0037  * @return The newly added element.
0038  */
0039 QDomElement addOxElement(QDomDocument &document, QDomNode &parentNode, const QString &tag, const QString &text = QString());
0040 
0041 /**
0042  * Sets the attribute of @p element inside the OX namespace with the given @p name to @p value.
0043  */
0044 void setOxAttribute(QDomElement &element, const QString &name, const QString &value);
0045 
0046 /**
0047  * Checks whether the response @p document contains an error message.
0048  * If so, @c true is returned, @p errorText set to the error message and @p errorStatus set to error status.
0049  */
0050 bool davErrorOccurred(const QDomDocument &document, QString &errorText, QString &errorStatus);
0051 }
0052 }