Introduce `SuggestionItem` class

This is a helper class that allows to create and manage individual
suggestion item and their data.
This commit is contained in:
Maneesh P M 2021-05-13 11:38:11 +05:30 committed by Matthieu Gautier
parent 3288cd80e5
commit 5315034afe
1 changed files with 35 additions and 0 deletions

View File

@ -37,6 +37,41 @@ using namespace std;
namespace kiwix
{
/**
* The SuggestionItem is a helper class that contains the info about a single
* suggestion item.
*/
class SuggestionItem
{
// Functions
private:
// Create a sugggestion item.
explicit SuggestionItem(std::string title, std::string normalizedTitle,
std::string path, std::string snippet = "") :
title(title),
normalizedTitle(normalizedTitle),
path(path),
snippet(snippet) {}
public:
const std::string getTitle() {return title;}
const std::string getNormalizedTitle() {return normalizedTitle;}
const std::string getPath() {return path;}
const std::string getSnippet() {return snippet;}
const bool hasSnippet() {return !snippet.empty();}
// Data
private:
std::string title;
std::string normalizedTitle;
std::string path;
std::string snippet;
friend class Reader;
};
/**
* The Reader class is the class who allow to get an entry content from a zim
* file.