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
ResponseScopeGuard< Result, ResponseCallback > Struct Template Reference

This class sends a result or an error when going out of scope. More...

#include <qqmlbasemodule_p.h>

Collaboration diagram for ResponseScopeGuard< Result, ResponseCallback >:

Public Member Functions

 ResponseScopeGuard (Result &results, ResponseCallback &callback)
void setError (const QQmlLSUtils::ErrorMessage &error)
template<typename... T>
bool setErrorFrom (const std::variant< T... > &variant)
bool setErrorFrom (const std::optional< QQmlLSUtils::ErrorMessage > &error)
 ~ResponseScopeGuard ()

Public Attributes

std::variant< Result *, QQmlLSUtils::ErrorMessagem_response
ResponseCallback & m_callback

Detailed Description

template<typename Result, typename ResponseCallback>
struct ResponseScopeGuard< Result, ResponseCallback >

This class sends a result or an error when going out of scope.

It has a helper method setErrorFrom that sets an error from variant and optionals.

Definition at line 55 of file qqmlbasemodule_p.h.

Constructor & Destructor Documentation

◆ ResponseScopeGuard()

template<typename Result, typename ResponseCallback>
ResponseScopeGuard< Result, ResponseCallback >::ResponseScopeGuard ( Result & results,
ResponseCallback & callback )
inline

Definition at line 62 of file qqmlbasemodule_p.h.

References ResponseScopeGuard(), and m_callback.

Referenced by ResponseScopeGuard().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ~ResponseScopeGuard()

template<typename Result, typename ResponseCallback>
ResponseScopeGuard< Result, ResponseCallback >::~ResponseScopeGuard ( )
inline

Definition at line 102 of file qqmlbasemodule_p.h.

Member Function Documentation

◆ setError()

template<typename Result, typename ResponseCallback>
void ResponseScopeGuard< Result, ResponseCallback >::setError ( const QQmlLSUtils::ErrorMessage & error)
inline

Definition at line 68 of file qqmlbasemodule_p.h.

Referenced by setErrorFrom(), and setErrorFrom().

Here is the caller graph for this function:

◆ setErrorFrom() [1/2]

template<typename Result, typename ResponseCallback>
bool ResponseScopeGuard< Result, ResponseCallback >::setErrorFrom ( const std::optional< QQmlLSUtils::ErrorMessage > & error)
inline
    \internal
    Note: use it as follows:
    \badcode
    if (scopeGuard.setErrorFrom(xxx)) {

do early exit } xxx was not an error, continue

Definition at line 93 of file qqmlbasemodule_p.h.

References setError().

Here is the call graph for this function:

◆ setErrorFrom() [2/2]

template<typename Result, typename ResponseCallback>
template<typename... T>
bool ResponseScopeGuard< Result, ResponseCallback >::setErrorFrom ( const std::variant< T... > & variant)
inline

Definition at line 71 of file qqmlbasemodule_p.h.

References setError().

Here is the call graph for this function:

Member Data Documentation

◆ m_callback

template<typename Result, typename ResponseCallback>
ResponseCallback& ResponseScopeGuard< Result, ResponseCallback >::m_callback

Definition at line 60 of file qqmlbasemodule_p.h.

Referenced by ResponseScopeGuard().

◆ m_response

template<typename Result, typename ResponseCallback>
std::variant<Result *, QQmlLSUtils::ErrorMessage> ResponseScopeGuard< Result, ResponseCallback >::m_response

Definition at line 59 of file qqmlbasemodule_p.h.


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