tinypbrt 1.1.1
pbrt-v4 scene file parser for C11 with a header-only C++20 wrapper
Loading...
Searching...
No Matches
tpbrt::materials_list Struct Reference

C++ wrapper for tpbrt_materials_list_t. More...

#include <tinypbrt/detail/cpp/material.hpp>

Public Member Functions

result< element_type > at (const material_handle handle) const noexcept
 Returns material pointed by given handle.
 
result< element_type > at (const std::string_view name) const noexcept
 Returns material with given name.
 
result< element_type > operator[] (const material_handle handle) const noexcept
 Returns material pointed by given handle.
 
result< element_type > operator[] (const std::string_view name) const noexcept
 Returns material with given name.
 
constexpr result< element_type > at (const size_t index) const noexcept
 Index based access from tpbrt::array.
 
- Public Member Functions inherited from tpbrt::array< tpbrt_materials_list_t, material, &tpbrt_materials_list_t::materials >
constexpr size_t size () const noexcept
 Returns size of this array.
 
constexpr bool_t empty () const noexcept
 Returns true if array is empty.
 
constexpr const native_element_type * data () const noexcept
 Returns pointer to the C data.
 
constexpr span_type to_span () const noexcept
 Returns std::span over the C data.
 
constexpr iterator begin () const noexcept
 Returns begin iterator.
 
constexpr iterator end () const noexcept
 Returns end iterator.
 
constexpr reference operator[] (const size_t index) const noexcept
 Returns element on given index (unchecked, like std::span).
 
constexpr result< element_type > at (const size_t index) const noexcept
 Returns element on given index or error::INDEX_OUT_OF_RANGE.
 
constexpr reference front () const noexcept
 Returns first element (unchecked).
 
constexpr reference back () const noexcept
 Returns last element (unchecked).
 
constexpr auto operator<=> (const array &rhs) const noexcept
 Three-way comparison operator (compares elements).
 
constexpr bool_t operator== (const array &rhs) const noexcept
 Equality operator (compares elements).
 

Additional Inherited Members

- Public Types inherited from tpbrt::array< tpbrt_materials_list_t, material, &tpbrt_materials_list_t::materials >
using traits = detail::array_traits< tpbrt_materials_list_t, DataField >
 Array traits.
 
using native_element_type = traits::native_element_type
 Native C library array element type.
 
using element_type = std::conditional_t< std::is_void_v< material >, native_element_type, material >
 C++ array view element type.
 
using value_type = element_type
 Value type (as in std::span).
 
using span_type = traits::span_type
 std::span type of this array.
 
using iterator = std::conditional_t< IsIdentity, typename span_type::iterator, detail::converting_iterator< native_element_type, element_type > >
 Iterator type.
 
using reference = std::conditional_t< IsIdentity, const native_element_type &, element_type >
 Type returned by operator[] (a reference for identity arrays, a converted value otherwise).
 
- Static Public Attributes inherited from tpbrt::array< tpbrt_materials_list_t, material, &tpbrt_materials_list_t::materials >
static constexpr size_t Extent
 Array static size.
 
static constexpr bool_t IsIdentity
 True when elements are returned without conversion (as references to the C data).
 
- Protected Member Functions inherited from tpbrt::array< tpbrt_materials_list_t, material, &tpbrt_materials_list_t::materials >
constexpr span_type _raw_span () const noexcept
 Returns std::span over the C data.
 

Detailed Description

C++ wrapper for tpbrt_materials_list_t.

Index access (operator[], at(size_t), iteration) works as in tpbrt::array, at(handle) and at(name) use the C lookups and return error::NOT_FOUND (or the C error code) when there is no such material.

Member Function Documentation

◆ at() [1/3]

result< element_type > tpbrt::materials_list::at ( const material_handle  handle) const
inlinenoexcept

Returns material pointed by given handle.

Examples
examples/cpp/quickstart/main.cpp.

◆ at() [2/3]

result< element_type > tpbrt::materials_list::at ( const std::string_view  name) const
inlinenoexcept

Returns material with given name.

◆ operator[]() [1/2]

result< element_type > tpbrt::materials_list::operator[] ( const material_handle  handle) const
inlinenoexcept

Returns material pointed by given handle.

◆ operator[]() [2/2]

result< element_type > tpbrt::materials_list::operator[] ( const std::string_view  name) const
inlinenoexcept

Returns material with given name.

◆ at() [3/3]

constexpr result< element_type > tpbrt::array< Native, Element, DataField >::at ( const size_t  index) const
inlineconstexprnoexcept

Index based access from tpbrt::array.


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