Improved library-documentation.

This commit is contained in:
tastytea 2019-08-07 20:32:46 +02:00
parent 84f9c0ad97
commit 82f471755e
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
2 changed files with 81 additions and 15 deletions

View File

@ -60,23 +60,48 @@ namespace remwharead
string description;
string fulltext;
//! Returns true if date and time are equal.
/*!
* @brief Returns true if date and time are equal.
*
* @since 0.6.0
*/
friend bool operator ==(const Database::entry &a,
const Database::entry &b);
//! The full text in one line.
/*!
* @brief The full text in one line.
*
* @since 0.6.0
*/
const string fulltext_oneline() const;
} entry;
//! Connects to the database and creates it if necessary.
/*!
* @brief Connects to the database and creates it if necessary.
*
* @since 0.6.0
*/
Database();
//! Returns true if connected to the database.
/*!
* @brief Returns true if connected to the database.
*
* @since 0.6.0
*/
operator bool() const;
//! Store a Database::entry in the database.
/*!
* @brief Store a Database::entry in the database.
*
* @since 0.6.0
*/
void store(const entry &data) const;
//! Retrieve a vector of Database::entry from the database.
/*!
* @brief Retrieve a vector of Database::entry from the database.
*
* @since 0.6.0
*/
const vector<entry> retrieve(
const time_point &start = time_point(),
const time_point &end = system_clock::now()) const;

View File

@ -71,30 +71,61 @@ namespace remwharead
class URI
{
public:
//! Construct object and set URL.
/*!
* @brief Construct object and set URL.
*
* Initializes TLS and sets proxy from the environment variable
* `http_proxy`, if possible.
*
* @since 0.6.0
*/
explicit URI(const string &uri);
virtual ~URI();
//! Download %URI and extract title, description and full text.
/*!
* @brief Download %URI and extract title, description and full text.
*
* @since 0.6.0
*/
const html_extract get();
//! Save %URI in archive and return archive-URI.
/*!
* @brief Save %URI in archive and return archive-URI.
*
* @since 0.6.0
*/
const archive_answer archive();
protected:
string _uri;
//! Make a HTTP(S) request.
/*!
* @brief Make a HTTP(S) request.
*
* @since 0.6.0
*/
const string make_request(const string &uri,
bool archive = false) const;
//! Extract the title from an HTML page.
/*!
* @brief Extract the title from an HTML page.
*
* @since 0.6.0
*/
const string extract_title(const string &html);
//! Extract the description from an HTML page.
/*!
* @brief Extract the description from an HTML page.
*
* @since 0.6.0
*/
const string extract_description(const string &html);
//! Removes HTML tags and superflous spaces from an HTML page.
/*!
* @brief Removes HTML tags and superflous spaces from an HTML page.
*
* @since 0.6.0
*/
const string strip_html(const string &html);
/*!
@ -102,14 +133,24 @@ namespace remwharead
*
* @param html HTML page.
* @param tag If set, only remove this tag.
*
* @since 0.6.0
*/
const string remove_html_tags(const string &html,
const string &tag = "");
//! Convert HTML entities to UTF-8.
/*!
* @brief Convert HTML entities to UTF-8.
*
* @since 0.6.0
*/
const string unescape_html(const string &html);
//! Replace newlines with spaces.
/*!
* @brief Replace newlines with spaces.
*
* @since 0.6.0
*/
const string remove_newlines(string text);
};
}