crawlserv++  [under development]
Application for crawling and analyzing textual content of websites.
crawlservpp::Struct::TextMapEntry Struct Reference

Text map entry. More...

#include <TextMap.hpp>

Properties

std::size_t p {}
 The position of the annotated part inside the text. More...
 
std::size_t l {}
 The length of the annotated part inside the text. More...
 
std::string value
 Value of the annotation. More...
 

Construction

 TextMapEntry ()=default
 Default constructor. More...
 
 TextMapEntry (std::size_t setPos, std::size_t setLength)
 Constructor creating an empty annotation. More...
 
 TextMapEntry (std::size_t setPos, std::size_t setLength, const std::string &setValue)
 Constructor creating a non-empty annotation. More...
 

Swap

void swap (TextMapEntry &other)
 Swaps the text map entry with another. More...
 

Cleanup

void free ()
 Resets its properties to their default values and frees the memory used by the entry. More...
 

String Conversion

std::string str () const
 Converts the text map entry into a string. More...
 

Static Access Functions

static std::size_t & pos (TextMapEntry &entry)
 Gets a reference to the position of a text map entry. More...
 
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. More...
 
static std::size_t pos (const TextMapEntry &entry)
 Gets the position of a text map entry. More...
 
static std::size_t pos (const std::pair< std::size_t, std::size_t > &entry)
 Gets the position of a sentence map entry. More...
 
template<typename T >
static std::size_t end (const T &entry)
 Gets the end of a map entry. More...
 
static std::size_t & length (TextMapEntry &entry)
 Gets a reference to the length of a text map entry. More...
 
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. More...
 
static std::size_t length (const TextMapEntry &entry)
 Gets the length of a text map entry. More...
 
static std::size_t length (const std::pair< std::size_t, std::size_t > &entry)
 Gets the length of a sentence map entry. More...
 

Detailed Description

Text map entry.

A text map entry annotates one part of a text, defined by its position and length, with a string value.

Constructor & Destructor Documentation

◆ TextMapEntry() [1/3]

crawlservpp::Struct::TextMapEntry::TextMapEntry ( )
default

Default constructor.

◆ TextMapEntry() [2/3]

crawlservpp::Struct::TextMapEntry::TextMapEntry ( std::size_t  setPos,
std::size_t  setLength 
)
inline

Constructor creating an empty annotation.

Parameters
setPosThe position of the annotated part of the text, starting with zero at the beginning of the text.
setLengthThe length of the annotated part of the text.

◆ TextMapEntry() [3/3]

crawlservpp::Struct::TextMapEntry::TextMapEntry ( std::size_t  setPos,
std::size_t  setLength,
const std::string &  setValue 
)
inline

Constructor creating a non-empty annotation.

Parameters
setPosThe position of the annotated part of the text, starting with zero at the beginning of the text.
setLengthThe length of the annotated part of the text.
setValueConst reference to a string containing the value of the annotation.

Member Function Documentation

◆ end()

◆ free()

void crawlservpp::Struct::TextMapEntry::free ( )
inline

Resets its properties to their default values and frees the memory used by the entry.

References crawlservpp::Helper::Memory::free(), l, and p.

◆ length() [1/4]

◆ length() [2/4]

static std::size_t& crawlservpp::Struct::TextMapEntry::length ( std::pair< std::size_t, std::size_t > &  entry)
inlinestatic

Gets a reference to the length of a sentence map entry.

Parameters
entryReference to the sentence map entry to get the length of.
Returns
Reference to the length of the given entry.

◆ length() [3/4]

static std::size_t crawlservpp::Struct::TextMapEntry::length ( const TextMapEntry entry)
inlinestatic

Gets the length of a text map entry.

Parameters
entryConstant reference to the text map entry to get the length of.
Returns
The length of the given entry.

References l.

◆ length() [4/4]

static std::size_t crawlservpp::Struct::TextMapEntry::length ( const std::pair< std::size_t, std::size_t > &  entry)
inlinestatic

Gets the length of a sentence map entry.

Parameters
entryConstant reference to the sentence map entry to get the length of.
Returns
The length of the given entry.

◆ pos() [1/4]

◆ pos() [2/4]

static std::size_t& crawlservpp::Struct::TextMapEntry::pos ( std::pair< std::size_t, std::size_t > &  entry)
inlinestatic

Gets a reference to the position of a sentence map entry.

Parameters
entryReference to the sentence map entry to get the position of.
Returns
Reference to the position of the given entry.

◆ pos() [3/4]

static std::size_t crawlservpp::Struct::TextMapEntry::pos ( const TextMapEntry entry)
inlinestatic

Gets the position of a text map entry.

Parameters
entryConstant reference to the text map entry to get the position of.
Returns
The position of the given entry.

References p.

◆ pos() [4/4]

static std::size_t crawlservpp::Struct::TextMapEntry::pos ( const std::pair< std::size_t, std::size_t > &  entry)
inlinestatic

Gets the position of a sentence map entry.

Parameters
entryConstant reference to the sentence map entry to get the position of.
Returns
The position of the given entry.

◆ str()

std::string crawlservpp::Struct::TextMapEntry::str ( ) const
inline

Converts the text map entry into a string.

Returns
String representing the text map entry – containing its position, length, and value.

References l, p, and value.

◆ swap()

void crawlservpp::Struct::TextMapEntry::swap ( TextMapEntry other)
inline

Swaps the text map entry with another.

Parameters
otherReference to the other text map entry to be swapped with.

Member Data Documentation

◆ l

std::size_t crawlservpp::Struct::TextMapEntry::l {}

The length of the annotated part inside the text.

Referenced by free(), length(), and str().

◆ p

std::size_t crawlservpp::Struct::TextMapEntry::p {}

The position of the annotated part inside the text.

Zero indicates the very beginning of the text.

Referenced by free(), pos(), and str().

◆ value

std::string crawlservpp::Struct::TextMapEntry::value

The documentation for this struct was generated from the following file: