RStudio Launcher Plugin SDK
1.1.3
A software development kit for creating plugins that work the the RStudio Launcher.
|
24 #ifndef LAUNCHER_PLUGINS_OPTIONAL_HPP
25 #define LAUNCHER_PLUGINS_OPTIONAL_HPP
30 namespace launcher_plugins {
62 m_value(new T(in_value))
83 m_value.swap(in_other.m_value);
91 explicit operator bool()
const
115 if (
this == &in_other)
118 if (in_other.m_value ==
nullptr)
121 m_value.reset(
new T(*in_other.m_value));
135 if (
this == &in_other)
138 m_value = std::move(in_other.m_value);
151 m_value.reset(in_value);
164 m_value.reset(
new T(in_value));
192 return const_cast<T&>(const_cast<const Optional*>(
this)->
getValueOr(in_default));
202 return m_value !=
nullptr;
207 std::unique_ptr<T> m_value;
Optional & operator=(const T &in_value)
Assginment operator.
Definition: Optional.hpp:162
Optional(const T &in_value)
Constructor.
Definition: Optional.hpp:61
Optional()=default
Default constructor.
bool operator!() const
Not boolean operator.
Definition: Optional.hpp:101
Optional & operator=(T *in_value)
Assignment operator.
Definition: Optional.hpp:149
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.
Definition: Optional.hpp:175
Optional(T *in_value)
Constructor.
Definition: Optional.hpp:51
T & getValueOr(T &in_default)
Gets the value of this optional, or the provided default value if this optional has no value.
Definition: Optional.hpp:190
bool hasValue() const
Checks whether this optional has a value.
Definition: Optional.hpp:200
Optional & operator=(const Optional &in_other)
Assignment operator.
Definition: Optional.hpp:113
Container class which represents a value that may or may not be set.
Definition: Optional.hpp:38
Optional(Optional &&in_other) noexcept
Move constructor.
Definition: Optional.hpp:81
Optional(const Optional &in_other)
Copy constructor.
Definition: Optional.hpp:71
Optional & operator=(Optional &&in_other) noexcept
Assignment operator.
Definition: Optional.hpp:133