Skip to content
Permalink
Browse files

Add uuid function for expression engine

  • Loading branch information
NathanW2 committed Oct 10, 2013
1 parent 2cd8938 commit 624202531881e481d2e7cbd7e277cf55503716db
Showing with 7 additions and 0 deletions.
  1. +7 −0 src/core/qgsexpression.cpp
@@ -21,6 +21,7 @@
#include <QDate>
#include <QRegExp>
#include <QColor>
#include <QUuid>

#include <math.h>
#include <limits>
@@ -696,6 +697,11 @@ static QVariant fcnRegexpSubstr( const QVariantList& values, const QgsFeature* ,
}
}

static QVariant fcnUuid( const QVariantList& values, const QgsFeature* , QgsExpression* parent )
{
return QUuid::createUuid().toString();
}

static QVariant fcnSubstr( const QVariantList& values, const QgsFeature* , QgsExpression* parent )
{
QString str = getStringValue( values.at( 0 ), parent );
@@ -1532,6 +1538,7 @@ const QList<QgsExpression::Function*> &QgsExpression::Functions()
<< new StaticFunction( "$rownum", 0, fcnRowNumber, "Record" )
<< new StaticFunction( "$id", 0, fcnFeatureId, "Record" )
<< new StaticFunction( "$scale", 0, fcnScale, "Record" )
<< new StaticFunction( "$uuid", 0, fcnUuid, "Record" )
<< new StaticFunction( "_specialcol_", 1, fcnSpecialColumn, "Special" )
;
}

0 comments on commit 6242025

Please sign in to comment.
You can’t perform that action at this time.