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:955
Member Variables
- private llvm::SmallVector<State, 16> Stack
- private llvm::StringRef PendingComment
- private llvm::raw_ostream& OS
- private unsigned int IndentSize
- private unsigned int Indent = 0
Method Overview
- public OStream(llvm::raw_ostream & OS, unsigned int IndentSize = 0)
- public void array(llvm::json::OStream::Block Contents)
- public void arrayBegin()
- public void arrayEnd()
- public void attribute(llvm::StringRef Key, const llvm::json::Value & Contents)
- public void attributeArray(llvm::StringRef Key, llvm::json::OStream::Block Contents)
- public void attributeBegin(llvm::StringRef Key)
- public void attributeEnd()
- private void attributeImpl(llvm::StringRef Key, llvm::json::OStream::Block Contents)
- public void attributeObject(llvm::StringRef Key, llvm::json::OStream::Block Contents)
- public void comment(llvm::StringRef)
- public void flush()
- private void flushComment()
- private void newline()
- public void object(llvm::json::OStream::Block Contents)
- public void objectBegin()
- public void objectEnd()
- public void rawValue(llvm::StringRef Contents)
- public void rawValue(llvm::function_ref<void (raw_ostream &)> Contents)
- public llvm::raw_ostream & rawValueBegin()
- public void rawValueEnd()
- public void value(const llvm::json::Value & V)
- private void valueBegin()
- public ~OStream()
Methods
¶OStream(llvm::raw_ostream& OS,
unsigned int IndentSize = 0)
OStream(llvm::raw_ostream& OS,
unsigned int IndentSize = 0)
Declared at: llvm/include/llvm/Support/JSON.h:959
Parameters
- llvm::raw_ostream& OS
- unsigned int IndentSize = 0
¶void array(llvm::json::OStream::Block Contents)
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:979
Parameters
- llvm::json::OStream::Block Contents
¶void arrayBegin()
void arrayBegin()
Declared at: llvm/include/llvm/Support/JSON.h:1025
¶void arrayEnd()
void arrayEnd()
Declared at: llvm/include/llvm/Support/JSON.h:1026
¶void attribute(llvm::StringRef Key,
const llvm::json::Value& Contents)
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:1010
Parameters
- llvm::StringRef Key
- const llvm::json::Value& Contents
¶void attributeArray(
llvm::StringRef Key,
llvm::json::OStream::Block 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:1014
Parameters
- llvm::StringRef Key
- llvm::json::OStream::Block Contents
¶void attributeBegin(llvm::StringRef Key)
void attributeBegin(llvm::StringRef Key)
Declared at: llvm/include/llvm/Support/JSON.h:1029
Parameters
- llvm::StringRef Key
¶void attributeEnd()
void attributeEnd()
Declared at: llvm/include/llvm/Support/JSON.h:1030
¶void attributeImpl(
llvm::StringRef Key,
llvm::json::OStream::Block Contents)
void attributeImpl(
llvm::StringRef Key,
llvm::json::OStream::Block Contents)
Declared at: llvm/include/llvm/Support/JSON.h:1035
Parameters
- llvm::StringRef Key
- llvm::json::OStream::Block Contents
¶void attributeObject(
llvm::StringRef Key,
llvm::json::OStream::Block Contents)
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:1018
Parameters
- llvm::StringRef Key
- llvm::json::OStream::Block Contents
¶void comment(llvm::StringRef)
void comment(llvm::StringRef)
Description
Emit a JavaScript comment associated with the next printed value. The string must be valid until the next attribute or value is emitted. Comments are not part of standard JSON, and many parsers reject them!
Declared at: llvm/include/llvm/Support/JSON.h:1004
Parameters
¶void flush()
void flush()
Description
Flushes the underlying ostream. OStream does not buffer internally.
Declared at: llvm/include/llvm/Support/JSON.h:970
¶void flushComment()
void flushComment()
Declared at: llvm/include/llvm/Support/JSON.h:1042
¶void newline()
void newline()
Declared at: llvm/include/llvm/Support/JSON.h:1043
¶void object(llvm::json::OStream::Block Contents)
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:985
Parameters
- llvm::json::OStream::Block Contents
¶void objectBegin()
void objectBegin()
Declared at: llvm/include/llvm/Support/JSON.h:1027
¶void objectEnd()
void objectEnd()
Declared at: llvm/include/llvm/Support/JSON.h:1028
¶void rawValue(llvm::StringRef Contents)
void rawValue(llvm::StringRef Contents)
Declared at: llvm/include/llvm/Support/JSON.h:998
Parameters
- llvm::StringRef Contents
¶void rawValue(
llvm::function_ref<void(raw_ostream&)>
Contents)
void rawValue(
llvm::function_ref<void(raw_ostream&)>
Contents)
Description
Emit an externally-serialized value. The caller must write exactly one valid JSON value to the provided stream. No validation or formatting of this value occurs.
Declared at: llvm/include/llvm/Support/JSON.h:993
Parameters
- llvm::function_ref<void(raw_ostream&)> Contents
¶llvm::raw_ostream& rawValueBegin()
llvm::raw_ostream& rawValueBegin()
Declared at: llvm/include/llvm/Support/JSON.h:1031
¶void rawValueEnd()
void rawValueEnd()
Declared at: llvm/include/llvm/Support/JSON.h:1032
¶void value(const llvm::json::Value& V)
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:977
Parameters
- const llvm::json::Value& V
¶void valueBegin()
void valueBegin()
Declared at: llvm/include/llvm/Support/JSON.h:1041
¶~OStream()
~OStream()
Declared at: llvm/include/llvm/Support/JSON.h:963