Prism Ruby parser
Loading...
Searching...
No Matches
prism::node_range Class Reference

The nodes in a list, usable in a range-based for loop. More...

#include <node.hpp>

Public Member Functions

 node_range (const pm_node_list_t &list) noexcept
 Create a range over the nodes in the given list.
pm_node_t *const * begin () const noexcept
 A pointer to the first node.
pm_node_t *const * end () const noexcept
 A pointer one past the last node.
std::size_t size () const noexcept
 The number of nodes.
bool empty () const noexcept
 Whether there are no nodes.

Detailed Description

The nodes in a list, usable in a range-based for loop.

It refers to the list rather than copying it, so the list must outlive it.

Constructor & Destructor Documentation

◆ node_range()

prism::node_range::node_range ( const pm_node_list_t & list)
inlineexplicitnoexcept

Create a range over the nodes in the given list.

Parameters
listThe list of nodes to create a range for.

Member Function Documentation

◆ begin()

pm_node_t *const * prism::node_range::begin ( ) const
inlinenoexcept

A pointer to the first node.

Returns
A pointer to the first node, or null if the list is empty.

◆ end()

pm_node_t *const * prism::node_range::end ( ) const
inlinenoexcept

A pointer one past the last node.

Returns
A pointer one past the last node, or null if the list is empty.

◆ size()

std::size_t prism::node_range::size ( ) const
inlinenoexcept

The number of nodes.

Returns
The number of nodes.

◆ empty()

bool prism::node_range::empty ( ) const
inlinenodiscardnoexcept

Whether there are no nodes.

Returns
True if there are no nodes, false otherwise.

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