Documented search functions.

This commit is contained in:
tastytea 2019-07-28 00:07:55 +02:00
parent ba78adb399
commit 57e3fc0289
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
2 changed files with 35 additions and 2 deletions

View File

@ -24,3 +24,4 @@ BUILTIN_STL_SUPPORT = YES
VERBATIM_HEADERS = YES
INLINE_SOURCES = YES
SEARCHENGINE = YES
SHOW_FILES = YES

View File

@ -21,20 +21,52 @@
#include <string>
#include "sqlite.hpp"
//! @file
namespace remwharead
{
using std::vector;
using std::string;
/*!
* @brief Split expression in subexpressions.
*
* First it splits at `OR` or `||`, then it splits the subexpressions at
* `AND` or `&&`. The first vector contains all tags before the first `OR`.
*
* @return Vector of `OR`-vectors of `AND`-tags.
*/
const vector<vector<string>> parse_expression(string expression);
//! Convert str to lowercase. Works with unicode.
const string to_lowercase(const string &str);
//! Seach database entries for tags.
/*!
* @brief Search in tags of database entries.
*
* Only matches whole tags, *Pill* does not match *Pillow*.
*
* @param entries Vector of Database::entry to search.
* @param expression Search expression.
* @param is_re Is it a regular expression?
*
* @return Vector of matching Database::entry.
*/
const vector<Database::entry>
search_tags(const vector<Database::entry> &entries, string expression,
const bool is_re);
//! Search tags, title, description and full text.
/*!
* @brief Search in full text of database entries.
*
* Searches in tags, title, description and full text.
*
* @param entries Vector of Database::entry to search.
* @param expression Search expression.
* @param is_re Is it a regular expression?
*
* @return Vector of matching Database::entry.
*/
const vector<Database::entry>
search_all(const vector<Database::entry> &entries, string expression,
const bool is_re);