class OStream

Declaration

class OStream { /* full declaration omitted */ };

Description

for (const Event &E : Events) { J.objectBegin(); J.attribute("timestamp", int64_t(E.Time)); J.attributeBegin("participants"); for (const Participant &P : E.Participants) J.value(P.toString()); J.attributeEnd(); J.objectEnd(); } J.arrayEnd(); If the call sequence isn't valid JSON, asserts will fire in debug mode. This can be mismatched begin()/end() pairs, trying to emit attributes inside an array, and so on. With asserts disabled, this is undefined behavior.

Declared at: llvm/include/llvm/Support/JSON.h:756

Method Overview

Methods

OStream(llvm::raw_ostream& OS,
        unsigned int IndentSize = 0)

Declared at: llvm/include/llvm/Support/JSON.h:760

Parameters

llvm::raw_ostream& OS
unsigned int IndentSize = 0

void array(llvm::json::OStream::Block Contents)

Description

Emit an array whose elements are emitted in the provided Block.

Declared at: llvm/include/llvm/Support/JSON.h:780

Parameters

llvm::json::OStream::Block Contents

void arrayBegin()

Declared at: llvm/include/llvm/Support/JSON.h:811

void arrayEnd()

Declared at: llvm/include/llvm/Support/JSON.h:812

void attribute(llvm::StringRef Key,
               const llvm::json::Value& Contents)

Description

Emit an attribute whose value is self-contained (number, vector <int > etc).

Declared at: llvm/include/llvm/Support/JSON.h:796

Parameters

llvm::StringRef Key
const llvm::json::Value& Contents

void attributeArray(
    llvm::StringRef Key,
    llvm::json::OStream::Block Contents)

Description

Emit an attribute whose value is an array with elements from the Block.

Declared at: llvm/include/llvm/Support/JSON.h:800

Parameters

llvm::StringRef Key
llvm::json::OStream::Block Contents

void attributeBegin(llvm::StringRef Key)

Declared at: llvm/include/llvm/Support/JSON.h:815

Parameters

llvm::StringRef Key

void attributeEnd()

Declared at: llvm/include/llvm/Support/JSON.h:816

void attributeObject(
    llvm::StringRef Key,
    llvm::json::OStream::Block Contents)

Description

Emit an attribute whose value is an object with attributes from the Block.

Declared at: llvm/include/llvm/Support/JSON.h:804

Parameters

llvm::StringRef Key
llvm::json::OStream::Block Contents

void flush()

Description

Flushes the underlying ostream. OStream does not buffer internally.

Declared at: llvm/include/llvm/Support/JSON.h:771

void object(llvm::json::OStream::Block Contents)

Description

Emit an object whose elements are emitted in the provided Block.

Declared at: llvm/include/llvm/Support/JSON.h:786

Parameters

llvm::json::OStream::Block Contents

void objectBegin()

Declared at: llvm/include/llvm/Support/JSON.h:813

void objectEnd()

Declared at: llvm/include/llvm/Support/JSON.h:814

void value(const llvm::json::Value& V)

Description

Emit a self-contained value (number, string, vector <string > etc).

Declared at: llvm/include/llvm/Support/JSON.h:778

Parameters

const llvm::json::Value& V

~OStream()

Declared at: llvm/include/llvm/Support/JSON.h:764