Taskolib
1.3.3
|
A tag used for categorizing sequences.
A tag consists of lowercase ASCII letters, digits, and hyphen characters. It must be at least 1 character long and has a maximum length given by the max_length member constant. Uppercase letters are automatically converted to lowercase when comparing or creating tags.
#include <Tag.h>
Public Member Functions | |
Tag () | |
Default-construct a tag with the name "-". More... | |
Tag (gul14::string_view name) | |
Construct a tag with the specified name. More... | |
std::size_t | size () const noexcept |
Return the length of the tag name. More... | |
const std::string & | string () const noexcept |
Return the name of the tag as a string. More... | |
Static Public Attributes | |
static constexpr std::size_t | max_length = 32 |
Maximum number of bytes of a tag name. More... | |
static const gul14::string_view | valid_characters { "abcdefghijklmnopqrstuvwxyz0123456789-" } |
A string containing all of the valid characters for a tag 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 tag name; otherwise, return the unmodified string view. More... | |
Private Attributes | |
std::string | name_ |
Friends | |
bool | operator== (const Tag &a, const Tag &b) |
Determine if two tags are equal. More... | |
bool | operator!= (const Tag &a, const Tag &b) |
Determine if two tags are different. More... | |
bool | operator< (const Tag &a, const Tag &b) |
Determine if tag a comes before tag b in a lexicographical comparison. More... | |
bool | operator<= (const Tag &a, const Tag &b) |
Determine if tag a comes before or is equal to tag b in a lexicographical comparison. More... | |
bool | operator> (const Tag &a, const Tag &b) |
Determine if tag a comes after tag b in a lexicographical comparison. More... | |
bool | operator>= (const Tag &a, const Tag &b) |
Determine if tag a comes after or is equal to tag b in a lexicographical comparison. More... | |
std::string | operator+ (const std::string &lhs, const Tag &rhs) |
Concatenate a string and a tag. More... | |
std::string | operator+ (const Tag &lhs, const std::string &rhs) |
Concatenate a tag and a string. More... | |
std::string & | operator+= (std::string &lhs, const Tag &rhs) |
Concatenate a string and a tag. More... | |
std::ostream & | operator<< (std::ostream &stream, const Tag &tag) |
Output the tag name to the given stream. More... | |
|
inline |
Default-construct a tag with the name "-".
|
explicit |
Construct a tag with the specified name.
Uppercase ASCII characters are automatically converted to lowercase.
Error | is thrown if the string is too long or if it contains invalid characters. |
|
staticprivate |
Throw an exception if the given string violates the length or character constraints of a tag name; otherwise, return the unmodified string view.
Uppercase ASCII characters are rejected.
References max_length, and valid_characters.
|
inlinenoexcept |
Return the length of the tag name.
References name_.
|
inlinenoexcept |
Return the name of the tag as a string.
References name_.
|
friend |
Concatenate a string and a tag.
|
friend |
Concatenate a tag and a string.
|
friend |
Concatenate a string and a tag.
Determine if tag a comes before tag b in a lexicographical comparison.
|
friend |
Output the tag name to the given stream.
Determine if tag a comes before or is equal to tag b in a lexicographical comparison.
Determine if tag a comes after tag b in a lexicographical comparison.
Determine if tag a comes after or is equal to tag b in a lexicographical comparison.
|
staticconstexpr |
Maximum number of bytes of a tag name.
Referenced by check_validity().
|
static |
A string containing all of the valid characters for a tag name.
Referenced by check_validity().