HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
Public Member Functions | Friends
v1::iso_639 Class Reference

#include <hikogui/i18n/iso_639.hpp>

Public Member Functions

constexpr iso_639 (iso_639 const &) noexcept=default
 
constexpr iso_639 (iso_639 &&) noexcept=default
 
constexpr iso_639operator= (iso_639 const &) noexcept=default
 
constexpr iso_639operator= (iso_639 &&) noexcept=default
 
constexpr iso_639 () noexcept
 Construct empty language.
 
constexpr iso_639 (std::string_view str)
 Construct a language from the 2 or 3 letter code.
 
constexpr iso_639 (std::in_place_t, uint16_t v) noexcept
 
constexpr uint16_t constintrinsic () const noexcept
 
constexpr uint16_t & intrinsic () noexcept
 
constexpr std::size_t size () const noexcept
 Get the number of character.
 
constexpr bool empty () const noexcept
 Check if the language is empty.
 
constexpr operator bool () const noexcept
 Check if the language is used.
 
size_t hash () const noexcept
 Get the hash value for this language code.
 
constexpr std::string code () const noexcept
 Get the 2 or 3 letter ISO-639 code.
 

Friends

template<std::size_t I>
constexpr friend bool set (iso_639 &rhs, char c) noexcept
 Set the letter at a specific position.
 
template<std::size_t I>
constexpr friend char get (iso_639 const &rhs) noexcept
 Get the letter at a specific position.
 
constexpr friend std::string to_string (iso_639 const &rhs) noexcept
 
constexpr friend bool operator== (iso_639 const &lhs, iso_639 const &rhs) noexcept=default
 Compare two language codes.
 
constexpr friend auto operator<=> (iso_639 const &lhs, iso_639 const &rhs) noexcept=default
 Compare two language codes.
 
constexpr friend bool matches (iso_639 const &lhs, iso_639 const &rhs) noexcept
 Check if rhs matches with lhs.
 

Detailed Description

ISO-639 language code.

A 2 or 3 lower case language code selected from the following iso standards:

  1. ISO 639-1 (2002)
  2. ISO 639-2 (1998)
  3. ISO 639-3 (2007)
  4. ISO 639-5 (2008)

This class compresses this 2 or 3 character language code inside 15 bits.

Constructor & Destructor Documentation

◆ iso_639() [1/2]

constexpr v1::iso_639::iso_639 ( )
inlineconstexprnoexcept

Construct empty language.

◆ iso_639() [2/2]

constexpr v1::iso_639::iso_639 ( std::string_view str)
inlineconstexpr

Construct a language from the 2 or 3 letter code.

Member Function Documentation

◆ code()

constexpr std::string v1::iso_639::code ( ) const
inlineconstexprnoexcept

Get the 2 or 3 letter ISO-639 code.

◆ empty()

constexpr bool v1::iso_639::empty ( ) const
inlineconstexprnoexcept

Check if the language is empty.

◆ hash()

size_t v1::iso_639::hash ( ) const
inlinenoexcept

Get the hash value for this language code.

◆ operator bool()

constexpr v1::iso_639::operator bool ( ) const
inlineexplicitconstexprnoexcept

Check if the language is used.

◆ size()

constexpr std::size_t v1::iso_639::size ( ) const
inlineconstexprnoexcept

Get the number of character.

Returns
2 or 3 for a code, or 0 if empty.

Friends And Related Symbol Documentation

◆ get

template<std::size_t I>
constexpr friend char get ( iso_639 const & rhs)
friend

Get the letter at a specific position.

Template Parameters
Iindex
Parameters
rhsThe language code read from.
Returns
The character at index, a-z, 0-5 or nul.

◆ matches

constexpr friend bool matches ( iso_639 const & lhs,
iso_639 const & rhs )
friend

Check if rhs matches with lhs.

Parameters
lhsThe language or wild-card.
rhsThe language.
Returns
True when lhs is a wild-card or when lhs and rhs are equal.

◆ operator<=>

constexpr friend auto operator<=> ( iso_639 const & lhs,
iso_639 const & rhs )
friend

Compare two language codes.

◆ operator==

constexpr friend bool operator== ( iso_639 const & lhs,
iso_639 const & rhs )
friend

Compare two language codes.

◆ set

template<std::size_t I>
constexpr friend bool set ( iso_639 & rhs,
char c )
friend

Set the letter at a specific position.

Template Parameters
Iindex
Parameters
rhsThe language code to change.
cThe character to set. a-z, A-Z, 0-5 or nul.

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