QGIS API Documentation  2.18.3-Las Palmas (77b8c3d)
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 ()
 A QgsOptional is disabled by default if default constructed. More...
 
 QgsOptional (const T &data)
 A QgsOptional is enabled by default if constructed with payload. More...
 
 QgsOptional (const T &data, bool enabled)
 A QgsOptional constructed with enabled status and data. More...
 
data () const
 Access the payload data. More...
 
bool enabled () const
 Check if this optional is enabled. More...
 
 operator bool () const
 Boolean operator. More...
 
const T * operator-> () const
 Access the payload data. More...
 
bool operator== (const QgsOptional< T > &other) const
 Compare this QgsOptional to another one. More...
 
void setData (const T &data)
 Set the payload data. More...
 
void setEnabled (bool enabled)
 Set if this optional is enabled. More...
 

Detailed Description

template<class 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
Added in QGIS 2.18
For python you need to use implementations for specific template classes

Definition at line 32 of file qgsoptional.h.

Constructor & Destructor Documentation

template<class T>
QgsOptional< T >::QgsOptional ( )
inline

A QgsOptional is disabled by default if default constructed.

Definition at line 38 of file qgsoptional.h.

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

A QgsOptional is enabled by default if constructed with payload.

Definition at line 46 of file qgsoptional.h.

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

A QgsOptional constructed with enabled status and data.

Definition at line 55 of file qgsoptional.h.

Member Function Documentation

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

Access the payload data.

Note
Added in QGIS 2.18

Definition at line 117 of file qgsoptional.h.

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

Check if this optional is enabled.

Note
Added in QGIS 2.18

Definition at line 87 of file qgsoptional.h.

template<class T>
QgsOptional< T >::operator bool ( ) const
inline

Boolean operator.

Will return true if this optional is enabled.

Definition at line 77 of file qgsoptional.h.

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

Access the payload data.

Note
Added in QGIS 2.18

Definition at line 107 of file qgsoptional.h.

template<class 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.

Note
Added in QGIS 2.18

Definition at line 69 of file qgsoptional.h.

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

Set the payload data.

Note
Added in QGIS 2.18

Definition at line 127 of file qgsoptional.h.

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

Set if this optional is enabled.

Note
Added in QGIS 2.18

Definition at line 97 of file qgsoptional.h.


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