Spicy
Public Member Functions | List of all members
hilti::NodeRef Class Reference

#include <node_ref.h>

Public Member Functions

 NodeRef (Node &n)
 
 NodeRef (const NodeRef &other)=default
 
 NodeRef (NodeRef &&other)=default
 
NodeRefoperator= (const NodeRef &other)=default
 
NodeRefoperator= (NodeRef &&other)=default
 
uint64_t rid () const
 
std::string renderedRid () const
 
const Nodeoperator-> () const
 
Nodeoperator* () const
 
 operator const Node & () const
 
 operator bool () const
 

Detailed Description

A reference to an AST Node. A reference acts similarly to a pointer to a node, except that it tracks its life-time and catches (through exceptions) if the reference becomes invalid. Assigning to a node doesn't affect any references to it; they will now point to the new value.

Member Function Documentation

◆ operator bool()

hilti::NodeRef::operator bool ( ) const
inlineexplicit

Returns true if the instance references a valid node.

◆ operator*()

Node& hilti::NodeRef::operator* ( ) const
inline

Returns a direct C++ reference to the the referenced node. The node may be modified, and assigned to, through this reference.

Exceptions
Invalidif the node does not exist anymore

◆ operator->()

const Node* hilti::NodeRef::operator-> ( ) const
inline

Returns a pointer to the the referenced node.

Exceptions
Invalidif the node does not exist anymore

◆ renderedRid()

std::string hilti::NodeRef::renderedRid ( ) const
inline

Returns a string version of the referenced node's unique control ID, or 0 if the instance isn't referencing anything.

Note
This is primarily for internal usage.

◆ rid()

uint64_t hilti::NodeRef::rid ( ) const
inline

Returns the referenced node's unique control ID, or 0 if the instance isn't referencing anything.

Note
This is primarily for internal usage.

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