Skip to content

Commit

Permalink
Move url_encode to Maps group
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso authored and nyalldawson committed Dec 7, 2021
1 parent 92fae7c commit dfee289
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
18 changes: 18 additions & 0 deletions resources/function_help/json/url_encode
@@ -0,0 +1,18 @@
{
"name": "url_encode",
"type": "function",
"groups": ["Maps"],
"description": "Returns an URL encoded string from a map.<br>The underlying function uses <a href='https://doc.qt.io/qt-5/qurlquery.html#toString'>QUrlQuery::toString</a> with <a href='https://doc.qt.io/qt-5/qurl.html#ComponentFormattingOption-enum'>QUrl::FullyEncoded</a> flags.<br>Note that the plus sign '+' is not converted.",
"arguments": [
{
"arg": "map",
"description": "a map."
}
],
"examples": [
{
"expression": "url_encode(map('a&+b', 'a and plus b', 'a=b', 'a equals b'))",
"returns": "'a%26+b=a%20and%20plus%20b&a%3Db=a%20equals%20b'"
}
]
}
1 change: 0 additions & 1 deletion src/core/expression/qgsexpression.cpp
Expand Up @@ -948,7 +948,6 @@ QString QgsExpression::group( const QString &name )
sGroups()->insert( QStringLiteral( "Date and Time" ), tr( "Date and Time" ) );
sGroups()->insert( QStringLiteral( "Fields and Values" ), tr( "Fields and Values" ) );
sGroups()->insert( QStringLiteral( "Files and Paths" ), tr( "Files and Paths" ) );
sGroups()->insert( QStringLiteral( "Form Encoding" ), tr( "Form Encoding" ) );
sGroups()->insert( QStringLiteral( "Fuzzy Matching" ), tr( "Fuzzy Matching" ) );
sGroups()->insert( QStringLiteral( "General" ), tr( "General" ) );
sGroups()->insert( QStringLiteral( "GeometryGroup" ), tr( "Geometry" ) );
Expand Down
8 changes: 3 additions & 5 deletions src/core/expression/qgsexpressionfunction.cpp
Expand Up @@ -7293,10 +7293,6 @@ const QList<QgsExpressionFunction *> &QgsExpression::Functions()
<< new QgsStaticExpressionFunction( QStringLiteral( "from_base64" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "string" ) ),
fcnFromBase64, QStringLiteral( "Conversions" ) )

// Form encoding
<< new QgsStaticExpressionFunction( QStringLiteral( "url_encode" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "map" ) ),
fcnToFormUrlEncode, QStringLiteral( "Form Encoding" ) )

// deprecated stuff - hidden from users
<< new QgsStaticExpressionFunction( QStringLiteral( "$scale" ), QgsExpressionFunction::ParameterList(), fcnMapScale, QStringLiteral( "deprecated" ) );

Expand Down Expand Up @@ -8035,7 +8031,9 @@ const QList<QgsExpressionFunction *> &QgsExpression::Functions()
<< new QgsStaticExpressionFunction( QStringLiteral( "map_avals" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "map" ) ), fcnMapAVals, QStringLiteral( "Maps" ) )
<< new QgsStaticExpressionFunction( QStringLiteral( "map_prefix_keys" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "map" ) )
<< QgsExpressionFunction::Parameter( QStringLiteral( "prefix" ) ),
fcnMapPrefixKeys, QStringLiteral( "Maps" ) )
fcnMapPrefixKeys, QStringLiteral( "Maps" ) ),
<< new QgsStaticExpressionFunction( QStringLiteral( "url_encode" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "map" ) ),
fcnToFormUrlEncode, QStringLiteral( "Maps" ) )

;

Expand Down

0 comments on commit dfee289

Please sign in to comment.