RStudio Launcher Plugin SDK  1.1.3
A software development kit for creating plugins that work the the RStudio Launcher.
Public Member Functions | List of all members
rstudio::launcher_plugins::Optional< T > Class Template Reference

Container class which represents a value that may or may not be set. More...

#include <Optional.hpp>

Public Member Functions

 Optional ()=default
 Default constructor.
 
 Optional (T *in_value)
 Constructor. More...
 
 Optional (const T &in_value)
 Constructor. More...
 
 Optional (const Optional &in_other)
 Copy constructor. More...
 
 Optional (Optional &&in_other) noexcept
 Move constructor. More...
 
 operator bool () const
 Boolean operator. More...
 
bool operator! () const
 Not boolean operator. More...
 
Optionaloperator= (const Optional &in_other)
 Assignment operator. More...
 
Optionaloperator= (Optional &&in_other) noexcept
 Assignment operator. More...
 
Optionaloperator= (T *in_value)
 Assignment operator. More...
 
Optionaloperator= (const T &in_value)
 Assginment operator. More...
 
const T & getValueOr (const T &in_default) const
 Gets the value of this optional, or the provided default value if this optional has no value. More...
 
T & getValueOr (T &in_default)
 Gets the value of this optional, or the provided default value if this optional has no value. More...
 
bool hasValue () const
 Checks whether this optional has a value. More...
 

Detailed Description

template<typename T>
class rstudio::launcher_plugins::Optional< T >

Container class which represents a value that may or may not be set.

Template Parameters
TThe type of the optional value.

Constructor & Destructor Documentation

◆ Optional() [1/4]

template<typename T>
rstudio::launcher_plugins::Optional< T >::Optional ( T *  in_value)
inlineexplicit

Constructor.

Parameters
in_valueThe value to set on this optional. The optional takes ownership of this value.

◆ Optional() [2/4]

template<typename T>
rstudio::launcher_plugins::Optional< T >::Optional ( const T &  in_value)
inlineexplicit

Constructor.

Parameters
in_valueThe value to set on this optional.

◆ Optional() [3/4]

template<typename T>
rstudio::launcher_plugins::Optional< T >::Optional ( const Optional< T > &  in_other)
inline

Copy constructor.

Parameters
in_otherThe optional value to copy.

◆ Optional() [4/4]

template<typename T>
rstudio::launcher_plugins::Optional< T >::Optional ( Optional< T > &&  in_other)
inlinenoexcept

Move constructor.

Parameters
in_otherThe optional value to move into this optional value.

Member Function Documentation

◆ getValueOr() [1/2]

template<typename T>
const T& rstudio::launcher_plugins::Optional< T >::getValueOr ( const T &  in_default) const
inline

Gets the value of this optional, or the provided default value if this optional has no value.

Parameters
in_defaultThe default value to use if this optional has no value.
Returns
The value of this optional, or the provided default value if this optional has no value.

◆ getValueOr() [2/2]

template<typename T>
T& rstudio::launcher_plugins::Optional< T >::getValueOr ( T &  in_default)
inline

Gets the value of this optional, or the provided default value if this optional has no value.

Parameters
in_defaultThe default value to use if this optional has no value.
Returns
The value of this optional, or the provided default value if this optional has no value.

◆ hasValue()

template<typename T>
bool rstudio::launcher_plugins::Optional< T >::hasValue ( ) const
inline

Checks whether this optional has a value.

Returns
True if this optional has a value; false otherwise.

◆ operator bool()

template<typename T>
rstudio::launcher_plugins::Optional< T >::operator bool ( ) const
inlineexplicit

Boolean operator.

Returns
True if this optional has a value; false otherwise.

◆ operator!()

template<typename T>
bool rstudio::launcher_plugins::Optional< T >::operator! ( ) const
inline

Not boolean operator.

Returns
True if this optional does not have a value; false otherwise.

◆ operator=() [1/4]

template<typename T>
Optional& rstudio::launcher_plugins::Optional< T >::operator= ( const Optional< T > &  in_other)
inline

Assignment operator.

Parameters
in_otherThe optional value to copy to this optional.
Returns
A reference to this optional.

◆ operator=() [2/4]

template<typename T>
Optional& rstudio::launcher_plugins::Optional< T >::operator= ( const T &  in_value)
inline

Assginment operator.

Parameters
in_valueThe value to assign to this optional.
Returns
A reference to this optional.

◆ operator=() [3/4]

template<typename T>
Optional& rstudio::launcher_plugins::Optional< T >::operator= ( Optional< T > &&  in_other)
inlinenoexcept

Assignment operator.

Parameters
in_otherThe optional value to copy to this optional.
Returns
A reference to this optional.

◆ operator=() [4/4]

template<typename T>
Optional& rstudio::launcher_plugins::Optional< T >::operator= ( T *  in_value)
inline

Assignment operator.

Parameters
in_valueThe value to assign to this optional. The optional will take ownership of the value.
Returns
A reference to this optional.

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