Taskolib  1.3.3
Public Member Functions | Static Public Member Functions | Static Public Attributes | Static Private Member Functions | Private Attributes | Friends | List of all members
task::SequenceName Class Reference

Detailed Description

The machine-readable name of a Sequence.

A sequence name has constraints on its length and the contained characters. It may be at most max_length bytes long and it may only contain upper- and lowercase letters, digits, the minus and underscore characters, and periods. It may not start with a period.

#include <SequenceName.h>

Public Member Functions

 SequenceName ()=default
 Default-construct an empty sequence name. More...
 
 SequenceName (gul14::string_view str)
 Construct a sequence name from a string. More...
 
const std::string & string () const noexcept
 Return the sequence name as a string. More...
 

Static Public Member Functions

static gul14::optional< SequenceNamefrom_string (gul14::string_view str)
 Create a sequence name from the given string, returning an empty optional if the string violates the length or character constraints of a sequence name. More...
 

Static Public Attributes

static constexpr std::size_t max_length = 64
 Maximum number of bytes of a sequence name. More...
 
static const gul14::string_view valid_characters
 A string containing all of the valid characters of a sequence name. More...
 

Static Private Member Functions

static gul14::string_view check_validity (gul14::string_view)
 Throw an exception if the given string violates the length or character constraints of a sequence name; otherwise, return the unmodified string view. More...
 

Private Attributes

std::string str_
 

Friends

bool operator== (const SequenceName &a, const SequenceName &b)
 Determine if two sequence names are equal. More...
 
bool operator!= (const SequenceName &a, const SequenceName &b)
 Determine if two sequence names are different. More...
 

Constructor & Destructor Documentation

◆ SequenceName() [1/2]

task::SequenceName::SequenceName ( )
default

Default-construct an empty sequence name.

◆ SequenceName() [2/2]

task::SequenceName::SequenceName ( gul14::string_view  str)
explicit

Construct a sequence name from a string.

Exceptions
Erroris thrown if the string is too long or if it contains invalid characters.

Member Function Documentation

◆ check_validity()

gul14::string_view task::SequenceName::check_validity ( gul14::string_view  str)
staticprivate

Throw an exception if the given string violates the length or character constraints of a sequence name; otherwise, return the unmodified string view.

References max_length, and valid_characters.

◆ from_string()

gul14::optional< SequenceName > task::SequenceName::from_string ( gul14::string_view  str)
static

Create a sequence name from the given string, returning an empty optional if the string violates the length or character constraints of a sequence name.

Referenced by task::SequenceManager::parse_folder_name().

◆ string()

const std::string& task::SequenceName::string ( ) const
inlinenoexcept

Return the sequence name as a string.

References str_.

Referenced by task::make_sequence_filename().

Friends And Related Function Documentation

◆ operator!=

bool operator!= ( const SequenceName a,
const SequenceName b 
)
friend

Determine if two sequence names are different.

◆ operator==

bool operator== ( const SequenceName a,
const SequenceName b 
)
friend

Determine if two sequence names are equal.

Member Data Documentation

◆ max_length

constexpr std::size_t task::SequenceName::max_length = 64
staticconstexpr

Maximum number of bytes of a sequence name.

Referenced by check_validity(), and task::SequenceManager::make_sequence_name_from_label().

◆ str_

std::string task::SequenceName::str_
private

Referenced by string().

◆ valid_characters

const gul14::string_view task::SequenceName::valid_characters
static
Initial value:
{
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_." }

A string containing all of the valid characters of a sequence name.

Referenced by check_validity(), and task::SequenceManager::make_sequence_name_from_label().


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