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

RAII wrapper for aspell configurations. More...

#include <AspellConfig.hpp>

Classes

class  Exception
 Class for aspell configuration-specific exceptions. More...
 

Construction and Destruction

 AspellConfig ()
 Constructor creating a new configuration. More...
 
virtual ~AspellConfig ()
 Destructor deleting the configuration, if necessary. More...
 

Getters

::AspellConfigget ()
 Gets a pointer to the underlying configuration. More...
 
const ::AspellConfiggetc () const
 Gets a constant pointer to the underlying configuration. More...
 
bool valid () const
 Gets whether the configuration is valid. More...
 

Setter

void setOption (const std::string &name, const std::string &value)
 Sets an option in the configuration. More...
 

Cleanup

void clear ()
 Deletes the configuration, if necessary. More...
 

Copy and Move

The class is both copyable and moveable.

 AspellConfig (const AspellConfig &other)
 Copy constructor. More...
 
 AspellConfig (AspellConfig &&other) noexcept
 Move constructor. More...
 
AspellConfigoperator= (const AspellConfig &other)
 Copy assignment operator. More...
 
AspellConfigoperator= (AspellConfig &&other) noexcept
 Move assignment operator. More...
 

Detailed Description

RAII wrapper for aspell configurations.

Creates the configuration 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

◆ AspellConfig() [1/3]

crawlservpp::Wrapper::AspellConfig::AspellConfig ( )
inline

Constructor creating a new configuration.

◆ ~AspellConfig()

crawlservpp::Wrapper::AspellConfig::~AspellConfig ( )
inlinevirtual

Destructor deleting the configuration, if necessary.

See also
clear

References clear().

◆ AspellConfig() [2/3]

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

Copy constructor.

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

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

Parameters
otherThe configuration to copy from.

◆ AspellConfig() [3/3]

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

Move constructor.

Moves the configuration from the specified location into this instance of the class.

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

Member Function Documentation

◆ clear()

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

Deletes the configuration, if necessary.

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

◆ get()

AspellConfig * crawlservpp::Wrapper::AspellConfig::get ( )
inline

Gets a pointer to the underlying configuration.

Returns
A pointer to the underlying configuration or nullptr if the configuration is not valid.
See also
getc, valid

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

◆ getc()

const ::AspellConfig * crawlservpp::Wrapper::AspellConfig::getc ( ) const
inline

Gets a constant pointer to the underlying configuration.

Returns
A constant pointer to the underlying configuration or nullptr if the configuration is not valid.
See also
get, valid

◆ operator=() [1/2]

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

Copy assignment operator.

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

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

References clear().

◆ operator=() [2/2]

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

Move assignment operator.

Moves the configuration from the specified location into this instance of the class.

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

References clear().

◆ setOption()

void crawlservpp::Wrapper::AspellConfig::setOption ( const std::string &  name,
const std::string &  value 
)
inline

Sets an option in the configuration.

The previous value of the option will be overwritten.

Parameters
nameName of the aspell configuration option.
valueNew value of the option.
Exceptions
AspellConfig::Exceptionif the current configuration, the name or the value of the option are not valid, or if its value could not be changed.

Referenced by crawlservpp::Data::TokenCorrect::TokenCorrect().

◆ valid()

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

Gets whether the configuration is valid.

Returns
True, if the configuration is valid. False otherwise.

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


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