Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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 QQmlLSUtilsErrorMessage &error)
 
template<typename... T>
bool setErrorFrom (const std::variant< T... > &variant)
 
bool setErrorFrom (const std::optional< QQmlLSUtilsErrorMessage > &error)
 
 ~ResponseScopeGuard ()
 

Public Attributes

std::variant< Result *, QQmlLSUtilsErrorMessagem_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 54 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 61 of file qqmlbasemodule_p.h.

◆ ~ResponseScopeGuard()

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

Member Function Documentation

◆ setError()

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

Definition at line 67 of file qqmlbasemodule_p.h.

References error, and ResponseScopeGuard< Result, ResponseCallback >::m_response.

Referenced by QQmlDocumentFormatting::process(), QQmlHover::process(), QQmlRenameSymbolSupport::process(), ResponseScopeGuard< Result, ResponseCallback >::setErrorFrom(), and ResponseScopeGuard< Result, ResponseCallback >::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< QQmlLSUtilsErrorMessage > & 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 92 of file qqmlbasemodule_p.h.

References error, and ResponseScopeGuard< Result, ResponseCallback >::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 70 of file qqmlbasemodule_p.h.

References ResponseScopeGuard< Result, ResponseCallback >::setError(), and variant.

Referenced by QQmlFindUsagesSupport::process(), QmlGoToDefinitionSupport::process(), QmlGoToTypeDefinitionSupport::process(), and QQmlRenameSymbolSupport::process().

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

Member Data Documentation

◆ m_callback

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

◆ m_response

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

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