Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
Literal Class Reference

#include "lib/symbol.hpp"

Description

Inline string literal.

This is a marker type to indicate that

  • the string was given literally
  • storage is somewhere, not managed by Literal, yet guaranteed to exist during the whole lifetime
  • it is transparently convertible to/from C-string
  • defaults to the empty string
  • can not be altered
Examples
/Werk/devel/lumi/src/lib/test/test-helper.hpp.

Definition at line 77 of file symbol.hpp.

Public Member Functions

constexpr Literal () noexcept
 empty string by default
 
constexpr Literal (CStr literal) noexcept
 
constexpr Literal (Literal const &) noexcept=default
 
constexpr Literaloperator= (Literal const &) noexcept=default
 
constexpr operator CStr () const
 
constexpr const char * c () const
 
constexpr bool empty () const
 
constexpr bool operator== (CStr cString) const
 equality on Literal and Symbol values is defined based on the content, not the address.
 
constexpr size_t length () const
 

Protected Member Functions

Literaloperator= (CStr newStr) noexcept
 Assignment generally prohibited.
 

Private Attributes

CStr str_
 

Constructor & Destructor Documentation

◆ Literal() [1/3]

constexpr Literal ( )
inlineconstexprnoexcept

empty string by default

Note
storage guaranteed to exist

Definition at line 158 of file symbol.hpp.

◆ Literal() [2/3]

constexpr Literal ( CStr  literal)
inlineconstexprnoexcept

Definition at line 85 of file symbol.hpp.

◆ Literal() [3/3]

constexpr Literal ( Literal const &  )
constexprdefaultnoexcept

Member Function Documentation

◆ operator=() [1/2]

constexpr Literal & operator= ( Literal const &  )
constexprdefaultnoexcept

◆ operator CStr()

constexpr operator CStr ( ) const
inlineconstexpr

Definition at line 92 of file symbol.hpp.

References Literal::str_.

◆ c()

constexpr const char * c ( ) const
inlineconstexpr

◆ empty()

constexpr bool empty ( ) const
inlineconstexpr

Definition at line 96 of file symbol.hpp.

References Literal::str_.

Referenced by _Fmt::Converter< lib::Literal >::dump(), and Result_test::run().

+ Here is the caller graph for this function:

◆ operator==()

constexpr bool operator== ( CStr  cString) const
inlineconstexpr

equality on Literal and Symbol values is defined based on the content, not the address.

Definition at line 176 of file symbol.hpp.

References Literal::str_, and lib::STRING_MAX_RELEVANT.

◆ length()

constexpr size_t length ( ) const
inlineconstexpr

Definition at line 182 of file symbol.hpp.

References Literal::c().

+ Here is the call graph for this function:

◆ operator=() [2/2]

Literal & operator= ( CStr  newStr)
inlineprotectednoexcept

Assignment generally prohibited.

Definition at line 106 of file symbol.hpp.

References Literal::str_.

Member Data Documentation

◆ str_

CStr str_
private
+ Inheritance diagram for Literal:
+ Collaboration diagram for Literal:

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