LLVM  9.0.0svn
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...
 

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...
 

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 65 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 125 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 88 of file MsgPackDocument.h.

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

◆ getBool() [2/2]

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

Definition at line 108 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 93 of file MsgPackDocument.h.

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

◆ getFloat() [2/2]

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

Definition at line 113 of file MsgPackDocument.h.

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

◆ getInt() [1/2]

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

Definition at line 78 of file MsgPackDocument.h.

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

◆ getInt() [2/2]

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

Definition at line 98 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 118 of file MsgPackDocument.h.

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

◆ getUInt() [1/2]

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

Definition at line 83 of file MsgPackDocument.h.

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

◆ getUInt() [2/2]

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

Definition at line 103 of file MsgPackDocument.h.

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

◆ isArray()

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

Definition at line 69 of file MsgPackDocument.h.

References llvm::msgpack::Array.

◆ isEmpty()

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

Definition at line 74 of file MsgPackDocument.h.

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

◆ isMap()

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

Definition at line 68 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 70 of file MsgPackDocument.h.

References isArray().

◆ isString()

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

Definition at line 71 of file MsgPackDocument.h.

References llvm::msgpack::String.

◆ 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

Comparison operator, used for map keys.

Definition at line 146 of file MsgPackDocument.h.

◆ operator==

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

Equality operator.

Definition at line 176 of file MsgPackDocument.h.

Member Data Documentation

◆ @134

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: