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

Namespace for functions accessing files. More...

Classes

class  Exception
 Class for file exceptions. More...
 

Reading and Writing

std::string read (const std::string &fileName, bool binary)
 Reads the content of the given file. More...
 
void write (const std::string &fileName, const std::string &content, bool binary)
 Writes the given content to the given file. More...
 

Detailed Description

Namespace for functions accessing files.

Function Documentation

◆ read()

std::string crawlservpp::Data::File::read ( const std::string &  fileName,
bool  binary 
)
inline

Reads the content of the given file.

Parameters
fileNameConstant reference to a string containing the name of the file to be read.
binaryIf true, the contents will be read binarily. If false, they will be read as text.
Returns
The copy of a string containing the content of the given file.
Exceptions
File::Exceptionif the file could not be opened for reading, e.g. if it does not exist.

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

◆ write()

void crawlservpp::Data::File::write ( const std::string &  fileName,
const std::string &  content,
bool  binary 
)
inline

Writes the given content to the given file.

Parameters
fileNameConstant reference to a string containing the name of the file to be written.
contentConstant reference to a string containing the content to be written to the given file.
binaryIf true, the contents will be written binarily. If false, they will be written as text.
Exceptions
File::Exceptionif the file could not be opened for writing.

Referenced by crawlservpp::Network::TorControl::newIdentity(), and crawlservpp::Main::Server::tick().