QGIS API Documentation 4.0.0-Norrköping (1ddcee3d0e4)
Loading...
Searching...
No Matches
qgssetrequestinitiator_p.h
Go to the documentation of this file.
1/***************************************************************************
2 qgssetrequestinitiator.h - description
3 -------------------
4 begin : 2024-02-10
5 copyright : (C) 2024 by Matthias Kuhn
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifndef QGSSETREQUESTINITIATOR_P_H
19#define QGSSETREQUESTINITIATOR_P_H
20
22
23constexpr int sFilePrefixLength = CMAKE_SOURCE_DIR[sizeof( CMAKE_SOURCE_DIR ) - 1] == '/' ? sizeof( CMAKE_SOURCE_DIR ) + 1 : sizeof( CMAKE_SOURCE_DIR );
24
25#ifndef __clang_analyzer__
26#define QgsSetRequestInitiatorClass( request, _class ) \
27 ( request ).setAttribute( static_cast< QNetworkRequest::Attribute >( QgsNetworkRequestParameters::AttributeInitiatorClass ), _class ); \
28 ( request ) \
29 .setAttribute( static_cast< QNetworkRequest::Attribute >( QgsNetworkRequestParameters::AttributeInitiatorRequestId ), QString( QString( __FILE__ ).mid( sFilePrefixLength ) + ':' + QString::number( __LINE__ ) + " (" + ( __FUNCTION__ ) + ")" ) );
30#define QgsSetRequestInitiatorId( request, str ) \
31 ( request ).setAttribute( \
32 static_cast< QNetworkRequest::Attribute >( QgsNetworkRequestParameters::AttributeInitiatorRequestId ), \
33 QString( QString( __FILE__ ).mid( sFilePrefixLength ) + ':' + QString::number( __LINE__ ) + " (" + ( __FUNCTION__ ) + "): " + ( str ) ) \
34 );
35#else
36#define QgsSetRequestInitiatorClass( request, _class ) \
37 ( void ) ( request ); \
38 ( void ) ( _class );
39#define QgsSetRequestInitiatorId( request, str ) \
40 ( void ) ( request ); \
41 ( void ) ( str );
42#endif
43
44#define QgsSetCPLHTTPFetchOverriderInitiatorClass( overrider, _class ) QgsSetRequestInitiatorClass( ( overrider ), _class )
45#endif // QGSSETREQUESTINITIATOR_P_H
constexpr int sFilePrefixLength