crawlserv++  [under development]
Application for crawling and analyzing textual content of websites.
crawlservpp::Wrapper::AspellList Class Reference

RAII wrapper for aspell word lists. More...

#include <AspellList.hpp>

Public Member Functions

 MAIN_EXCEPTION_CLASS ()
 Class for aspell word list-specific exceptions. More...
 

Construction and Destruction

 AspellList (const AspellWordList *source)
 Constructor creating a new word list. More...
 
virtual ~AspellList ()
 Destructor deleting the word list, if necessary. More...
 

Getters

bool valid () const
 Gets whether the word list is valid. More...
 

List Iteration

bool next (std::string &nextTo)
 Checks for the next list element. More...
 

Cleanup

void clear ()
 Deletes the word list, if necessary. More...
 

Copy and Move

The class is both copyable and moveable.

 AspellList (const AspellList &other)
 Copy constructor. More...
 
 AspellList (AspellList &&other) noexcept
 Move constructor. More...
 
AspellListoperator= (const AspellList &other)
 Copy assignment operator. More...
 
AspellListoperator= (AspellList &&other) noexcept
 Move assignment operator. More...
 

Detailed Description

RAII wrapper for aspell word lists.

Creates the word list on construction and deletes it on destruction, if still necessary, avoiding memory leaks.

Note
The class does not own the underlying pointer, but takes care of its deletion via API call.

Constructor & Destructor Documentation

◆ AspellList() [1/3]

crawlservpp::Wrapper::AspellList::AspellList ( const AspellWordList *  source)
inlineexplicit

Constructor creating a new word list.

Parameters
sourceThe source of the word list, e.g. as returned by aspell_speller_suggest .

◆ ~AspellList()

crawlservpp::Wrapper::AspellList::~AspellList ( )
inlinevirtual

Destructor deleting the word list, if necessary.

See also
clear

References clear().

◆ AspellList() [2/3]

crawlservpp::Wrapper::AspellList::AspellList ( const AspellList other)
inline

Copy constructor.

Creates a copy of the underlying word list in the given instance, saving it in this instance.

If the other word list is invalid, the current instance will also be invalid.

Parameters
otherThe word list to copy from.

◆ AspellList() [3/3]

crawlservpp::Wrapper::AspellList::AspellList ( AspellList &&  other)
inlinenoexcept

Move constructor.

Moves the word list from the specified location into this instance of the class.

Note
The other word list will be invalidated by this move.
Parameters
otherThe word list to move from.
See also
valid

Member Function Documentation

◆ clear()

void crawlservpp::Wrapper::AspellList::clear ( )
inline

Deletes the word list, if necessary.

Referenced by operator=(), and ~AspellList().

◆ MAIN_EXCEPTION_CLASS()

crawlservpp::Wrapper::AspellList::MAIN_EXCEPTION_CLASS ( )

Class for aspell word list-specific exceptions.

◆ next()

bool crawlservpp::Wrapper::AspellList::next ( std::string &  nextTo)
inline

Checks for the next list element.

Parameters
nextToReference to a string to which the next list element will be written, if available.
Returns
True, if another list element was available and has been written to nextTo. False otherwise.

Referenced by crawlservpp::Wrapper::AspellChecker::check().

◆ operator=() [1/2]

AspellList & crawlservpp::Wrapper::AspellList::operator= ( const AspellList other)
inline

Copy assignment operator.

Clears the existing word list if necessary and creates a copy of the underlying word list in the given instance, saving it in this instance.

Note
Nothing will be done if used on itself.
Parameters
otherThe word list to copy from.
Returns
A reference to the class containing the copy of the word list (i.e. *this).

References clear().

◆ operator=() [2/2]

AspellList & crawlservpp::Wrapper::AspellList::operator= ( AspellList &&  other)
inlinenoexcept

Move assignment operator.

Moves the word list from the specified location into this instance of the class.

Note
The other word list will be invalidated by this move.
Nothing will be done if used on itself.
Parameters
otherThe word list to move from.
Returns
A reference to the instance containing the word list after moving (i.e. *this).
See also
valid

References clear().

◆ valid()

bool crawlservpp::Wrapper::AspellList::valid ( ) const
inline

Gets whether the word list is valid.

Returns
True, if the word list is valid. False otherwise.

The documentation for this class was generated from the following file: