mal-packet-weaver
C++20 packet serialization/deserialization library.
Loading...
Searching...
No Matches
mal_toolkit::namable_once Class Reference

A class that contains a name and can be named only once at construction. More...

#include "common-structures.hpp"

Inheritance diagram for mal_toolkit::namable_once:
[legend]
Collaboration diagram for mal_toolkit::namable_once:
[legend]

Public Member Functions

constexpr namable_once (std::string const &name)
 
constexpr namable_once (std::string &&name)
 
 ~namable_once ()=default
 
constexpr bool has_name () const
 
constexpr std::string_view name () const
 

Private Member Functions

constexpr void set_name (std::string const &name)
 
constexpr void set_name (std::string &&name)
 
constexpr void clear_name ()
 

Private Attributes

std::string name_
 

Detailed Description

A class that contains a name and can be named only once at construction.

Note
This class is constexpr compatible
You can't change the name after construction

Definition at line 74 of file common-structures.hpp.

Constructor & Destructor Documentation

◆ namable_once() [1/2]

mal_toolkit::namable_once::namable_once ( std::string const & name)
inlineexplicitconstexpr

Definition at line 77 of file common-structures.hpp.

◆ namable_once() [2/2]

mal_toolkit::namable_once::namable_once ( std::string && name)
inlineexplicitconstexpr

Definition at line 78 of file common-structures.hpp.

◆ ~namable_once()

mal_toolkit::namable_once::~namable_once ( )
default

Member Function Documentation

◆ clear_name()

void mal_toolkit::namable::clear_name ( )
inlineconstexprinherited

Definition at line 45 of file common-structures.hpp.

◆ has_name()

bool mal_toolkit::namable::has_name ( ) const
inlineconstexpr

Definition at line 46 of file common-structures.hpp.

◆ name()

std::string_view mal_toolkit::namable::name ( ) const
inlinenodiscardconstexpr

Definition at line 47 of file common-structures.hpp.

◆ set_name() [1/2]

void mal_toolkit::namable::set_name ( std::string && name)
inlineconstexprinherited

Definition at line 44 of file common-structures.hpp.

Here is the call graph for this function:

◆ set_name() [2/2]

void mal_toolkit::namable::set_name ( std::string const & name)
inlineconstexprinherited

Definition at line 43 of file common-structures.hpp.

Here is the call graph for this function:

Member Data Documentation

◆ name_

std::string mal_toolkit::namable::name_
privateinherited

Definition at line 50 of file common-structures.hpp.


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