ipprequest.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
#ifndef IPPREQUEST_H
00021
#define IPPREQUEST_H
00022
00023
#include <qstring.h>
00024
#include <qstringlist.h>
00025
#include <qtextstream.h>
00026
#include <qmap.h>
00027
00028
#include <cups/ipp.h>
00029
00030
class IppRequest
00031 {
00032
public:
00033 IppRequest();
00034 ~IppRequest();
00035
00036
void init();
00037
00038
00039
void addMime(
int group,
const QString& name,
const QString& mime);
00040
void addKeyword(
int group,
const QString& name,
const QString& key);
00041
void addKeyword(
int group,
const QString& name,
const QStringList& keys);
00042
void addURI(
int group,
const QString& name,
const QString& uri);
00043
void addURI(
int group,
const QString& name,
const QStringList& uris);
00044
void addText(
int group,
const QString& name,
const QString& txt);
00045
void addText(
int group,
const QString& name,
const QStringList& txts);
00046
void addName(
int group,
const QString& name,
const QString& nm);
00047
void addName(
int group,
const QString& name,
const QStringList& nms);
00048
void addInteger(
int group,
const QString& name,
int value);
00049
void addInteger(
int group,
const QString& name,
const QValueList<int>& values);
00050
void addEnum(
int group,
const QString& name,
int value);
00051
void addEnum(
int group,
const QString& name,
const QValueList<int>& values);
00052
void addBoolean(
int group,
const QString& name,
bool value);
00053
void addBoolean(
int group,
const QString& name,
const QValueList<bool>& values);
00054
00055
void setOperation(
int op);
00056
void setHost(
const QString& host);
00057
void setPort(
int p);
00058
00059
00060
int status();
00061
QString statusMessage();
00062
bool integer(
const QString& name,
int& value);
00063
bool boolean(
const QString& name,
bool& value);
00064
bool enumvalue(
const QString& name,
int& value);
00065
bool name(
const QString& name,
QString& value);
00066
bool name(
const QString& name,
QStringList& value);
00067
bool text(
const QString& name,
QString& value);
00068
bool text(
const QString& name,
QStringList& value);
00069
bool uri(
const QString& name,
QString& value);
00070
bool uri(
const QString& name,
QStringList& value);
00071
bool keyword(
const QString& name,
QString& value);
00072
bool keyword(
const QString& name,
QStringList& value);
00073
bool mime(
const QString& name,
QString& value);
00074 ipp_attribute_t* first();
00075 ipp_attribute_t* last();
00076
QMap<QString,QString> toMap(
int group = -1);
00077
void setMap(
const QMap<QString,QString>& opts);
00078
00079
00080
bool doRequest(
const QString& res);
00081
bool doFileRequest(
const QString& res,
const QString& filename = QString::null);
00082
00083
00084
bool htmlReport(
int group,
QTextStream& output);
00085
00086
00087
void dump(
int state);
00088
00089
protected:
00090
void addString_p(
int group,
int type,
const QString& name,
const QString& value);
00091
void addStringList_p(
int group,
int type,
const QString& name,
const QStringList& values);
00092
void addInteger_p(
int group,
int type,
const QString& name,
int value);
00093
void addIntegerList_p(
int group,
int type,
const QString& name,
const QValueList<int>& values);
00094
bool stringValue_p(
const QString& name,
QString& value,
int type);
00095
bool stringListValue_p(
const QString& name,
QStringList& values,
int type);
00096
bool integerValue_p(
const QString& name,
int& value,
int type);
00097
00098
private:
00099 ipp_t *request_;
00100
QString host_;
00101
int port_;
00102
bool connect_;
00103
int dump_;
00104 };
00105
00106
inline void IppRequest::addMime(
int group,
const QString& name,
const QString& mime)
00107 { addString_p(group, IPP_TAG_MIMETYPE, name, mime); }
00108
00109
inline void IppRequest::addKeyword(
int group,
const QString& name,
const QString& key)
00110 { addString_p(group, IPP_TAG_KEYWORD, name, key); }
00111
00112
inline void IppRequest::addKeyword(
int group,
const QString& name,
const QStringList& keys)
00113 { addStringList_p(group, IPP_TAG_KEYWORD, name, keys); }
00114
00115
inline void IppRequest::addURI(
int group,
const QString& name,
const QString& uri)
00116 { addString_p(group, IPP_TAG_URI, name, uri); }
00117
00118
inline void IppRequest::addURI(
int group,
const QString& name,
const QStringList& uris)
00119 { addStringList_p(group, IPP_TAG_URI, name, uris); }
00120
00121
inline void IppRequest::addText(
int group,
const QString& name,
const QString& txt)
00122 { addString_p(group, IPP_TAG_TEXT, name, txt); }
00123
00124
inline void IppRequest::addText(
int group,
const QString& name,
const QStringList& txts)
00125 { addStringList_p(group, IPP_TAG_TEXT, name, txts); }
00126
00127
inline void IppRequest::addName(
int group,
const QString& name,
const QString& nm)
00128 { addString_p(group, IPP_TAG_NAME, name, nm); }
00129
00130
inline void IppRequest::addName(
int group,
const QString& name,
const QStringList& nms)
00131 { addStringList_p(group, IPP_TAG_NAME, name, nms); }
00132
00133
inline void IppRequest::addInteger(
int group,
const QString& name,
int value)
00134 { addInteger_p(group, IPP_TAG_INTEGER, name, value); }
00135
00136
inline void IppRequest::addInteger(
int group,
const QString& name,
const QValueList<int>& values)
00137 { addIntegerList_p(group, IPP_TAG_INTEGER, name, values); }
00138
00139
inline void IppRequest::addEnum(
int group,
const QString& name,
int value)
00140 { addInteger_p(group, IPP_TAG_ENUM, name, value); }
00141
00142
inline void IppRequest::addEnum(
int group,
const QString& name,
const QValueList<int>& values)
00143 { addIntegerList_p(group, IPP_TAG_ENUM, name, values); }
00144
00145
inline bool IppRequest::integer(
const QString& name,
int& value)
00146 {
return integerValue_p(name, value, IPP_TAG_INTEGER); }
00147
00148
inline bool IppRequest::enumvalue(
const QString& name,
int& value)
00149 {
return integerValue_p(name, value, IPP_TAG_ENUM); }
00150
00151
inline bool IppRequest::name(
const QString& name,
QString& value)
00152 {
return stringValue_p(name, value, IPP_TAG_NAME); }
00153
00154
inline bool IppRequest::name(
const QString& name,
QStringList& values)
00155 {
return stringListValue_p(name, values, IPP_TAG_NAME); }
00156
00157
inline bool IppRequest::text(
const QString& name,
QString& value)
00158 {
return stringValue_p(name, value, IPP_TAG_TEXT); }
00159
00160
inline bool IppRequest::text(
const QString& name,
QStringList& values)
00161 {
return stringListValue_p(name, values, IPP_TAG_TEXT); }
00162
00163
inline bool IppRequest::uri(
const QString& name,
QString& value)
00164 {
return stringValue_p(name, value, IPP_TAG_URI); }
00165
00166
inline bool IppRequest::uri(
const QString& name,
QStringList& values)
00167 {
return stringListValue_p(name, values, IPP_TAG_URI); }
00168
00169
inline bool IppRequest::keyword(
const QString& name,
QString& value)
00170 {
return stringValue_p(name, value, IPP_TAG_KEYWORD); }
00171
00172
inline bool IppRequest::keyword(
const QString& name,
QStringList& values)
00173 {
return stringListValue_p(name, values, IPP_TAG_KEYWORD); }
00174
00175
inline bool IppRequest::mime(
const QString& name,
QString& value)
00176 {
return stringValue_p(name, value, IPP_TAG_MIMETYPE); }
00177
00178
inline bool IppRequest::doRequest(
const QString& res)
00179 {
return doFileRequest(res); }
00180
00181
inline ipp_attribute_t* IppRequest::first()
00182 {
return (request_ ? request_->attrs : NULL); }
00183
00184
inline ipp_attribute_t* IppRequest::last()
00185 {
return (request_ ? request_->last : NULL); }
00186
00187
inline void IppRequest::setHost(
const QString& host)
00188 { host_ = host; }
00189
00190
inline void IppRequest::setPort(
int p)
00191 { port_ = p; }
00192
00193
inline void IppRequest::dump(
int state)
00194 { dump_ = state; }
00195
00196
#endif
This file is part of the documentation for kdeprint Library Version 3.3.0.