LLVM
8.0.1
|
A MessagePack scalar. More...
#include "llvm/BinaryFormat/MsgPackTypes.h"
Public Types | |
enum | ScalarKind { SK_Int, SK_UInt, SK_Nil, SK_Boolean, SK_Float, SK_String, SK_Binary } |
Public Types inherited from llvm::msgpack::Node | |
enum | NodeKind { NK_Scalar, NK_Array, NK_Map } |
Public Member Functions | |
ScalarNode (int64_t IntValue) | |
Construct an Int ScalarNode. More... | |
ScalarNode (int32_t IntValue) | |
Construct an Int ScalarNode. More... | |
ScalarNode (uint64_t UIntValue) | |
Construct an UInt ScalarNode. More... | |
ScalarNode (uint32_t UIntValue) | |
Construct an UInt ScalarNode. More... | |
ScalarNode () | |
Construct a Nil ScalarNode. More... | |
ScalarNode (bool BoolValue) | |
Construct a Boolean ScalarNode. More... | |
ScalarNode (double FloatValue) | |
Construct a Float ScalarNode. More... | |
ScalarNode (StringRef StringValue) | |
Construct a String ScalarNode. More... | |
ScalarNode (const char *StringValue) | |
Construct a String ScalarNode. More... | |
ScalarNode (std::string &&StringValue) | |
Construct a String ScalarNode. More... | |
ScalarNode (MemoryBufferRef BinaryValue) | |
Construct a Binary ScalarNode. More... | |
~ScalarNode () | |
ScalarNode & | operator= (const ScalarNode &RHS)=delete |
ScalarNode & | operator= (ScalarNode &&RHS) |
A ScalarNode can only be move assigned. More... | |
void | setScalarKind (ScalarKind SKind) |
Change the kind of this ScalarNode, zero initializing it to the new type. More... | |
ScalarKind | getScalarKind () |
Get the current kind of ScalarNode. More... | |
int64_t | getInt () |
Get the value of an Int scalar. More... | |
uint64_t | getUInt () |
Get the value of a UInt scalar. More... | |
bool | getBool () |
Get the value of an Boolean scalar. More... | |
double | getFloat () |
Get the value of an Float scalar. More... | |
StringRef | getString () |
Get the value of a String scalar. More... | |
StringRef | getBinary () |
Get the value of a Binary scalar. More... | |
void | write (Writer &MPWriter) override |
Write to a MessagePack writer MPWriter . More... | |
StringRef | inputYAML (StringRef ScalarStr) |
Parse a YAML scalar of the current ScalarKind from ScalarStr . More... | |
void | outputYAML (raw_ostream &OS) const |
Output a YAML scalar of the current ScalarKind into OS . More... | |
yaml::QuotingType | mustQuoteYAML (StringRef ScalarStr) const |
Determine which YAML quoting type the current value would need when output. More... | |
StringRef | getYAMLTag () const |
Get the YAML tag for the current ScalarKind. More... | |
Public Member Functions inherited from llvm::msgpack::Node | |
NodeKind | getKind () const |
Node (NodeKind Kind) | |
Construct a Node. Used by derived classes to track kind information. More... | |
virtual | ~Node ()=default |
Static Public Member Functions | |
static bool | classof (const Node *N) |
Static Public Member Functions inherited from llvm::msgpack::Node | |
static Expected< OptNodePtr > | read (Reader &MPReader) |
Read from a MessagePack reader MPReader , returning an error if one is encountered, or None if MPReader is at the end of stream, or some Node pointer if some type is read. More... | |
Public Attributes | |
bool | IgnoreTag = false |
Flag which affects how the type handles YAML tags when reading and writing. More... | |
int64_t | IntValue |
uint64_t | UIntValue |
bool | BoolValue |
double | FloatValue |
std::string | StringValue |
Static Public Attributes | |
static const char * | IntTag = "!int" |
static const char * | NilTag = "!nil" |
static const char * | BooleanTag = "!bool" |
static const char * | FloatTag = "!float" |
static const char * | StringTag = "!str" |
static const char * | BinaryTag = "!bin" |
A MessagePack scalar.
Definition at line 72 of file MsgPackTypes.h.
Enumerator | |
---|---|
SK_Int | |
SK_UInt | |
SK_Nil | |
SK_Boolean | |
SK_Float | |
SK_String | |
SK_Binary |
Definition at line 74 of file MsgPackTypes.h.
ScalarNode::ScalarNode | ( | int64_t | IntValue | ) |
Construct an Int ScalarNode.
Definition at line 123 of file MsgPackTypes.cpp.
ScalarNode::ScalarNode | ( | int32_t | IntValue | ) |
Construct an Int ScalarNode.
Definition at line 126 of file MsgPackTypes.cpp.
ScalarNode::ScalarNode | ( | uint64_t | UIntValue | ) |
Construct an UInt ScalarNode.
Definition at line 129 of file MsgPackTypes.cpp.
References IntValue, and ScalarNode().
llvm::msgpack::ScalarNode::ScalarNode | ( | uint32_t | UIntValue | ) |
Construct an UInt ScalarNode.
ScalarNode::ScalarNode | ( | ) |
Construct a Nil ScalarNode.
Definition at line 135 of file MsgPackTypes.cpp.
Referenced by ScalarNode().
ScalarNode::ScalarNode | ( | bool | BoolValue | ) |
Construct a Boolean ScalarNode.
Definition at line 137 of file MsgPackTypes.cpp.
ScalarNode::ScalarNode | ( | double | FloatValue | ) |
Construct a Float ScalarNode.
Definition at line 140 of file MsgPackTypes.cpp.
ScalarNode::ScalarNode | ( | StringRef | StringValue | ) |
Construct a String ScalarNode.
Definition at line 143 of file MsgPackTypes.cpp.
References StringValue.
Construct a String ScalarNode.
Definition at line 148 of file MsgPackTypes.cpp.
ScalarNode::ScalarNode | ( | std::string && | StringValue | ) |
Construct a String ScalarNode.
Definition at line 151 of file MsgPackTypes.cpp.
References StringValue.
ScalarNode::ScalarNode | ( | MemoryBufferRef | BinaryValue | ) |
Construct a Binary ScalarNode.
Definition at line 156 of file MsgPackTypes.cpp.
References llvm::MemoryBufferRef::getBuffer(), and StringValue.
ScalarNode::~ScalarNode | ( | ) |
Definition at line 161 of file MsgPackTypes.cpp.
Definition at line 207 of file MsgPackTypes.h.
References llvm::msgpack::Node::getKind(), llvm::msgpack::Node::NK_Scalar, and llvm::msgpack::Node::write().
|
inline |
Get the value of a Binary scalar.
Definition at line 202 of file MsgPackTypes.h.
References assert().
|
inline |
Get the value of an Boolean scalar.
Definition at line 178 of file MsgPackTypes.h.
References assert().
|
inline |
Get the value of an Float scalar.
Definition at line 186 of file MsgPackTypes.h.
References assert().
|
inline |
Get the value of an Int scalar.
Definition at line 162 of file MsgPackTypes.h.
References assert().
|
inline |
Get the current kind of ScalarNode.
Definition at line 157 of file MsgPackTypes.h.
|
inline |
Get the value of a String scalar.
Definition at line 194 of file MsgPackTypes.h.
References assert().
|
inline |
Get the value of a UInt scalar.
Definition at line 170 of file MsgPackTypes.h.
References assert().
StringRef ScalarNode::getYAMLTag | ( | ) | const |
Get the YAML tag for the current ScalarKind.
Definition at line 259 of file MsgPackTypes.cpp.
References BinaryTag, BooleanTag, FloatTag, IntTag, llvm_unreachable, NilTag, SK_Binary, SK_Boolean, SK_Float, SK_Int, SK_Nil, SK_String, SK_UInt, and StringTag.
Referenced by llvm::yaml::TaggedScalarTraits< msgpack::ScalarNode >::output().
Parse a YAML scalar of the current ScalarKind from ScalarStr
.
Definition at line 189 of file MsgPackTypes.cpp.
References BoolValue, FloatValue, llvm_unreachable, SK_Binary, SK_Boolean, SK_Float, SK_Int, SK_Nil, SK_String, SK_UInt, StringValue, and UIntValue.
Referenced by llvm::yaml::TaggedScalarTraits< msgpack::ScalarNode >::input().
yaml::QuotingType ScalarNode::mustQuoteYAML | ( | StringRef | ScalarStr | ) | const |
Determine which YAML quoting type the current value would need when output.
Definition at line 233 of file MsgPackTypes.cpp.
References BinaryTag, BooleanTag, FloatTag, IntTag, llvm_unreachable, NilTag, SK_Binary, SK_Boolean, SK_Float, SK_Int, SK_Nil, SK_String, SK_UInt, and StringTag.
Referenced by llvm::yaml::TaggedScalarTraits< msgpack::ScalarNode >::mustQuote().
|
delete |
ScalarNode & ScalarNode::operator= | ( | ScalarNode && | RHS | ) |
A ScalarNode can only be move assigned.
Definition at line 163 of file MsgPackTypes.cpp.
References BoolValue, FloatValue, SK_Binary, SK_Boolean, SK_Float, SK_Int, SK_Nil, SK_String, SK_UInt, StringValue, and UIntValue.
void ScalarNode::outputYAML | ( | raw_ostream & | OS | ) | const |
Output a YAML scalar of the current ScalarKind into OS
.
Definition at line 209 of file MsgPackTypes.cpp.
References BoolValue, FloatValue, SK_Binary, SK_Boolean, SK_Float, SK_Int, SK_Nil, SK_String, SK_UInt, StringValue, and UIntValue.
Referenced by llvm::yaml::TaggedScalarTraits< msgpack::ScalarNode >::output().
|
inline |
Change the kind of this ScalarNode, zero initializing it to the new type.
Definition at line 130 of file MsgPackTypes.h.
Referenced by llvm::yaml::TaggedScalarTraits< msgpack::ScalarNode >::input().
|
overridevirtual |
Write to a MessagePack writer MPWriter
.
Implements llvm::msgpack::Node.
Definition at line 279 of file MsgPackTypes.cpp.
References BoolValue, FloatValue, SK_Binary, SK_Boolean, SK_Float, SK_Int, SK_Nil, SK_String, SK_UInt, StringValue, UIntValue, llvm::msgpack::Writer::write(), and llvm::msgpack::Writer::writeNil().
Referenced by llvm::msgpack::Writer::write().
Definition at line 243 of file MsgPackTypes.h.
Referenced by getYAMLTag(), llvm::yaml::TaggedScalarTraits< msgpack::ScalarNode >::input(), and mustQuoteYAML().
Definition at line 240 of file MsgPackTypes.h.
Referenced by getYAMLTag(), llvm::yaml::TaggedScalarTraits< msgpack::ScalarNode >::input(), and mustQuoteYAML().
bool llvm::msgpack::ScalarNode::BoolValue |
Definition at line 94 of file MsgPackTypes.h.
Referenced by inputYAML(), operator=(), outputYAML(), and write().
Definition at line 241 of file MsgPackTypes.h.
Referenced by getYAMLTag(), llvm::yaml::TaggedScalarTraits< msgpack::ScalarNode >::input(), and mustQuoteYAML().
double llvm::msgpack::ScalarNode::FloatValue |
Definition at line 95 of file MsgPackTypes.h.
Referenced by inputYAML(), operator=(), outputYAML(), and write().
Flag which affects how the type handles YAML tags when reading and writing.
When false, tags are used when reading and writing. When reading, the tag is used to decide the ScalarKind before parsing. When writing, the tag is output along with the value.
When true, tags are ignored when reading and writing. When reading, the ScalarKind is always assumed to be String. When writing, the tag is not output.
Definition at line 236 of file MsgPackTypes.h.
Referenced by llvm::yaml::TaggedScalarTraits< msgpack::ScalarNode >::input(), and llvm::yaml::TaggedScalarTraits< msgpack::ScalarNode >::output().
Definition at line 238 of file MsgPackTypes.h.
Referenced by getYAMLTag(), llvm::yaml::TaggedScalarTraits< msgpack::ScalarNode >::input(), and mustQuoteYAML().
int64_t llvm::msgpack::ScalarNode::IntValue |
Definition at line 92 of file MsgPackTypes.h.
Referenced by ScalarNode().
Definition at line 239 of file MsgPackTypes.h.
Referenced by getYAMLTag(), llvm::yaml::TaggedScalarTraits< msgpack::ScalarNode >::input(), and mustQuoteYAML().
Definition at line 242 of file MsgPackTypes.h.
Referenced by getYAMLTag(), llvm::yaml::TaggedScalarTraits< msgpack::ScalarNode >::input(), and mustQuoteYAML().
std::string llvm::msgpack::ScalarNode::StringValue |
Definition at line 96 of file MsgPackTypes.h.
Referenced by inputYAML(), operator=(), outputYAML(), ScalarNode(), and write().
uint64_t llvm::msgpack::ScalarNode::UIntValue |
Definition at line 93 of file MsgPackTypes.h.
Referenced by inputYAML(), operator=(), outputYAML(), and write().