LLVM  8.0.1
Public Member Functions | List of all members
llvm::msgpack::Writer Class Reference

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
 
Writeroperator= (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...
 

Detailed Description

Writes MessagePack objects to an output stream, one at a time.

Definition at line 41 of file MsgPackWriter.h.

Constructor & Destructor Documentation

◆ Writer() [1/2]

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.

Parameters
OSstream to output MessagePack objects to.
Compatiblewhen set, write in "Compatibility Mode".

◆ Writer() [2/2]

llvm::msgpack::Writer::Writer ( const Writer )
delete

Member Function Documentation

◆ operator=()

Writer& llvm::msgpack::Writer::operator= ( const Writer )
delete

◆ write() [1/6]

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().

◆ write() [2/6]

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().

◆ write() [3/6]

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.

◆ write() [4/6]

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().

◆ write() [5/6]

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().

◆ write() [6/6]

void Writer::write ( MemoryBufferRef  Buffer)

Write a memory buffer to the output stream.

The output will be in the smallest possible bin format.

Warning
Do not use this overload if in Compatible mode.

Definition at line 122 of file MsgPackWriter.cpp.

References assert(), llvm::MemoryBufferRef::getBufferSize(), llvm::MemoryBufferRef::getBufferStart(), and Size.

◆ writeArraySize()

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().

◆ writeExt()

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.

◆ writeMapSize()

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().

◆ writeNil()

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().


The documentation for this class was generated from the following files: