LLVM 22.0.0git
Public Types | Public Member Functions | Protected Attributes | Friends | List of all members
llvm::msgpack::DocNode Class Reference

A node in a MsgPack Document. More...

#include "llvm/BinaryFormat/MsgPackDocument.h"

Inheritance diagram for llvm::msgpack::DocNode:
[legend]

Public Types

typedef std::map< DocNode, DocNodeMapTy
 
typedef std::vector< DocNodeArrayTy
 

Public Member Functions

 DocNode ()
 
bool isMap () const
 
bool isArray () const
 
bool isScalar () const
 
bool isString () const
 
bool isEmpty () const
 
Type getKind () const
 
DocumentgetDocument () const
 
int64_t & getInt ()
 
uint64_tgetUInt ()
 
boolgetBool ()
 
double & getFloat ()
 
int64_t getInt () const
 
uint64_t getUInt () const
 
bool getBool () const
 
double getFloat () const
 
StringRef getString () const
 
MemoryBufferRef getBinary () const
 
ArrayDocNodegetArray (bool Convert=false)
 Get an ArrayDocNode for an array node.
 
MapDocNodegetMap (bool Convert=false)
 Get a MapDocNode for a map node.
 
LLVM_ABI std::string toString () const
 Convert this node to a string, assuming it is scalar.
 
LLVM_ABI StringRef fromString (StringRef S, StringRef Tag="")
 Convert the StringRef and use it to set this DocNode (assuming scalar).
 
DocNodeoperator= (const char *Val)
 Convenience assignment operators.
 
LLVM_ABI DocNodeoperator= (StringRef Val)
 
LLVM_ABI DocNodeoperator= (MemoryBufferRef Val)
 
LLVM_ABI DocNodeoperator= (bool Val)
 
LLVM_ABI DocNodeoperator= (int Val)
 
LLVM_ABI DocNodeoperator= (unsigned Val)
 
LLVM_ABI DocNodeoperator= (int64_t Val)
 
LLVM_ABI DocNodeoperator= (uint64_t Val)
 
LLVM_ABI DocNodeoperator= (double Val)
 

Protected Attributes

union {
   int64_t   Int
 
   uint64_t   UInt
 
   bool   Bool
 
   double   Float
 
   StringRef   Raw
 
   ArrayTy *   Array
 
   MapTy *   Map
 
}; 
 

Friends

bool operator< (const DocNode &Lhs, const DocNode &Rhs)
 Comparison operator, used for map keys.
 
bool operator== (const DocNode &Lhs, const DocNode &Rhs)
 Equality operator.
 
bool operator!= (const DocNode &Lhs, const DocNode &Rhs)
 Inequality operator.
 

Detailed Description

A node in a MsgPack Document.

This is a simple copyable and passable-by-value type that does not own any memory.

Definition at line 39 of file MsgPackDocument.h.

Member Typedef Documentation

◆ ArrayTy

Definition at line 44 of file MsgPackDocument.h.

◆ MapTy

Definition at line 43 of file MsgPackDocument.h.

Constructor & Destructor Documentation

◆ DocNode()

llvm::msgpack::DocNode::DocNode ( )
inline

Definition at line 68 of file MsgPackDocument.h.

Member Function Documentation

◆ fromString()

StringRef DocNode::fromString ( StringRef  S,
StringRef  Tag = "" 
)

Convert the StringRef and use it to set this DocNode (assuming scalar).

If it is a string, copy the string into the Document's strings list so we do not rely on S having a lifetime beyond this call. Tag is "" or a YAML tag.

Definition at line 69 of file MsgPackDocumentYAML.cpp.

References assert(), getBool(), getDocument(), getFloat(), getInt(), llvm::msgpack::Document::getNode(), getUInt(), and llvm::Tag.

◆ getArray()

ArrayDocNode & llvm::msgpack::DocNode::getArray ( bool  Convert = false)
inline

Get an ArrayDocNode for an array node.

If Convert, convert the node to an array node if necessary.

Definition at line 135 of file MsgPackDocument.h.

References llvm::msgpack::Array, assert(), and getKind().

Referenced by llvm::AMDGPU::HSAMD::MetadataStreamerMsgPackV4::emitKernel().

◆ getBinary()

MemoryBufferRef llvm::msgpack::DocNode::getBinary ( ) const
inline

Definition at line 128 of file MsgPackDocument.h.

References assert(), llvm::msgpack::Binary, getKind(), and Raw.

◆ getBool() [1/2]

bool & llvm::msgpack::DocNode::getBool ( )
inline

Definition at line 93 of file MsgPackDocument.h.

References assert(), Bool, llvm::msgpack::Boolean, and getKind().

Referenced by fromString().

◆ getBool() [2/2]

bool llvm::msgpack::DocNode::getBool ( ) const
inline

Definition at line 113 of file MsgPackDocument.h.

References assert(), Bool, llvm::msgpack::Boolean, and getKind().

◆ getDocument()

Document * llvm::msgpack::DocNode::getDocument ( ) const
inline

◆ getFloat() [1/2]

double & llvm::msgpack::DocNode::getFloat ( )
inline

Definition at line 98 of file MsgPackDocument.h.

References assert(), Float, llvm::msgpack::Float, and getKind().

Referenced by fromString().

◆ getFloat() [2/2]

double llvm::msgpack::DocNode::getFloat ( ) const
inline

Definition at line 118 of file MsgPackDocument.h.

References assert(), Float, llvm::msgpack::Float, and getKind().

◆ getInt() [1/2]

int64_t & llvm::msgpack::DocNode::getInt ( )
inline

Definition at line 83 of file MsgPackDocument.h.

References assert(), getKind(), Int, and llvm::msgpack::Int.

Referenced by fromString().

◆ getInt() [2/2]

int64_t llvm::msgpack::DocNode::getInt ( ) const
inline

Definition at line 103 of file MsgPackDocument.h.

References assert(), getKind(), Int, and llvm::msgpack::Int.

◆ getKind()

Type llvm::msgpack::DocNode::getKind ( ) const
inline

◆ getMap()

MapDocNode & llvm::msgpack::DocNode::getMap ( bool  Convert = false)
inline

◆ getString()

StringRef llvm::msgpack::DocNode::getString ( ) const
inline

Definition at line 123 of file MsgPackDocument.h.

References assert(), getKind(), Raw, and llvm::msgpack::String.

◆ getUInt() [1/2]

uint64_t & llvm::msgpack::DocNode::getUInt ( )
inline

Definition at line 88 of file MsgPackDocument.h.

References assert(), getKind(), UInt, and llvm::msgpack::UInt.

Referenced by fromString().

◆ getUInt() [2/2]

uint64_t llvm::msgpack::DocNode::getUInt ( ) const
inline

Definition at line 108 of file MsgPackDocument.h.

References assert(), getKind(), UInt, and llvm::msgpack::UInt.

◆ isArray()

bool llvm::msgpack::DocNode::isArray ( ) const
inline

Definition at line 72 of file MsgPackDocument.h.

References llvm::msgpack::Array, and getKind().

Referenced by isScalar(), and llvm::msgpack::Document::readFromBlob().

◆ isEmpty()

bool llvm::msgpack::DocNode::isEmpty ( ) const
inline

Definition at line 79 of file MsgPackDocument.h.

References llvm::msgpack::Empty, and getKind().

Referenced by llvm::msgpack::Document::readFromBlob().

◆ isMap()

bool llvm::msgpack::DocNode::isMap ( ) const
inline

◆ isScalar()

bool llvm::msgpack::DocNode::isScalar ( ) const
inline

Definition at line 73 of file MsgPackDocument.h.

References isArray(), and isMap().

◆ isString()

bool llvm::msgpack::DocNode::isString ( ) const
inline

Definition at line 74 of file MsgPackDocument.h.

References getKind(), and llvm::msgpack::String.

◆ operator=() [1/9]

DocNode & DocNode::operator= ( bool  Val)

Definition at line 87 of file MsgPackDocument.cpp.

References getDocument(), and llvm::msgpack::Document::getNode().

◆ operator=() [2/9]

DocNode & llvm::msgpack::DocNode::operator= ( const char Val)
inline

Convenience assignment operators.

This only works if the destination DocNode has an associated Document, i.e. it was not constructed using the default constructor. The string one does not copy, so the string must remain valid for the lifetime of the Document. Use fromString to avoid that restriction.

Definition at line 208 of file MsgPackDocument.h.

◆ operator=() [3/9]

DocNode & DocNode::operator= ( double  Val)

Definition at line 107 of file MsgPackDocument.cpp.

References getDocument(), and llvm::msgpack::Document::getNode().

◆ operator=() [4/9]

DocNode & DocNode::operator= ( int  Val)

Definition at line 91 of file MsgPackDocument.cpp.

References getDocument(), and llvm::msgpack::Document::getNode().

◆ operator=() [5/9]

DocNode & DocNode::operator= ( int64_t  Val)

Definition at line 99 of file MsgPackDocument.cpp.

References getDocument(), and llvm::msgpack::Document::getNode().

◆ operator=() [6/9]

DocNode & DocNode::operator= ( MemoryBufferRef  Val)

Definition at line 83 of file MsgPackDocument.cpp.

References getDocument(), and llvm::msgpack::Document::getNode().

◆ operator=() [7/9]

DocNode & DocNode::operator= ( StringRef  Val)

Definition at line 79 of file MsgPackDocument.cpp.

References getDocument(), and llvm::msgpack::Document::getNode().

◆ operator=() [8/9]

DocNode & DocNode::operator= ( uint64_t  Val)

Definition at line 103 of file MsgPackDocument.cpp.

References getDocument(), and llvm::msgpack::Document::getNode().

◆ operator=() [9/9]

DocNode & DocNode::operator= ( unsigned  Val)

Definition at line 95 of file MsgPackDocument.cpp.

References getDocument(), and llvm::msgpack::Document::getNode().

◆ toString()

std::string DocNode::toString ( ) const

Convert this node to a string, assuming it is scalar.

Convert this DocNode to a string, assuming it is scalar.

Definition at line 35 of file MsgPackDocumentYAML.cpp.

References Bool, llvm::msgpack::Boolean, Float, llvm::msgpack::Float, llvm::format(), getDocument(), llvm::msgpack::Document::getHexMode(), getKind(), Int, llvm::msgpack::Int, llvm_unreachable, llvm::msgpack::Nil, OS, Raw, llvm::msgpack::String, UInt, and llvm::msgpack::UInt.

Friends And Related Function Documentation

◆ operator!=

bool operator!= ( const DocNode Lhs,
const DocNode Rhs 
)
friend

Inequality operator.

Definition at line 191 of file MsgPackDocument.h.

◆ operator<

bool operator< ( const DocNode Lhs,
const DocNode Rhs 
)
friend

Comparison operator, used for map keys.

Definition at line 156 of file MsgPackDocument.h.

◆ operator==

bool operator== ( const DocNode Lhs,
const DocNode Rhs 
)
friend

Equality operator.

Definition at line 186 of file MsgPackDocument.h.

Member Data Documentation

◆ 

union { ... } llvm::msgpack::DocNode::@170

◆ Array

ArrayTy* llvm::msgpack::DocNode::Array

◆ Bool

bool llvm::msgpack::DocNode::Bool

Definition at line 58 of file MsgPackDocument.h.

Referenced by getBool(), and toString().

◆ Float

double llvm::msgpack::DocNode::Float

Definition at line 59 of file MsgPackDocument.h.

Referenced by getFloat(), and toString().

◆ Int

int64_t llvm::msgpack::DocNode::Int

Definition at line 56 of file MsgPackDocument.h.

Referenced by getInt(), and toString().

◆ Map

MapTy* llvm::msgpack::DocNode::Map

◆ Raw

StringRef llvm::msgpack::DocNode::Raw

Definition at line 60 of file MsgPackDocument.h.

Referenced by getBinary(), getString(), and toString().

◆ UInt

uint64_t llvm::msgpack::DocNode::UInt

Definition at line 57 of file MsgPackDocument.h.

Referenced by getUInt(), and toString().


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