25 #ifndef TASKOLIB_TAG_H_
26 #define TASKOLIB_TAG_H_
31 #include <gul14/string_view.h>
65 explicit Tag(gul14::string_view name);
112 return lhs + rhs.
name_;
118 return lhs.
name_ + rhs;
129 friend std::ostream&
operator<<(std::ostream& stream,
const Tag& tag);
132 std::size_t
size() const noexcept {
return name_.size(); }
A tag used for categorizing sequences.
Definition: Tag.h:44
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:122
static const gul14::string_view valid_characters
A string containing all of the valid characters for a tag name.
Definition: Tag.h:50
std::size_t size() const noexcept
Return the length of the tag name.
Definition: Tag.h:132
static constexpr std::size_t max_length
Maximum number of bytes of a tag name.
Definition: Tag.h:47
friend bool operator!=(const Tag &a, const Tag &b)
Determine if two tags are different.
Definition: Tag.h:74
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:104
friend std::string operator+(const std::string &lhs, const Tag &rhs)
Concatenate a string and a tag.
Definition: Tag.h:110
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:89
friend bool operator==(const Tag &a, const Tag &b)
Determine if two tags are equal.
Definition: Tag.h:68
const std::string & string() const noexcept
Return the name of the tag as a string.
Definition: Tag.h:135
std::string name_
Definition: Tag.h:138
Tag()
Default-construct a tag with the name "-".
Definition: Tag.h:54
friend bool operator>(const Tag &a, const Tag &b)
Determine if tag a comes after tag b in a lexicographical comparison.
Definition: Tag.h:95
friend std::string operator+(const Tag &lhs, const std::string &rhs)
Concatenate a tag and a string.
Definition: Tag.h:116
friend bool operator<(const Tag &a, const Tag &b)
Determine if tag a comes before tag b in a lexicographical comparison.
Definition: Tag.h:80
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; ot...
Definition: Tag.cc:42
Namespace task contains all Taskolib functions and classes.
Definition: CommChannel.h:33