LLVM  11.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:
Inheritance graph
[legend]
Collaboration diagram for llvm::msgpack::DocNode:
Collaboration graph
[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_t & getUInt ()
 
boolgetBool ()
 
double & getFloat ()
 
int64_t getInt () const
 
uint64_t getUInt () const
 
bool getBool () const
 
double getFloat () const
 
StringRef getString () const
 
ArrayDocNodegetArray (bool Convert=false)
 Get an ArrayDocNode for an array node. More...
 
MapDocNodegetMap (bool Convert=false)
 Get a MapDocNode for a map node. More...
 
std::string toString () const
 Convert this node to a string, assuming it is scalar. More...
 
StringRef fromString (StringRef S, StringRef Tag="")
 Convert the StringRef and use it to set this DocNode (assuming scalar). More...
 
DocNodeoperator= (const char *Val)
 Convenience assignment operators. More...
 
DocNodeoperator= (StringRef Val)
 
DocNodeoperator= (bool Val)
 
DocNodeoperator= (int Val)
 
DocNodeoperator= (unsigned Val)
 
DocNodeoperator= (int64_t Val)
 
DocNodeoperator= (uint64_t 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. More...
 
bool operator== (const DocNode &Lhs, const DocNode &Rhs)
 Equality operator. More...
 
bool operator!= (const DocNode &Lhs, const DocNode &Rhs)
 Inequality operator. More...
 

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 38 of file MsgPackDocument.h.

Member Typedef Documentation

◆ ArrayTy

Definition at line 43 of file MsgPackDocument.h.

◆ MapTy

Definition at line 42 of file MsgPackDocument.h.

Constructor & Destructor Documentation

◆ DocNode()

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

Definition at line 67 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 70 of file MsgPackDocumentYAML.cpp.

◆ 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 129 of file MsgPackDocument.h.

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

Referenced by llvm::yaml::PolymorphicTraits< DocNode >::getAsSequence(), and getStageName().

◆ getBool() [1/2]

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

Definition at line 92 of file MsgPackDocument.h.

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

◆ getBool() [2/2]

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

Definition at line 112 of file MsgPackDocument.h.

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

◆ getDocument()

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

◆ getFloat() [1/2]

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

Definition at line 97 of file MsgPackDocument.h.

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

◆ getFloat() [2/2]

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

Definition at line 117 of file MsgPackDocument.h.

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

◆ getInt() [1/2]

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

Definition at line 82 of file MsgPackDocument.h.

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

◆ getInt() [2/2]

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

Definition at line 102 of file MsgPackDocument.h.

References assert(), 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 122 of file MsgPackDocument.h.

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

◆ getUInt() [1/2]

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

Definition at line 87 of file MsgPackDocument.h.

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

◆ getUInt() [2/2]

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

Definition at line 107 of file MsgPackDocument.h.

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

◆ isArray()

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

Definition at line 71 of file MsgPackDocument.h.

References llvm::msgpack::Array.

◆ isEmpty()

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

◆ isMap()

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

Definition at line 70 of file MsgPackDocument.h.

References llvm::msgpack::Map.

Referenced by llvm::AMDGPU::HSAMD::V3::MetadataVerifier::verify().

◆ isScalar()

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

Definition at line 72 of file MsgPackDocument.h.

References isArray().

◆ isString()

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

Definition at line 73 of file MsgPackDocument.h.

References llvm::msgpack::String.

◆ operator=() [1/7]

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 202 of file MsgPackDocument.h.

◆ operator=() [2/7]

DocNode & DocNode::operator= ( StringRef  Val)

Definition at line 79 of file MsgPackDocument.cpp.

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

◆ operator=() [3/7]

DocNode & DocNode::operator= ( bool  Val)

Definition at line 83 of file MsgPackDocument.cpp.

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

◆ operator=() [4/7]

DocNode & DocNode::operator= ( int  Val)

Definition at line 87 of file MsgPackDocument.cpp.

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

◆ operator=() [5/7]

DocNode & DocNode::operator= ( unsigned  Val)

Definition at line 91 of file MsgPackDocument.cpp.

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

◆ operator=() [6/7]

DocNode & DocNode::operator= ( int64_t  Val)

Definition at line 95 of file MsgPackDocument.cpp.

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

◆ operator=() [7/7]

DocNode & DocNode::operator= ( uint64_t  Val)

Definition at line 99 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 36 of file MsgPackDocumentYAML.cpp.

References llvm::msgpack::Boolean, llvm::msgpack::Float, llvm::format(), llvm::msgpack::Int, llvm_unreachable, llvm::msgpack::Nil, llvm::raw_string_ostream::str(), llvm::msgpack::String, and llvm::msgpack::UInt.

Friends And Related Function Documentation

◆ operator!=

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

Inequality operator.

Definition at line 185 of file MsgPackDocument.h.

◆ operator<

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

Comparison operator, used for map keys.

Definition at line 150 of file MsgPackDocument.h.

◆ operator==

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

Equality operator.

Definition at line 180 of file MsgPackDocument.h.

Member Data Documentation

◆ @137

union { ... }

◆ Array

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

Definition at line 60 of file MsgPackDocument.h.

Referenced by llvm::msgpack::ArrayDocNode::operator[]().

◆ Bool

bool llvm::msgpack::DocNode::Bool

Definition at line 57 of file MsgPackDocument.h.

◆ Float

double llvm::msgpack::DocNode::Float

Definition at line 58 of file MsgPackDocument.h.

◆ Int

int64_t llvm::msgpack::DocNode::Int

Definition at line 55 of file MsgPackDocument.h.

◆ Map

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

Definition at line 61 of file MsgPackDocument.h.

◆ Raw

StringRef llvm::msgpack::DocNode::Raw

Definition at line 59 of file MsgPackDocument.h.

◆ UInt

uint64_t llvm::msgpack::DocNode::UInt

Definition at line 56 of file MsgPackDocument.h.


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