本文整理汇总了C++中BinaryOutput::writeString方法的典型用法代码示例。如果您正苦于以下问题:C++ BinaryOutput::writeString方法的具体用法?C++ BinaryOutput::writeString怎么用?C++ BinaryOutput::writeString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BinaryOutput
的用法示例。
在下文中一共展示了BinaryOutput::writeString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: serialize
void ServerDescription::serialize(BinaryOutput& b) const {
b.writeString(serverName);
applicationAddress.serialize(b);
b.writeString(applicationName);
b.writeInt32(maxClients);
b.writeInt32(currentClients);
b.writeString(data);
}
示例2: writeHeader
void writeHeader(BinaryOutput& b, const String& header) {
debugAssertM(header.size() < HEADER_LENGTH, "This header string is too long");
b.writeString(header, SpeedLoad::HEADER_LENGTH);
}
示例3: serialize
void serialize(BinaryOutput& b) const {
b.writeInt32(i32);
b.writeInt64(i64);
b.writeString(s);
b.writeFloat32(f);
}
示例4: encodeTGA
void GImage::encodeTGA(
BinaryOutput& out) const {
out.setEndian(G3D_LITTLE_ENDIAN);
// ID length
out.writeUInt8(0);
// Color map Type
out.writeUInt8(0);
// Type
out.writeUInt8(2);
// Color map
out.skip(5);
// x, y offsets
out.writeUInt16(0);
out.writeUInt16(0);
// Width & height
out.writeUInt16(m_width);
out.writeUInt16(m_height);
// Color depth
if (m_channels == 1) {
// Force RGB mode
out.writeUInt8(8 * 3);
} else {
out.writeUInt8(8 * m_channels);
}
// Image descriptor
if (m_channels < 4) {
// 0 alpha bits
out.writeUInt8(0);
} else {
// 8 alpha bits
out.writeUInt8(8);
}
// Image ID (zero length)
if (m_channels == 1) {
// Pixels are upside down in BGR format.
for (int y = m_height - 1; y >= 0; --y) {
for (int x = 0; x < m_width; ++x) {
uint8 p = (m_byte[(y * m_width + x)]);
out.writeUInt8(p);
out.writeUInt8(p);
out.writeUInt8(p);
}
}
} else if (m_channels == 3) {
// Pixels are upside down in BGR format.
for (int y = m_height - 1; y >= 0; --y) {
for (int x = 0; x < m_width; ++x) {
uint8* p = &(m_byte[3 * (y * m_width + x)]);
out.writeUInt8(p[2]);
out.writeUInt8(p[1]);
out.writeUInt8(p[0]);
}
}
} else {
// Pixels are upside down in BGRA format.
for (int y = m_height - 1; y >= 0; --y) {
for (int x = 0; x < m_width; ++x) {
uint8* p = &(m_byte[4 * (y * m_width + x)]);
out.writeUInt8(p[2]);
out.writeUInt8(p[1]);
out.writeUInt8(p[0]);
out.writeUInt8(p[3]);
}
}
}
// Write "TRUEVISION-XFILE " 18 bytes from the end
// (with null termination)
out.writeString("TRUEVISION-XFILE ");
}