LLVM
16.0.0git
|
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 25 of file MsgPackWriter.cpp.
References b, and llvm::support::endian::Writer::write().
Referenced by write().
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 88 of file MsgPackWriter.cpp.
References d, llvm::max(), llvm::min(), and llvm::support::endian::Writer::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 27 of file MsgPackWriter.cpp.
References i, llvm::pdb::Int8, llvm::support::endian::Writer::write(), and write().
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 121 of file MsgPackWriter.cpp.
References assert(), llvm::MemoryBufferRef::getBufferSize(), llvm::MemoryBufferRef::getBufferStart(), llvm::support::endian::Writer::OS, llvm::support::endian::Writer::write(), and llvm::raw_ostream::write().
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 101 of file MsgPackWriter.cpp.
References assert(), llvm::support::endian::Writer::OS, s, and llvm::support::endian::Writer::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 60 of file MsgPackWriter.cpp.
References llvm::pdb::UInt8, and llvm::support::endian::Writer::write().
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 141 of file MsgPackWriter.cpp.
References llvm::support::endian::Writer::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 173 of file MsgPackWriter.cpp.
References assert(), llvm::MemoryBufferRef::getBufferSize(), llvm::MemoryBufferRef::getBufferStart(), llvm::support::endian::Writer::OS, llvm::support::endian::Writer::write(), and llvm::raw_ostream::write().
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 157 of file MsgPackWriter.cpp.
References llvm::support::endian::Writer::write().
void Writer::writeNil | ( | ) |
Write a Nil to the output stream.
The output will be the nil format.
Definition at line 23 of file MsgPackWriter.cpp.
References llvm::support::endian::Writer::write().