31 #ifndef STRUCT_TEXTMAP_HPP_ 32 #define STRUCT_TEXTMAP_HPP_ 34 #include "../Helper/Memory.hpp" 90 ) :
p(setPos),
l(setLength) {}
106 std::size_t setLength,
107 const std::string& setValue
108 ) :
p(setPos),
l(setLength), value(setValue) {}
120 std::swap(*
this, other);
146 [[nodiscard]] std::string
str()
const {
147 std::string result{
"pos="};
149 result += std::to_string(this->
p);
150 result +=
"; length=";
151 result += std::to_string(this->
l);
152 result +=
"; value=\"";
153 result += this->
value;
185 static std::size_t&
pos(std::pair<std::size_t, std::size_t>& entry) {
210 static std::size_t
pos(
const std::pair<std::size_t, std::size_t>& entry) {
221 template<
typename T>
static std::size_t
end(
const T& entry) {
247 static std::size_t&
length(std::pair<std::size_t, std::size_t>& entry) {
272 static std::size_t
length(
const std::pair<std::size_t, std::size_t>& entry) {
std::size_t l
The length of the annotated part inside the text.
Definition: TextMap.hpp:61
static std::size_t & pos(TextMapEntry &entry)
Gets a reference to the position of a text map entry.
Definition: TextMap.hpp:172
Text map entry.
Definition: TextMap.hpp:49
static std::size_t pos(const std::pair< std::size_t, std::size_t > &entry)
Gets the position of a sentence map entry.
Definition: TextMap.hpp:210
static std::size_t & pos(std::pair< std::size_t, std::size_t > &entry)
Gets a reference to the position of a sentence map entry.
Definition: TextMap.hpp:185
TextMapEntry(std::size_t setPos, std::size_t setLength)
Constructor creating an empty annotation.
Definition: TextMap.hpp:87
TextMapEntry()=default
Default constructor.
std::vector< TextMapEntry > TextMap
A text map is defined as a vector of text map entries.
Definition: TextMap.hpp:280
static std::size_t & length(std::pair< std::size_t, std::size_t > &entry)
Gets a reference to the length of a sentence map entry.
Definition: TextMap.hpp:247
std::string str() const
Converts the text map entry into a string.
Definition: TextMap.hpp:146
TextMapEntry(std::size_t setPos, std::size_t setLength, const std::string &setValue)
Constructor creating a non-empty annotation.
Definition: TextMap.hpp:104
void free()
Resets its properties to their default values and frees the memory used by the entry.
Definition: TextMap.hpp:128
std::string value
Value of the annotation.
Definition: TextMap.hpp:69
void swap(TextMapEntry &other)
Swaps the text map entry with another.
Definition: TextMap.hpp:119
Namespace for data structures.
Definition: AlgoThreadProperties.hpp:43
static std::size_t pos(const TextMapEntry &entry)
Gets the position of a text map entry.
Definition: TextMap.hpp:197
static void free(T &target)
Frees memory by swapping.
Definition: Memory.hpp:42
static std::size_t & length(TextMapEntry &entry)
Gets a reference to the length of a text map entry.
Definition: TextMap.hpp:234
std::size_t p
The position of the annotated part inside the text.
Definition: TextMap.hpp:58
static std::size_t end(const T &entry)
Gets the end of a map entry.
Definition: TextMap.hpp:221
static std::size_t length(const TextMapEntry &entry)
Gets the length of a text map entry.
Definition: TextMap.hpp:259
static std::size_t length(const std::pair< std::size_t, std::size_t > &entry)
Gets the length of a sentence map entry.
Definition: TextMap.hpp:272