• 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 
32 class IppRequest
33 {
34 public:
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  ipp_t* request();
78  TQMap<TQString,TQString> toMap(int group = -1);
79  void setMap(const TQMap<TQString,TQString>& opts);
80 
81  // processing functions
82  bool doRequest(const TQString& res);
83  bool doFileRequest(const TQString& res, const TQString& filename = TQString::null);
84 
85  // report functions
86  bool htmlReport(int group, TQTextStream& output);
87 
88  // debug function
89  void dump(int state);
90 
91 protected:
92  void addString_p(int group, int type, const TQString& name, const TQString& value);
93  void addStringList_p(int group, int type, const TQString& name, const TQStringList& values);
94  void addInteger_p(int group, int type, const TQString& name, int value);
95  void addIntegerList_p(int group, int type, const TQString& name, const TQValueList<int>& values);
96  bool stringValue_p(const TQString& name, TQString& value, int type);
97  bool stringListValue_p(const TQString& name, TQStringList& values, int type);
98  bool integerValue_p(const TQString& name, int& value, int type);
99 
100 private:
101  ipp_t *request_;
102  TQString host_;
103  int port_;
104  bool connect_;
105  int dump_;
106 };
107 
108 inline void IppRequest::addMime(int group, const TQString& name, const TQString& mime)
109 { addString_p(group, IPP_TAG_MIMETYPE, name, mime); }
110 
111 inline void IppRequest::addKeyword(int group, const TQString& name, const TQString& key)
112 { addString_p(group, IPP_TAG_KEYWORD, name, key); }
113 
114 inline void IppRequest::addKeyword(int group, const TQString& name, const TQStringList& keys)
115 { addStringList_p(group, IPP_TAG_KEYWORD, name, keys); }
116 
117 inline void IppRequest::addURI(int group, const TQString& name, const TQString& uri)
118 { addString_p(group, IPP_TAG_URI, name, uri); }
119 
120 inline void IppRequest::addURI(int group, const TQString& name, const TQStringList& uris)
121 { addStringList_p(group, IPP_TAG_URI, name, uris); }
122 
123 inline void IppRequest::addText(int group, const TQString& name, const TQString& txt)
124 { addString_p(group, IPP_TAG_TEXT, name, txt); }
125 
126 inline void IppRequest::addText(int group, const TQString& name, const TQStringList& txts)
127 { addStringList_p(group, IPP_TAG_TEXT, name, txts); }
128 
129 inline void IppRequest::addName(int group, const TQString& name, const TQString& nm)
130 { addString_p(group, IPP_TAG_NAME, name, nm); }
131 
132 inline void IppRequest::addName(int group, const TQString& name, const TQStringList& nms)
133 { addStringList_p(group, IPP_TAG_NAME, name, nms); }
134 
135 inline void IppRequest::addInteger(int group, const TQString& name, int value)
136 { addInteger_p(group, IPP_TAG_INTEGER, name, value); }
137 
138 inline void IppRequest::addInteger(int group, const TQString& name, const TQValueList<int>& values)
139 { addIntegerList_p(group, IPP_TAG_INTEGER, name, values); }
140 
141 inline void IppRequest::addEnum(int group, const TQString& name, int value)
142 { addInteger_p(group, IPP_TAG_ENUM, name, value); }
143 
144 inline void IppRequest::addEnum(int group, const TQString& name, const TQValueList<int>& values)
145 { addIntegerList_p(group, IPP_TAG_ENUM, name, values); }
146 
147 inline bool IppRequest::integer(const TQString& name, int& value)
148 { return integerValue_p(name, value, IPP_TAG_INTEGER); }
149 
150 inline bool IppRequest::enumvalue(const TQString& name, int& value)
151 { return integerValue_p(name, value, IPP_TAG_ENUM); }
152 
153 inline bool IppRequest::name(const TQString& name, TQString& value)
154 { return stringValue_p(name, value, IPP_TAG_NAME); }
155 
156 inline bool IppRequest::name(const TQString& name, TQStringList& values)
157 { return stringListValue_p(name, values, IPP_TAG_NAME); }
158 
159 inline bool IppRequest::text(const TQString& name, TQString& value)
160 { return stringValue_p(name, value, IPP_TAG_TEXT); }
161 
162 inline bool IppRequest::text(const TQString& name, TQStringList& values)
163 { return stringListValue_p(name, values, IPP_TAG_TEXT); }
164 
165 inline bool IppRequest::uri(const TQString& name, TQString& value)
166 { return stringValue_p(name, value, IPP_TAG_URI); }
167 
168 inline bool IppRequest::uri(const TQString& name, TQStringList& values)
169 { return stringListValue_p(name, values, IPP_TAG_URI); }
170 
171 inline bool IppRequest::keyword(const TQString& name, TQString& value)
172 { return stringValue_p(name, value, IPP_TAG_KEYWORD); }
173 
174 inline bool IppRequest::keyword(const TQString& name, TQStringList& values)
175 { return stringListValue_p(name, values, IPP_TAG_KEYWORD); }
176 
177 inline bool IppRequest::mime(const TQString& name, TQString& value)
178 { return stringValue_p(name, value, IPP_TAG_MIMETYPE); }
179 
180 inline bool IppRequest::doRequest(const TQString& res)
181 { return doFileRequest(res); }
182 
183 
184 inline void IppRequest::setHost(const TQString& host)
185 { host_ = host; }
186 
187 inline void IppRequest::setPort(int p)
188 { port_ = p; }
189 
190 inline void IppRequest::dump(int state)
191 { dump_ = state; }
192 
193 inline ipp_t* IppRequest::request()
194 { return request_; }
195 
196 #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.8.17
This website is maintained by Timothy Pearson.