17#ifndef QXMPPSCEENVELOPE_P_H
18#define QXMPPSCEENVELOPE_P_H
20#include "QXmppUtils.h"
25class QXmppSceEnvelopeReader
28 QXmppSceEnvelopeReader(QDomElement &&element)
29 : element(std::move(element))
33 inline QDomElement contentElement()
35 return element.firstChildElement(QStringLiteral(
"content"));
39 return element.firstChildElement(QStringLiteral(
"from")).attribute(QStringLiteral(
"jid"));
43 return element.firstChildElement(QStringLiteral(
"to")).attribute(QStringLiteral(
"jid"));
45 inline QDateTime timestamp()
48 element.firstChildElement(QStringLiteral(
"time")).attribute(QStringLiteral(
"stamp")));
57class QXmppSceEnvelopeWriter
60 QXmppSceEnvelopeWriter(QXmlStreamWriter &writer)
67 writer.writeStartElement(QStringLiteral(
"envelope"));
68 writer.writeDefaultNamespace(QStringLiteral(
"urn:xmpp:sce:1"));
72 writer.writeEndElement();
74 template<
typename Functor>
75 void writeContent(Functor writeContent)
77 writer.writeStartElement(QStringLiteral(
"content"));
79 writer.writeEndElement();
81 inline void writeFrom(
const QString &jid)
83 writer.writeStartElement(QStringLiteral(
"from"));
84 writer.writeAttribute(QStringLiteral(
"jid"), jid);
85 writer.writeEndElement();
87 inline void writeTo(
const QString &jid)
89 writer.writeStartElement(QStringLiteral(
"to"));
90 writer.writeAttribute(QStringLiteral(
"jid"), jid);
91 writer.writeEndElement();
93 inline void writeTimestamp(
const QDateTime ×tamp)
95 writer.writeStartElement(QStringLiteral(
"time"));
97 writer.writeEndElement();
99 inline void writeRpad(
const QString &value)
101 writer.writeStartElement(QStringLiteral(
"rpad"));
102 writer.writeCharacters(value);
103 writer.writeEndElement();
107 QXmlStreamWriter &writer;
static QString datetimeToString(const QDateTime &dt)
Definition: QXmppUtils.cpp:120
static QDateTime datetimeFromString(QStringView str)
Definition: QXmppUtils.cpp:103