QGIS API Documentation
4.3.0-Master (52aa6503bed)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
core
processing
qgsprocessingalgorithm_p.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsprocessingalgorithm_p.h
3
------------------------
4
begin : August 2026
5
copyright : (C) 2026 by Nyall Dawson
6
email : nyall dot dawson at gmail dot com
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 QGSPROCESSINGALGORITHMP_H
19
#define QGSPROCESSINGALGORITHMP_H
20
21
#include <typeindex>
22
#include <unordered_map>
23
24
#include "
qgis.h
"
25
#include "qgis_core.h"
26
27
#include <QIcon>
28
#include <QString>
29
#include <QVariant>
30
31
#define SIP_NO_FILE
32
33
using namespace
Qt::StringLiterals;
34
35
#define EXCLUDE_CPPCHECK
36
#ifdef EXCLUDE_CPPCHECK
37
38
#ifndef CMAKE_SOURCE_DIR
39
#define CMAKE_SOURCE_DIR ""
40
#endif
41
43
44
CORE_EXPORT std::unordered_map<std::type_index, QString> &
algorithmSourceRegistry
();
45
46
namespace
QgsProcessingAlgorithmPrivate
47
{
48
49
template
<
size_t
N>
struct
QgsStringLiteral
50
{
51
constexpr
QgsStringLiteral(
const
char
( &str )[N] )
52
{
53
for
(
size_t
i = 0; i < N; ++i )
54
value[i] = str[i];
55
}
56
char
value[N] = {};
57
};
58
59
constexpr
size_t
sFilePrefixLength
=
sizeof
(
CMAKE_SOURCE_DIR
) > 1 ?
sizeof
(
CMAKE_SOURCE_DIR
) : 0;
60
61
template
<
typename
ClassType,
int
LineNum, QgsStringLiteral File>
struct
QgsSourceLocationRegistrar
62
{
63
static
const
bool
registered;
64
static
bool
doRegister()
65
{
66
std::unordered_map<std::type_index, QString> ®istry =
algorithmSourceRegistry
();
67
68
registry[std::type_index(
typeid
( ClassType ) )] = QString::fromUtf8( File.value ).mid(
sFilePrefixLength
) + u
":"
_s + QString::number( LineNum );
69
return
true
;
70
}
71
};
72
73
// static instantiation triggers dynamic registration when the library loads
74
template
<
typename
ClassType,
int
LineNum, QgsStringLiteral File>
75
const
bool
QgsSourceLocationRegistrar<ClassType, LineNum, File>::registered = QgsSourceLocationRegistrar<ClassType, LineNum, File>::doRegister();
76
}
//namespace QgsProcessingAlgorithmPrivate
77
78
// the QGS_MARK_ALGORITHM_SOURCE macro should be placed within each c++ algorithm's implementation, at the location which best
79
// represents the source that reflects the internal logic of the algorithm. (Most of the time this will be at the start of the algorithm's
80
// processAlgorithm implementation)
81
#define QGS_MARK_ALGORITHM_SOURCE ( void ) QgsProcessingAlgorithmPrivate::QgsSourceLocationRegistrar<std::remove_pointer_t<decltype( this )>, __LINE__, __FILE__>::registered;
82
#endif
84
85
#endif
// QGSPROCESSINGALGORITHMP_H
qgis.h
algorithmSourceRegistry
std::unordered_map< std::type_index, QString > & algorithmSourceRegistry()
Definition
qgsprocessingalgorithm.cpp:47
CMAKE_SOURCE_DIR
#define CMAKE_SOURCE_DIR
Definition
qgsprocessingalgorithm_p.h:39
sFilePrefixLength
constexpr int sFilePrefixLength
Definition
qgssetrequestinitiator_p.h:23
Generated on
for QGIS API Documentation by
1.17.0