crawlserv++  [under development]
Application for crawling and analyzing textual content of websites.
crawlservpp::Data::ImportExport::Text Namespace Reference

Namespace for importing and exporting raw text. More...

Import and Export

std::queue< std::string > importList (const std::string &content, bool skipFirstLine, bool ignoreEmpty)
 Imports a list from raw text content, with each line representing a list entry. More...
 
std::string exportList (std::queue< std::string > &list, const std::optional< std::string > &header, bool ignoreEmpty)
 Exports a list to raw text content, with each line representing a list entry. More...
 

Detailed Description

Namespace for importing and exporting raw text.

Function Documentation

◆ exportList()

std::string crawlservpp::Data::ImportExport::Text::exportList ( std::queue< std::string > &  list,
const std::optional< std::string > &  header,
bool  ignoreEmpty 
)
inline

Exports a list to raw text content, with each line representing a list entry.

Parameters
listReference to a queue containing the list entries. It will be emptied in the process, even if entries will be ignored, because they are empty.
headerConstant reference to an optional string containing a header for the list. If given, it will be added to the beginning of the resulting content, in a separate line.
ignoreEmptyIf true, empty list entries will not be written to the resulting raw text content, although they will still be removed from the given queue.
Returns
A new string containing the resulting content.

References crawlservpp::Helper::Strings::join().

Referenced by crawlservpp::Main::Server::tick().

◆ importList()

std::queue< std::string > crawlservpp::Data::ImportExport::Text::importList ( const std::string &  content,
bool  skipFirstLine,
bool  ignoreEmpty 
)
inline

Imports a list from raw text content, with each line representing a list entry.

Parameters
contentA constant reference to the content to be parsed as a list, each line representing a list entry.
skipFirstLineIf true, the first line in the content will be ignored, e.g. when it contains a header for the list.
ignoreEmptyIf true, empty lines will be ignored.
Returns
A queue containing the list entries extracted from the given content.

References crawlservpp::Helper::Strings::splitToQueue().

Referenced by crawlservpp::Main::Server::tick().