QGIS API Documentation 3.40.0-Bratislava (b56115d8743)
Loading...
Searching...
No Matches
Public Member Functions | List of all members
QgsOptional< T > Class Template Reference

QgsOptional is a container for other classes and adds an additional enabled/disabled flag. More...

#include <qgsoptional.h>

Public Member Functions

 QgsOptional ()=default
 A QgsOptional is disabled by default if default constructed.
 
 QgsOptional (const T &data)
 A QgsOptional is enabled by default if constructed with payload.
 
 QgsOptional (const T &data, bool enabled)
 A QgsOptional constructed with enabled status and data.
 
data () const
 Access the payload data.
 
bool enabled () const
 Check if this optional is enabled.
 
 operator bool () const
 Boolean operator.
 
const T * operator-> () const
 Access the payload data.
 
bool operator== (const QgsOptional< T > &other) const
 Compare this QgsOptional to another one.
 
void setData (const T &data)
 Set the payload data.
 
void setEnabled (bool enabled)
 Set if this optional is enabled.
 

Detailed Description

template<typename T>
class QgsOptional< T >

QgsOptional is a container for other classes and adds an additional enabled/disabled flag.

Often it is used for configuration options which can be enabled or disabled but also have more internal configuration information that should not be lost when disabling and re-enabling.

Note
For Python you need to use implementations for specific template classes
Not available in Python bindings (although SIP file is present for specific implementations).

Definition at line 35 of file qgsoptional.h.

Constructor & Destructor Documentation

◆ QgsOptional() [1/3]

template<typename T >
QgsOptional< T >::QgsOptional ( )
default

A QgsOptional is disabled by default if default constructed.

◆ QgsOptional() [2/3]

template<typename T >
QgsOptional< T >::QgsOptional ( const T &  data)
inline

A QgsOptional is enabled by default if constructed with payload.

Definition at line 47 of file qgsoptional.h.

◆ QgsOptional() [3/3]

template<typename T >
QgsOptional< T >::QgsOptional ( const T &  data,
bool  enabled 
)
inline

A QgsOptional constructed with enabled status and data.

Definition at line 56 of file qgsoptional.h.

Member Function Documentation

◆ data()

template<typename T >
T QgsOptional< T >::data ( ) const
inline

Access the payload data.

Definition at line 113 of file qgsoptional.h.

◆ enabled()

template<typename T >
bool QgsOptional< T >::enabled ( ) const
inline

Check if this optional is enabled.

Definition at line 86 of file qgsoptional.h.

◆ operator bool()

template<typename T >
QgsOptional< T >::operator bool ( ) const
inlineexplicit

Boolean operator.

Will return true if this optional is enabled.

Definition at line 77 of file qgsoptional.h.

◆ operator->()

template<typename T >
const T * QgsOptional< T >::operator-> ( ) const
inline

Access the payload data.

Definition at line 104 of file qgsoptional.h.

◆ operator==()

template<typename T >
bool QgsOptional< T >::operator== ( const QgsOptional< T > &  other) const
inline

Compare this QgsOptional to another one.

This will compare the enabled flag and call the == operator of the contained class.

Definition at line 69 of file qgsoptional.h.

◆ setData()

template<typename T >
void QgsOptional< T >::setData ( const T &  data)
inline

Set the payload data.

Definition at line 122 of file qgsoptional.h.

◆ setEnabled()

template<typename T >
void QgsOptional< T >::setEnabled ( bool  enabled)
inline

Set if this optional is enabled.

Definition at line 95 of file qgsoptional.h.


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