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