QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
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#define QgsSetRequestInitiatorClass(request, _class) ( request ).setAttribute( static_cast< QNetworkRequest::Attribute >( QgsNetworkRequestParameters::AttributeInitiatorClass ), _class ); ( request ).setAttribute( static_cast< QNetworkRequest::Attribute >( QgsNetworkRequestParameters::AttributeInitiatorRequestId ), QString(QString( __FILE__ ).mid( sFilePrefixLength ) + ':' + QString::number( __LINE__ ) + " (" + ( __FUNCTION__ ) + ")") );
26#define QgsSetRequestInitiatorId(request, str) ( request ).setAttribute( static_cast< QNetworkRequest::Attribute >( QgsNetworkRequestParameters::AttributeInitiatorRequestId ), QString(QString( __FILE__ ).mid( sFilePrefixLength ) + ':' + QString::number( __LINE__ ) + " (" + ( __FUNCTION__ ) + "): " + ( str ) ) );
27
28#define QgsSetCPLHTTPFetchOverriderInitiatorClass(overrider, _class) QgsSetRequestInitiatorClass((overrider), _class)
29#endif // QGSSETREQUESTINITIATOR_P_H
constexpr int sFilePrefixLength