void writeHeader(const String& name, uint8_t msgtype, uint32_t seqid) { writeUByte(PROTOCOL_ID); writeUByte(version | (msgtype << TYPE_SHIFT_AMOUNT)); writeVarint(seqid); writeString(name); state = STATE_VALUE_WRITE; }
void ASMStream::writeBString(const String &s) { writeUByte(static_cast<uint8_t>(s.length())); for(uint32_t i = 0; i < s.length(); i++) { stream.write(static_cast<uint8_t>(s[i])); if(i == 0xFF) { break; } } }
void MessageEncoder::writeHeader(const Header& msg) { size_t fields(optimise ? optimisable(msg) : 5); if (fields) { void* token = startList8(&qpid::amqp::message::HEADER); writeBoolean(msg.isDurable()); if (fields > 1) writeUByte(msg.getPriority()); if (msg.getTtl()) writeUInt(msg.getTtl()); else if (fields > 2) writeNull(); if (msg.isFirstAcquirer()) writeBoolean(true); else if (fields > 3) writeNull(); if (msg.getDeliveryCount()) writeUInt(msg.getDeliveryCount()); else if (fields > 4) writeNull(); endList8(fields, token); } }
static Boln writeHeader (tkimg_MFile *handle, TGAHEADER *th) { if (!writeUByte (handle, th->numid) || !writeUByte (handle, th->maptyp) || !writeUByte (handle, th->imgtyp) || !writeShort (handle, th->maporig) || !writeShort (handle, th->mapsize) || !writeUByte (handle, th->mapbits) || !writeShort (handle, th->xorig) || !writeShort (handle, th->yorig) || !writeShort (handle, th->xsize) || !writeShort (handle, th->ysize) || !writeUByte (handle, th->pixsize) || !writeUByte (handle, th->imgdes)) return FALSE; return TRUE; }
void MessageEncoder::writeMap(const qpid::types::Variant::Map& properties, const Descriptor* d, bool large) { void* token = large ? startMap32(d) : startMap8(d); for (qpid::types::Variant::Map::const_iterator i = properties.begin(); i != properties.end(); ++i) { writeString(i->first); switch (i->second.getType()) { case qpid::types::VAR_MAP: case qpid::types::VAR_LIST: //not allowed (TODO: revise, only strictly true for application-properties) whereas this is now a more general method) QPID_LOG(warning, "Ignoring nested map/list; not allowed in application-properties for AMQP 1.0"); case qpid::types::VAR_VOID: writeNull(); break; case qpid::types::VAR_BOOL: writeBoolean(i->second); break; case qpid::types::VAR_UINT8: writeUByte(i->second); break; case qpid::types::VAR_UINT16: writeUShort(i->second); break; case qpid::types::VAR_UINT32: writeUInt(i->second); break; case qpid::types::VAR_UINT64: writeULong(i->second); break; case qpid::types::VAR_INT8: writeByte(i->second); break; case qpid::types::VAR_INT16: writeShort(i->second); break; case qpid::types::VAR_INT32: writeInt(i->second); break; case qpid::types::VAR_INT64: writeULong(i->second); break; case qpid::types::VAR_FLOAT: writeFloat(i->second); break; case qpid::types::VAR_DOUBLE: writeDouble(i->second); break; case qpid::types::VAR_STRING: if (i->second.getEncoding() == BINARY) { writeBinary(i->second); } else { writeString(i->second); } break; case qpid::types::VAR_UUID: writeUuid(i->second); break; } } if (large) endMap32(properties.size()*2, token); else endMap8(properties.size()*2, token); }