SlHelpers
Loading...
Searching...
No Matches
SlHelpers::PtrStore< T, Deleter > Class Template Reference

A store for a pointer which is freed in the destructor using sqlite3_free(). More...

#include <PtrStore.h>

Public Member Functions

 PtrStore (T *t) noexcept
 Construct a new PtrStore with pointer set to t.
 PtrStore (const PtrStore &)=delete
PtrStore & operator= (const PtrStore &)=delete
 PtrStore (PtrStore &&other) noexcept
 Move constructor.
PtrStore & operator= (PtrStore &&other) noexcept
 Move assignment.
bool valid () const
 Does this instance hold a valid pointer?
 operator bool () const
 bool wrapper around valid()
bool operator! () const
 ! wrapper around valid()
std::string_view str () const noexcept
 Return the current pointer as string.
const T * get () const noexcept
 Get the stored pointer.
T * get () noexcept
 Get the stored pointer.
T * operator* () noexcept
 Get the stored pointer.
const T * operator* () const noexcept
 Get the stored pointer.
T * operator-> () noexcept
 Get the stored pointer.
const T * operator-> () const noexcept
 Get the stored pointer.
T * release ()
 Return the pointer and stop owning it.
void reset (T *t=nullptr)
 Set the pointer to t.
T ** ptr () noexcept
 Get a pointer to the internal pointer.

Detailed Description

template<typename T, typename Deleter>
class SlHelpers::PtrStore< T, Deleter >

A store for a pointer which is freed in the destructor using sqlite3_free().

Member Function Documentation

◆ ptr()

template<typename T, typename Deleter>
T ** SlHelpers::PtrStore< T, Deleter >::ptr ( )
inlinenoexcept

Get a pointer to the internal pointer.

Returns
Pointer to the internal pointer.

Usually to assign to the pointer. The previous pointer is freed if it was valid.

◆ str()

template<typename T, typename Deleter>
std::string_view SlHelpers::PtrStore< T, Deleter >::str ( ) const
inlinenoexcept

Return the current pointer as string.

Returns
The current pointer as a string or empty string if the pointer is not valid.

The documentation for this class was generated from the following file:
  • /home/abuild/rpmbuild/BUILD/slhelpers-20260428.f233ce9-build/slhelpers-20260428.f233ce9/include/helpers/PtrStore.h