• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeprint
 

tdeprint

  • tdeprint
  • cups
ipprequest.h
1/*
2 * This file is part of the KDE libraries
3 * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License version 2 as published by the Free Software Foundation.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
13 *
14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 **/
19
20#ifndef IPPREQUEST_H
21#define IPPREQUEST_H
22
23#include <tqstring.h>
24#include <tqstringlist.h>
25#include <tqtextstream.h>
26#include <tqmap.h>
27
28#include <cups/ipp.h>
29
30#include "config.h"
31
32class IppRequest
33{
34public:
35 IppRequest();
36 ~IppRequest();
37
38 void init(); // re-initializes the request
39
40 // request building functions
41 void addMime(int group, const TQString& name, const TQString& mime);
42 void addKeyword(int group, const TQString& name, const TQString& key);
43 void addKeyword(int group, const TQString& name, const TQStringList& keys);
44 void addURI(int group, const TQString& name, const TQString& uri);
45 void addURI(int group, const TQString& name, const TQStringList& uris);
46 void addText(int group, const TQString& name, const TQString& txt);
47 void addText(int group, const TQString& name, const TQStringList& txts);
48 void addName(int group, const TQString& name, const TQString& nm);
49 void addName(int group, const TQString& name, const TQStringList& nms);
50 void addInteger(int group, const TQString& name, int value);
51 void addInteger(int group, const TQString& name, const TQValueList<int>& values);
52 void addEnum(int group, const TQString& name, int value);
53 void addEnum(int group, const TQString& name, const TQValueList<int>& values);
54 void addBoolean(int group, const TQString& name, bool value);
55 void addBoolean(int group, const TQString& name, const TQValueList<bool>& values);
56
57 void setOperation(int op);
58 void setHost(const TQString& host);
59 void setPort(int p);
60
61 // request answer functions
62 int status();
63 TQString statusMessage();
64 bool integer(const TQString& name, int& value);
65 bool boolean(const TQString& name, bool& value);
66 bool enumvalue(const TQString& name, int& value);
67 bool name(const TQString& name, TQString& value);
68 bool name(const TQString& name, TQStringList& value);
69 bool text(const TQString& name, TQString& value);
70 bool text(const TQString& name, TQStringList& value);
71 bool uri(const TQString& name, TQString& value);
72 bool uri(const TQString& name, TQStringList& value);
73 bool keyword(const TQString& name, TQString& value);
74 bool keyword(const TQString& name, TQStringList& value);
75 bool mime(const TQString& name, TQString& value);
76 ipp_attribute_t* first();
77#ifndef HAVE_CUPS_1_6
78 ipp_attribute_t* last();
79#endif // HAVE_CUPS_1_6
80 ipp_t* request();
81 TQMap<TQString,TQString> toMap(int group = -1);
82 void setMap(const TQMap<TQString,TQString>& opts);
83
84 // processing functions
85 bool doRequest(const TQString& res);
86 bool doFileRequest(const TQString& res, const TQString& filename = TQString::null);
87
88 // report functions
89 bool htmlReport(int group, TQTextStream& output);
90
91 // debug function
92 void dump(int state);
93
94protected:
95 void addString_p(int group, int type, const TQString& name, const TQString& value);
96 void addStringList_p(int group, int type, const TQString& name, const TQStringList& values);
97 void addInteger_p(int group, int type, const TQString& name, int value);
98 void addIntegerList_p(int group, int type, const TQString& name, const TQValueList<int>& values);
99 bool stringValue_p(const TQString& name, TQString& value, int type);
100 bool stringListValue_p(const TQString& name, TQStringList& values, int type);
101 bool integerValue_p(const TQString& name, int& value, int type);
102
103private:
104 ipp_t *request_;
105 TQString host_;
106 int port_;
107 bool connect_;
108 int dump_;
109};
110
111inline void IppRequest::addMime(int group, const TQString& name, const TQString& mime)
112{ addString_p(group, IPP_TAG_MIMETYPE, name, mime); }
113
114inline void IppRequest::addKeyword(int group, const TQString& name, const TQString& key)
115{ addString_p(group, IPP_TAG_KEYWORD, name, key); }
116
117inline void IppRequest::addKeyword(int group, const TQString& name, const TQStringList& keys)
118{ addStringList_p(group, IPP_TAG_KEYWORD, name, keys); }
119
120inline void IppRequest::addURI(int group, const TQString& name, const TQString& uri)
121{ addString_p(group, IPP_TAG_URI, name, uri); }
122
123inline void IppRequest::addURI(int group, const TQString& name, const TQStringList& uris)
124{ addStringList_p(group, IPP_TAG_URI, name, uris); }
125
126inline void IppRequest::addText(int group, const TQString& name, const TQString& txt)
127{ addString_p(group, IPP_TAG_TEXT, name, txt); }
128
129inline void IppRequest::addText(int group, const TQString& name, const TQStringList& txts)
130{ addStringList_p(group, IPP_TAG_TEXT, name, txts); }
131
132inline void IppRequest::addName(int group, const TQString& name, const TQString& nm)
133{ addString_p(group, IPP_TAG_NAME, name, nm); }
134
135inline void IppRequest::addName(int group, const TQString& name, const TQStringList& nms)
136{ addStringList_p(group, IPP_TAG_NAME, name, nms); }
137
138inline void IppRequest::addInteger(int group, const TQString& name, int value)
139{ addInteger_p(group, IPP_TAG_INTEGER, name, value); }
140
141inline void IppRequest::addInteger(int group, const TQString& name, const TQValueList<int>& values)
142{ addIntegerList_p(group, IPP_TAG_INTEGER, name, values); }
143
144inline void IppRequest::addEnum(int group, const TQString& name, int value)
145{ addInteger_p(group, IPP_TAG_ENUM, name, value); }
146
147inline void IppRequest::addEnum(int group, const TQString& name, const TQValueList<int>& values)
148{ addIntegerList_p(group, IPP_TAG_ENUM, name, values); }
149
150inline bool IppRequest::integer(const TQString& name, int& value)
151{ return integerValue_p(name, value, IPP_TAG_INTEGER); }
152
153inline bool IppRequest::enumvalue(const TQString& name, int& value)
154{ return integerValue_p(name, value, IPP_TAG_ENUM); }
155
156inline bool IppRequest::name(const TQString& name, TQString& value)
157{ return stringValue_p(name, value, IPP_TAG_NAME); }
158
159inline bool IppRequest::name(const TQString& name, TQStringList& values)
160{ return stringListValue_p(name, values, IPP_TAG_NAME); }
161
162inline bool IppRequest::text(const TQString& name, TQString& value)
163{ return stringValue_p(name, value, IPP_TAG_TEXT); }
164
165inline bool IppRequest::text(const TQString& name, TQStringList& values)
166{ return stringListValue_p(name, values, IPP_TAG_TEXT); }
167
168inline bool IppRequest::uri(const TQString& name, TQString& value)
169{ return stringValue_p(name, value, IPP_TAG_URI); }
170
171inline bool IppRequest::uri(const TQString& name, TQStringList& values)
172{ return stringListValue_p(name, values, IPP_TAG_URI); }
173
174inline bool IppRequest::keyword(const TQString& name, TQString& value)
175{ return stringValue_p(name, value, IPP_TAG_KEYWORD); }
176
177inline bool IppRequest::keyword(const TQString& name, TQStringList& values)
178{ return stringListValue_p(name, values, IPP_TAG_KEYWORD); }
179
180inline bool IppRequest::mime(const TQString& name, TQString& value)
181{ return stringValue_p(name, value, IPP_TAG_MIMETYPE); }
182
183inline bool IppRequest::doRequest(const TQString& res)
184{ return doFileRequest(res); }
185
186#ifndef HAVE_CUPS_1_6
187inline ipp_attribute_t* IppRequest::last()
188{ return (request_ ? request_->last : NULL); }
189#endif // HAVE_CUPS_1_6
190
191inline void IppRequest::setHost(const TQString& host)
192{ host_ = host; }
193
194inline void IppRequest::setPort(int p)
195{ port_ = p; }
196
197inline void IppRequest::dump(int state)
198{ dump_ = state; }
199
200inline ipp_t* IppRequest::request()
201{ return request_; }
202
203#endif

tdeprint

Skip menu "tdeprint"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

tdeprint

Skip menu "tdeprint"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeprint by doxygen 1.9.4
This website is maintained by Timothy Pearson.