File indexing completed on 2025-01-05 05:09:31

0001 /*
0002     SPDX-FileCopyrightText: 2010-2013 Daniel Nicoletti <dantti12@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef KIPPREQUEST_P_H
0008 #define KIPPREQUEST_P_H
0009 
0010 #include <KCupsConnection.h>
0011 
0012 class KCupsRawRequest
0013 {
0014 public:
0015     ipp_tag_t group;
0016     ipp_tag_t valueTag;
0017     QString name;
0018     QVariant value;
0019 };
0020 
0021 class KIppRequestPrivate
0022 {
0023 public:
0024     void addRequest(ipp_tag_t group, ipp_tag_t valueTag, const QString &name, const QVariant &value);
0025     void addRawRequestsToIpp(ipp_t *ipp) const;
0026 
0027     ipp_op_t operation;
0028     QString resource;
0029     QString filename;
0030     mutable QList<KCupsRawRequest> rawRequests;
0031 };
0032 
0033 static const char **qStringListToCharPtrPtr(const QStringList &list, QList<QByteArray> &qbaList)
0034 {
0035     const char **ptr = new const char *[list.size() + 1];
0036     qbaList.reserve(qbaList.size() + list.size());
0037     QByteArray qba;
0038     for (int i = 0; i < list.size(); ++i) {
0039         qba = list.at(i).toUtf8();
0040         qbaList.append(qba);
0041         ptr[i] = qba.constData();
0042     }
0043     ptr[list.size()] = nullptr;
0044     return ptr;
0045 }
0046 
0047 #endif // KIPPREQUEST_P_H