QGIS API Documentation 3.41.0-Master (45a0abf3bec)
Loading...
Searching...
No Matches
qgsalgorithmstringconcatenation.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgsalgorithmstringconcatenation.cpp
3 ---------------------
4 begin : October 2017
5 copyright : (C) 2017 by Etienne Trimaille
6 email : etienne at kartoza 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
19
21
22QString QgsStringConcatenationAlgorithm::name() const
23{
24 return QStringLiteral( "stringconcatenation" );
25}
26
27Qgis::ProcessingAlgorithmFlags QgsStringConcatenationAlgorithm::flags() const
28{
30}
31
32QString QgsStringConcatenationAlgorithm::displayName() const
33{
34 return QObject::tr( "String concatenation" );
35}
36
37QStringList QgsStringConcatenationAlgorithm::tags() const
38{
39 return QObject::tr( "string,concatenation,merge" ).split( ',' );
40}
41
42QString QgsStringConcatenationAlgorithm::group() const
43{
44 return QObject::tr( "Modeler tools" );
45}
46
47QString QgsStringConcatenationAlgorithm::groupId() const
48{
49 return QStringLiteral( "modelertools" );
50}
51
52QString QgsStringConcatenationAlgorithm::shortHelpString() const
53{
54 return QObject::tr( "This algorithm concatenates two strings together." );
55}
56
57QgsStringConcatenationAlgorithm *QgsStringConcatenationAlgorithm::createInstance() const
58{
59 return new QgsStringConcatenationAlgorithm();
60}
61
62void QgsStringConcatenationAlgorithm::initAlgorithm( const QVariantMap & )
63{
64 addParameter( new QgsProcessingParameterString( QStringLiteral( "INPUT_1" ), QObject::tr( "Input 1" ), QVariant(), false, false ) );
65 addParameter( new QgsProcessingParameterString( QStringLiteral( "INPUT_2" ), QObject::tr( "Input 2" ), QVariant(), false, false ) );
66 addOutput( new QgsProcessingOutputString( QStringLiteral( "CONCATENATION" ), QObject::tr( "Concatenation" ) ) );
67}
68
69QVariantMap QgsStringConcatenationAlgorithm::processAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback * )
70{
71 const QString input_1 = parameterAsString( parameters, QStringLiteral( "INPUT_1" ), context );
72 const QString input_2 = parameterAsString( parameters, QStringLiteral( "INPUT_2" ), context );
73
74 QVariantMap outputs;
75 outputs.insert( QStringLiteral( "CONCATENATION" ), QString( input_1 + input_2 ) );
76 return outputs;
77}
78
QFlags< ProcessingAlgorithmFlag > ProcessingAlgorithmFlags
Flags indicating how and when an algorithm operates and should be exposed to users.
Definition qgis.h:3347
@ HideFromToolbox
Algorithm should be hidden from the toolbox.
@ SkipGenericModelLogging
When running as part of a model, the generic algorithm setup and results logging should be skipped.
Contains information about the context in which a processing algorithm is executed.
Base class for providing feedback from a processing algorithm.
A string output for processing algorithms.
A string parameter for processing algorithms.