OpenTTD Source 20260721-master-g25ec12c62d
Label< Tag > Struct Template Reference

A four character label/tag/id. More...

#include <label_type.hpp>

Inheritance diagram for Label< Tag >:
BaseLabel

Public Member Functions

constexpr Label ()
 Create an empty label, i.e.
constexpr Label (const char(&label)[5])
 Create a label with the given 4 letter character string.
constexpr Label (const uint8_t(&label)[4])
 Create a label with the given 4 bytes.
constexpr std::strong_ordering operator<=> (const Label< Tag > &other) const =default
 Default spaceship operator.
Public Member Functions inherited from BaseLabel
constexpr bool Empty () const
 Check whether the label is empty.
std::string AsString () const
 Get the label as a std::string.

Detailed Description

template<typename Tag>
struct Label< Tag >

A four character label/tag/id.

Template Parameters
TagType to distinguish labels/tags/ids of different types.

Definition at line 38 of file label_type.hpp.

Constructor & Destructor Documentation

◆ Label() [1/3]

template<typename Tag>
Label< Tag >::Label ( )
inlineconstexpr

Create an empty label, i.e.

all zeros.

Definition at line 40 of file label_type.hpp.

◆ Label() [2/3]

template<typename Tag>
Label< Tag >::Label ( const char(&) label[5])
inlineconstexpr

Create a label with the given 4 letter character string.

Parameters
labelThe label value.
Note
This defines 5 characters, but the 5th character is assumed to null-terminator.

Definition at line 50 of file label_type.hpp.

◆ Label() [3/3]

template<typename Tag>
Label< Tag >::Label ( const uint8_t(&) label[4])
inlineconstexpr

Create a label with the given 4 bytes.

Parameters
labelThe label value.

Definition at line 59 of file label_type.hpp.

Member Function Documentation

◆ operator<=>()

template<typename Tag>
std::strong_ordering Label< Tag >::operator<=> ( const Label< Tag > & other) const
constexprdefault

Default spaceship operator.

Parameters
otherThe label to compare to.
Returns
The comparison ordering.

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