1 /*
2 ################################################################################
3 #  THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY  #
4 #  Read the zproject/README.md for information about making permanent changes. #
5 ################################################################################
6 */
7 
8 #include "qtzyre.h"
9 
10 ///
11 //  Copy-construct to return the proper wrapped c types
QZframe(zframe_t * self,QObject * qObjParent)12 QZframe::QZframe (zframe_t *self, QObject *qObjParent) : QObject (qObjParent)
13 {
14     this->self = self;
15 }
16 
17 
18 ///
19 //  Create a new frame. If size is not null, allocates the frame data
20 //  to the specified size. If additionally, data is not null, copies
21 //  size octets from the specified data into the frame body.
QZframe(const void * data,size_t size,QObject * qObjParent)22 QZframe::QZframe (const void *data, size_t size, QObject *qObjParent) : QObject (qObjParent)
23 {
24     this->self = zframe_new (data, size);
25 }
26 
27 ///
28 //  Create an empty (zero-sized) frame
newEmpty(QObject * qObjParent)29 QZframe* QZframe::newEmpty (QObject *qObjParent)
30 {
31     return new QZframe (zframe_new_empty (), qObjParent);
32 }
33 
34 ///
35 //  Create a frame with a specified string content.
from(const QString & string,QObject * qObjParent)36 QZframe* QZframe::from (const QString &string, QObject *qObjParent)
37 {
38     return new QZframe (zframe_from (string.toUtf8().data()), qObjParent);
39 }
40 
41 ///
42 //  Create a new frame from memory. Take ownership of the memory and calling the destructor
43 //  on destroy.
frommem(void * data,size_t size,zframe_destructor_fn destructor,void * hint,QObject * qObjParent)44 QZframe* QZframe::frommem (void *data, size_t size, zframe_destructor_fn destructor, void *hint, QObject *qObjParent)
45 {
46     return new QZframe (zframe_frommem (data, size, destructor, hint), qObjParent);
47 }
48 
49 ///
50 //  Receive frame from socket, returns zframe_t object or NULL if the recv
51 //  was interrupted. Does a blocking recv, if you want to not block then use
52 //  zpoller or zloop.
recv(void * source,QObject * qObjParent)53 QZframe* QZframe::recv (void *source, QObject *qObjParent)
54 {
55     return new QZframe (zframe_recv (source), qObjParent);
56 }
57 
58 ///
59 //  Destroy a frame
~QZframe()60 QZframe::~QZframe ()
61 {
62     zframe_destroy (&self);
63 }
64 
65 ///
66 //  Send a frame to a socket, destroy frame after sending.
67 //  Return -1 on error, 0 on success.
send(void * dest,int flags)68 int QZframe::send (void *dest, int flags)
69 {
70     int rv = zframe_send (&self, dest, flags);
71     return rv;
72 }
73 
74 ///
75 //  Return number of bytes in frame data
size()76 size_t QZframe::size ()
77 {
78     size_t rv = zframe_size (self);
79     return rv;
80 }
81 
82 ///
83 //  Return address of frame data
data()84 byte * QZframe::data ()
85 {
86     byte * rv = zframe_data (self);
87     return rv;
88 }
89 
90 ///
91 //  Return meta data property for frame
92 //  The caller shall not modify or free the returned value, which shall be
93 //  owned by the message.
meta(const QString & property)94 const QString QZframe::meta (const QString &property)
95 {
96     const QString rv = QString (zframe_meta (self, property.toUtf8().data()));
97     return rv;
98 }
99 
100 ///
101 //  Create a new frame that duplicates an existing frame. If frame is null,
102 //  or memory was exhausted, returns null.
dup()103 QZframe * QZframe::dup ()
104 {
105     QZframe *rv = new QZframe (zframe_dup (self));
106     return rv;
107 }
108 
109 ///
110 //  Return frame data encoded as printable hex string, useful for 0MQ UUIDs.
111 //  Caller must free string when finished with it.
strhex()112 QString QZframe::strhex ()
113 {
114     char *retStr_ = zframe_strhex (self);
115     QString rv = QString (retStr_);
116     zstr_free (&retStr_);
117     return rv;
118 }
119 
120 ///
121 //  Return frame data copied into freshly allocated string
122 //  Caller must free string when finished with it.
strdup()123 QString QZframe::strdup ()
124 {
125     char *retStr_ = zframe_strdup (self);
126     QString rv = QString (retStr_);
127     zstr_free (&retStr_);
128     return rv;
129 }
130 
131 ///
132 //  Return TRUE if frame body is equal to string, excluding terminator
streqNoConflict(const QString & string)133 bool QZframe::streqNoConflict (const QString &string)
134 {
135     bool rv = zframe_streq (self, string.toUtf8().data());
136     return rv;
137 }
138 
139 ///
140 //  Return frame MORE indicator (1 or 0), set when reading frame from socket
141 //  or by the zframe_set_more() method
more()142 int QZframe::more ()
143 {
144     int rv = zframe_more (self);
145     return rv;
146 }
147 
148 ///
149 //  Set frame MORE indicator (1 or 0). Note this is NOT used when sending
150 //  frame to socket, you have to specify flag explicitly.
setMore(int more)151 void QZframe::setMore (int more)
152 {
153     zframe_set_more (self, more);
154 
155 }
156 
157 ///
158 //  Return frame routing ID, if the frame came from a ZMQ_SERVER socket.
159 //  Else returns zero.
routingId()160 quint32 QZframe::routingId ()
161 {
162     uint32_t rv = zframe_routing_id (self);
163     return rv;
164 }
165 
166 ///
167 //  Set routing ID on frame. This is used if/when the frame is sent to a
168 //  ZMQ_SERVER socket.
setRoutingId(quint32 routingId)169 void QZframe::setRoutingId (quint32 routingId)
170 {
171     zframe_set_routing_id (self, (uint32_t) routingId);
172 
173 }
174 
175 ///
176 //  Return frame group of radio-dish pattern.
group()177 const QString QZframe::group ()
178 {
179     const QString rv = QString (zframe_group (self));
180     return rv;
181 }
182 
183 ///
184 //  Set group on frame. This is used if/when the frame is sent to a
185 //  ZMQ_RADIO socket.
186 //  Return -1 on error, 0 on success.
setGroup(const QString & group)187 int QZframe::setGroup (const QString &group)
188 {
189     int rv = zframe_set_group (self, group.toUtf8().data());
190     return rv;
191 }
192 
193 ///
194 //  Return TRUE if two frames have identical size and data
195 //  If either frame is NULL, equality is always false.
eq(QZframe * other)196 bool QZframe::eq (QZframe *other)
197 {
198     bool rv = zframe_eq (self, other->self);
199     return rv;
200 }
201 
202 ///
203 //  Set new contents for frame
reset(const void * data,size_t size)204 void QZframe::reset (const void *data, size_t size)
205 {
206     zframe_reset (self, data, size);
207 
208 }
209 
210 ///
211 //  Send message to zsys log sink (may be stdout, or system facility as
212 //  configured by zsys_set_logstream). Prefix shows before frame, if not null.
213 //  Long messages are truncated.
print(const QString & prefix)214 void QZframe::print (const QString &prefix)
215 {
216     zframe_print (self, prefix.toUtf8().data());
217 
218 }
219 
220 ///
221 //  Send message to zsys log sink (may be stdout, or system facility as
222 //  configured by zsys_set_logstream). Prefix shows before frame, if not null.
223 //  Message length is specified; no truncation unless length is zero.
224 //  Backwards compatible with zframe_print when length is zero.
printN(const QString & prefix,size_t length)225 void QZframe::printN (const QString &prefix, size_t length)
226 {
227     zframe_print_n (self, prefix.toUtf8().data(), length);
228 
229 }
230 
231 ///
232 //  Probe the supplied object, and report if it looks like a zframe_t.
is(void * self)233 bool QZframe::is (void *self)
234 {
235     bool rv = zframe_is (self);
236     return rv;
237 }
238 
239 ///
240 //  Self test of this class.
test(bool verbose)241 void QZframe::test (bool verbose)
242 {
243     zframe_test (verbose);
244 
245 }
246 /*
247 ################################################################################
248 #  THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY  #
249 #  Read the zproject/README.md for information about making permanent changes. #
250 ################################################################################
251 */
252