CBuild
C++ build system with scripts written in c++
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
lib::optional< T > Class Template Reference

Optional data type. More...

#include <optional.hpp>

Public Member Functions

 optional ()
 Create new optional datatype.
 
 optional (T val)
 Create new optional datatype.
 
void set (T val)
 Set value.
 
void clear ()
 Clear value.
 
get ()
 Get value.
 
bool is ()
 If value is not null.
 

Private Attributes

var
 Intrnal variable.
 
bool null
 Does values is saved.
 

Detailed Description

template<class T>
class lib::optional< T >

Optional data type.

Template Parameters
T-> Type of internal data

Definition at line 32 of file optional.hpp.

Constructor & Destructor Documentation

◆ optional() [1/2]

template<class T >
lib::optional< T >::optional ( )
inline

Create new optional datatype.

Definition at line 47 of file optional.hpp.

◆ optional() [2/2]

template<class T >
lib::optional< T >::optional ( T val)
inline

Create new optional datatype.

Parameters
val=> T -> Value

Definition at line 55 of file optional.hpp.

Member Function Documentation

◆ clear()

template<class T >
void lib::optional< T >::clear ( )
inline

Clear value.

Definition at line 71 of file optional.hpp.

Referenced by CBuild::types::file::file().

◆ get()

template<class T >
T lib::optional< T >::get ( )
inline

Get value.

Exceptions
std::runtime_error-> If type is null
Returns
T -> Value, if any

Definition at line 79 of file optional.hpp.

References lib::optional< T >::var.

◆ is()

template<class T >
bool lib::optional< T >::is ( )
inline

If value is not null.

Returns
bool -> true / false

Definition at line 91 of file optional.hpp.

References lib::optional< T >::null.

◆ set()

template<class T >
void lib::optional< T >::set ( T val)
inline

Set value.

Parameters
val=> T -> Value

Definition at line 64 of file optional.hpp.

Member Data Documentation

◆ null

template<class T >
bool lib::optional< T >::null
private

Does values is saved.

Definition at line 41 of file optional.hpp.

Referenced by lib::optional< T >::is().

◆ var

template<class T >
T lib::optional< T >::var
private

Intrnal variable.

Definition at line 37 of file optional.hpp.

Referenced by lib::optional< T >::get().


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