Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
FbGuard< T > Class Template Reference

#include <qsql_firebird_helpers_p.h>

Collaboration diagram for FbGuard< T >:

Public Types

using FreeFn = void (*)(T *)

Public Member Functions

Q_NODISCARD_CTOR FbGuard (T *handle, FreeFn freeFn)
 ~FbGuard ()
 FbGuard (const FbGuard &)=delete
FbGuardoperator= (const FbGuard &)=delete
T * get () const
T * operator-> () const
 operator bool () const
T * take ()
void dismiss ()
template<typename CloseFn>
void closeWith (CloseFn closeFn, bool rethrow=true)

Detailed Description

template<typename T>
class FbGuard< T >

Definition at line 58 of file qsql_firebird_helpers_p.h.

Member Typedef Documentation

◆ FreeFn

template<typename T>
using FbGuard< T >::FreeFn = void (*)(T *)

Definition at line 61 of file qsql_firebird_helpers_p.h.

Constructor & Destructor Documentation

◆ FbGuard() [1/2]

template<typename T>
Q_NODISCARD_CTOR FbGuard< T >::FbGuard ( T * handle,
FreeFn freeFn )
inline

A discarded unnamed temporary would free the handle immediately while later code keeps using it — force the guard to be a named local.

Definition at line 66 of file qsql_firebird_helpers_p.h.

◆ ~FbGuard()

template<typename T>
FbGuard< T >::~FbGuard ( )
inline

Definition at line 67 of file qsql_firebird_helpers_p.h.

◆ FbGuard() [2/2]

template<typename T>
FbGuard< T >::FbGuard ( const FbGuard< T > & )
delete

Intentionally scope-pinned: not copyable, and no move operations — ownership transfer goes through take() instead.

Member Function Documentation

◆ closeWith()

template<typename T>
template<typename CloseFn>
void FbGuard< T >::closeWith ( CloseFn closeFn,
bool rethrow = true )
inline

Graceful close. On success the guard is dismissed (close already released the interface). If closeFn throws, the destructor still frees the handle; the exception is rethrown unless rethrow == false (for noexcept cleanup paths that must not propagate).

Definition at line 90 of file qsql_firebird_helpers_p.h.

◆ dismiss()

template<typename T>
void FbGuard< T >::dismiss ( )
inline

Definition at line 81 of file qsql_firebird_helpers_p.h.

◆ get()

template<typename T>
T * FbGuard< T >::get ( ) const
inline

Definition at line 75 of file qsql_firebird_helpers_p.h.

◆ operator bool()

template<typename T>
FbGuard< T >::operator bool ( ) const
inlineexplicit

Definition at line 77 of file qsql_firebird_helpers_p.h.

◆ operator->()

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

Definition at line 76 of file qsql_firebird_helpers_p.h.

◆ operator=()

template<typename T>
FbGuard & FbGuard< T >::operator= ( const FbGuard< T > & )
delete

◆ take()

template<typename T>
T * FbGuard< T >::take ( )
inline

Definition at line 80 of file qsql_firebird_helpers_p.h.


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