本文整理汇总了C++中std::ostringstream::write方法的典型用法代码示例。如果您正苦于以下问题:C++ ostringstream::write方法的具体用法?C++ ostringstream::write怎么用?C++ ostringstream::write使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std::ostringstream
的用法示例。
在下文中一共展示了ostringstream::write方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
static inline void sd_write_aligned_blob(std::ostringstream &buf, void *b, int b_size,
const char *name)
{
sd_write_name(buf, name);
/* pad calculation MUST come after name is written */
size_t pad = align64(buf.tellp() + ((std::streamoff) 5l)) - (buf.tellp() + ((std::streamoff) 5l));
sd_write8(buf, SD_BLOB);
sd_write32(buf, b_size + pad);
buf.write(zeros, pad);
buf.write((const char *) b, b_size);
}
示例2: add_state_attribute
inline void add_state_attribute(std::ostringstream &out, bool &first, state st, const char (&name) [N])
{
if (m_state & st) {
if (first)
first = false;
else
out.write("|", 1);
out.write(name, N - 1);
}
}
示例3: WriteMeshIndicesBinary_Generic
void WriteMeshIndicesBinary_Generic(const aiMesh* m, unsigned int offset, std::ostringstream& output)
{
for (unsigned int i = 0; i < m->mNumFaces; ++i) {
const aiFace& f = m->mFaces[i];
NumIndicesType numIndices = static_cast<NumIndicesType>(f.mNumIndices);
output.write(reinterpret_cast<const char*>(&numIndices), sizeof(NumIndicesType));
for (unsigned int c = 0; c < f.mNumIndices; ++c) {
IndexType index = f.mIndices[c] + offset;
output.write(reinterpret_cast<const char*>(&index), sizeof(IndexType));
}
}
}
示例4: sd_write_strn
static void sd_write_strn(std::ostringstream &buf, char *b, int size, const char *name)
{
sd_write_name(buf, name);
sd_write8(buf, SD_STRING);
sd_write16(buf, size);
buf.write(b, size);
}
示例5: sendBuffer
Variant ClientBase::sendBuffer(char type, RequestID requestID, std::ostringstream &stream)
{
unsigned int size = (unsigned int)stream.tellp();
size -= sizeof(size);
stream.seekp(0);
stream.write((const char*)&size, sizeof(size));
RequestData rd;
rd.type = MessageType(type);
rd.id = requestID;
rd.data = stream.str();
if(asyncMode())
{
rd.writeCompletePtr.reset(new FutureResult);
bool empty = m_messageQueue.empty();
m_messageQueue.push(rd);
if(empty)
{
writeData(m_messageQueue.front().data);
}
return rd.writeCompletePtr;
}
else
{
writeData(rd.data);
}
return Variant();
}
示例6: int
const std::string& ColorPalette::interpret(
const sf::Color& color, std::string& str) {
conv.write("[ ", 2);
conv << int(color.r);
conv.write(" ; ", 3);
conv << int(color.g);
conv.write(" ; ", 3);
conv << int(color.b);
conv.write(" ]", 2);
str.assign(conv.str());
conv.str("");
return str;
}
示例7: strlen
static inline void sd_write_name(std::ostringstream &buf, const char *name)
{
PDEBUG("Writing name '%s'\n", name);
if (name) {
sd_write8(buf, SD_NAME);
sd_write16(buf, strlen(name) + 1);
buf.write(name, strlen(name) + 1);
}
}
示例8: write
size_t write(const void * data, size_t size)
{
stream.write((const char*)data, size);
return size;
}
示例9: serializeEvent
void CHeroAddScore::serializeEvent(std::ostringstream& buffer) const
{
buffer.write((char*)&m_playerId,sizeof(UInt8));
buffer.write((char*)&m_score,sizeof(UInt32));
}