25 #ifndef TASKOLIB_TAG_H_
26 #define TASKOLIB_TAG_H_
29 #include <string_view>
64 explicit Tag(std::string_view name);
111 return lhs + rhs.
name_;
117 return lhs.
name_ + rhs;
128 friend std::ostream&
operator<<(std::ostream& stream,
const Tag& tag);
131 std::size_t
size() const noexcept {
return name_.size(); }
A tag used for categorizing sequences.
Definition: Tag.h:43
friend std::ostream & operator<<(std::ostream &stream, const Tag &tag)
Output the tag name to the given stream.
Definition: Tag.cc:61
friend std::string & operator+=(std::string &lhs, const Tag &rhs)
Concatenate a string and a tag.
Definition: Tag.h:121
std::size_t size() const noexcept
Return the length of the tag name.
Definition: Tag.h:131
static constexpr std::size_t max_length
Maximum number of bytes of a tag name.
Definition: Tag.h:46
friend bool operator!=(const Tag &a, const Tag &b)
Determine if two tags are different.
Definition: Tag.h:73
friend bool operator>=(const Tag &a, const Tag &b)
Determine if tag a comes after or is equal to tag b in a lexicographical comparison.
Definition: Tag.h:103
friend std::string operator+(const std::string &lhs, const Tag &rhs)
Concatenate a string and a tag.
Definition: Tag.h:109
friend bool operator<=(const Tag &a, const Tag &b)
Determine if tag a comes before or is equal to tag b in a lexicographical comparison.
Definition: Tag.h:88
friend bool operator==(const Tag &a, const Tag &b)
Determine if two tags are equal.
Definition: Tag.h:67
const std::string & string() const noexcept
Return the name of the tag as a string.
Definition: Tag.h:134
static std::string_view check_validity(std::string_view)
Throw an exception if the given string violates the length or character constraints of a tag name; ot...
Definition: Tag.cc:42
static const std::string_view valid_characters
A string containing all of the valid characters for a tag name.
Definition: Tag.h:49
std::string name_
Definition: Tag.h:137
Tag()
Default-construct a tag with the name "-".
Definition: Tag.h:53
friend bool operator>(const Tag &a, const Tag &b)
Determine if tag a comes after tag b in a lexicographical comparison.
Definition: Tag.h:94
friend std::string operator+(const Tag &lhs, const std::string &rhs)
Concatenate a tag and a string.
Definition: Tag.h:115
friend bool operator<(const Tag &a, const Tag &b)
Determine if tag a comes before tag b in a lexicographical comparison.
Definition: Tag.h:79
Namespace task contains all Taskolib functions and classes.
Definition: CommChannel.h:33