LLVM
8.0.1
|
Writes MessagePack objects to an output stream, one at a time. More...
#include "llvm/BinaryFormat/MsgPackWriter.h"
Public Member Functions | |
Writer (raw_ostream &OS, bool Compatible=false) | |
Construct a writer, optionally enabling "Compatibility Mode" as defined in the MessagePack specification. More... | |
Writer (const Writer &)=delete | |
Writer & | operator= (const Writer &)=delete |
void | writeNil () |
Write a Nil to the output stream. More... | |
void | write (bool b) |
Write a Boolean to the output stream. More... | |
void | write (int64_t i) |
Write a signed integer to the output stream. More... | |
void | write (uint64_t u) |
Write an unsigned integer to the output stream. More... | |
void | write (double d) |
Write a floating point number to the output stream. More... | |
void | write (StringRef s) |
Write a string to the output stream. More... | |
void | write (MemoryBufferRef Buffer) |
Write a memory buffer to the output stream. More... | |
void | writeArraySize (uint32_t Size) |
Write the header for an Array of the given size. More... | |
void | writeMapSize (uint32_t Size) |
Write the header for a Map of the given size. More... | |
void | writeExt (int8_t Type, MemoryBufferRef Buffer) |
Write a typed memory buffer (an extension type) to the output stream. More... | |
Writes MessagePack objects to an output stream, one at a time.
Definition at line 41 of file MsgPackWriter.h.
llvm::msgpack::Writer::Writer | ( | raw_ostream & | OS, |
bool | Compatible = false |
||
) |
Construct a writer, optionally enabling "Compatibility Mode" as defined in the MessagePack specification.
When in Compatible
mode, the writer will write Str16
formats instead of Str8
formats, and will refuse to write any Bin
formats.
OS | stream to output MessagePack objects to. |
Compatible | when set, write in "Compatibility Mode". |
void Writer::write | ( | bool | b | ) |
Write a Boolean to the output stream.
The output will be a bool format.
Definition at line 26 of file MsgPackWriter.cpp.
Referenced by llvm::msgpack::ScalarNode::write(), and llvm::msgpack::MapNode::write().
void Writer::write | ( | int64_t | i | ) |
Write a signed integer to the output stream.
The output will be in the smallest possible int format.
The format chosen may be for an unsigned integer.
Definition at line 28 of file MsgPackWriter.cpp.
References llvm::pdb::Int8, and llvm::msgpack::ScalarNode::write().
void Writer::write | ( | uint64_t | u | ) |
Write an unsigned integer to the output stream.
The output will be in the smallest possible int format.
Definition at line 61 of file MsgPackWriter.cpp.
References llvm::pdb::UInt8.
void Writer::write | ( | double | d | ) |
Write a floating point number to the output stream.
The output will be in the smallest possible float format.
Definition at line 89 of file MsgPackWriter.cpp.
References llvm::Intrinsic::fabs, and llvm::max().
void Writer::write | ( | StringRef | s | ) |
Write a string to the output stream.
The output will be in the smallest possible str format.
Definition at line 102 of file MsgPackWriter.cpp.
References assert(), Size, and llvm::StringRef::size().
void Writer::write | ( | MemoryBufferRef | Buffer | ) |
Write a memory buffer to the output stream.
The output will be in the smallest possible bin format.
Compatible
mode. Definition at line 122 of file MsgPackWriter.cpp.
References assert(), llvm::MemoryBufferRef::getBufferSize(), llvm::MemoryBufferRef::getBufferStart(), and Size.
void Writer::writeArraySize | ( | uint32_t | Size | ) |
Write the header for an Array of the given size.
The output will be in the smallest possible array format. The header contains an identifier for the array format used, as well as an encoding of the size of the array.
N.B. The caller must subsequently call Write
an additional Size
times to complete the array.
Definition at line 142 of file MsgPackWriter.cpp.
Referenced by llvm::msgpack::ArrayNode::write().
void Writer::writeExt | ( | int8_t | Type, |
MemoryBufferRef | Buffer | ||
) |
Write a typed memory buffer (an extension type) to the output stream.
The output will be in the smallest possible ext format.
Definition at line 174 of file MsgPackWriter.cpp.
References assert(), llvm::MemoryBufferRef::getBufferSize(), llvm::MemoryBufferRef::getBufferStart(), and Size.
void Writer::writeMapSize | ( | uint32_t | Size | ) |
Write the header for a Map of the given size.
The output will be in the smallest possible map format. The header contains an identifier for the map format used, as well as an encoding of the size of the map.
N.B. The caller must subsequently call Write
and additional Size*2
times to complete the map. Each even numbered call to Write
defines a new key, and each odd numbered call defines the previous key's value.
Definition at line 158 of file MsgPackWriter.cpp.
Referenced by llvm::msgpack::MapNode::write().
void Writer::writeNil | ( | ) |
Write a Nil to the output stream.
The output will be the nil format.
Definition at line 24 of file MsgPackWriter.cpp.
Referenced by llvm::msgpack::ScalarNode::write().