libkeepass 0.2.0
KeePass key database importer/exporter library
Loading...
Searching...
No Matches
keepass::temporal< T > Class Template Reference

Template class for keeping track of when a variable is modified. More...

#include <temporal.hh>

Public Member Functions

 temporal ()=default
 Default-constructs an empty temporal wrapper.
 
 temporal (const T &value, std::time_t time)
 Constructs a temporal wrapper with an explicit timestamp.
 
 temporal (const temporal< T > &other)
 Copy-constructs from another temporal wrapper.
 
 temporal (temporal< T > &&other) noexcept
 Move-constructs from another temporal wrapper.
 
const T & value () const
 Returns a const reference to the stored value.
 
std::time_t time () const
 Returns the modification timestamp.
 
void set_time (std::time_t time)
 Sets the modification timestamp without changing the value.
 
void Set (const T &val)
 Replaces the stored value and updates the timestamp to now.
 
temporal< T > & operator= (const T &value)
 Assigns a plain value, updating the timestamp to now.
 
temporal< T > & operator= (const temporal< T > &other)
 Copy-assigns from another temporal wrapper.
 
temporal< T > & operator= (temporal< T > &&other) noexcept
 Move-assigns from another temporal wrapper.
 
 operator const T & () const
 Explicit conversion operator to the wrapped type.
 
const T * operator-> () const
 Arrow operator forwarding to the stored value.
 
const T & operator* () const
 Dereference operator forwarding to the stored value.
 

Detailed Description

template<typename T>
class keepass::temporal< T >

Template class for keeping track of when a variable is modified.

Template Parameters
TThe type of the tracked value.

Constructor & Destructor Documentation

◆ temporal() [1/3]

template<typename T >
keepass::temporal< T >::temporal ( const T &  value,
std::time_t  time 
)
inline

Constructs a temporal wrapper with an explicit timestamp.

Parameters
[in]valueInitial value.
[in]timeTimestamp of the value.

◆ temporal() [2/3]

template<typename T >
keepass::temporal< T >::temporal ( const temporal< T > &  other)
inline

Copy-constructs from another temporal wrapper.

Parameters
[in]otherSource wrapper.

◆ temporal() [3/3]

template<typename T >
keepass::temporal< T >::temporal ( temporal< T > &&  other)
inlinenoexcept

Move-constructs from another temporal wrapper.

Parameters
[in,out]otherSource wrapper (moved from).

Member Function Documentation

◆ operator const T &()

template<typename T >
keepass::temporal< T >::operator const T & ( ) const
inlineexplicit

Explicit conversion operator to the wrapped type.

Returns
Const reference to the value.

◆ operator*()

template<typename T >
const T & keepass::temporal< T >::operator* ( ) const
inline

Dereference operator forwarding to the stored value.

Returns
Const reference to the value.

◆ operator->()

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

Arrow operator forwarding to the stored value.

Returns
Pointer to the value.

◆ operator=() [1/3]

template<typename T >
temporal< T > & keepass::temporal< T >::operator= ( const T &  value)
inline

Assigns a plain value, updating the timestamp to now.

Parameters
[in]valueNew value.
Returns
Reference to this object.

◆ operator=() [2/3]

template<typename T >
temporal< T > & keepass::temporal< T >::operator= ( const temporal< T > &  other)
inline

Copy-assigns from another temporal wrapper.

Parameters
[in]otherSource wrapper.
Returns
Reference to this object.

◆ operator=() [3/3]

template<typename T >
temporal< T > & keepass::temporal< T >::operator= ( temporal< T > &&  other)
inlinenoexcept

Move-assigns from another temporal wrapper.

Parameters
[in,out]otherSource wrapper (moved from).
Returns
Reference to this object.

◆ Set()

template<typename T >
void keepass::temporal< T >::Set ( const T &  val)
inline

Replaces the stored value and updates the timestamp to now.

Parameters
[in]valNew value.

◆ set_time()

template<typename T >
void keepass::temporal< T >::set_time ( std::time_t  time)
inline

Sets the modification timestamp without changing the value.

Parameters
[in]timeNew timestamp.

◆ time()

template<typename T >
std::time_t keepass::temporal< T >::time ( ) const
inline

Returns the modification timestamp.

Returns
Timestamp as std::time_t.

◆ value()

template<typename T >
const T & keepass::temporal< T >::value ( ) const
inline

Returns a const reference to the stored value.

Returns
Const reference to the value.

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