Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
sipify core field formatter
  • Loading branch information
3nids committed May 24, 2017
1 parent 30a7e44 commit cf68aed
Show file tree
Hide file tree
Showing 9 changed files with 235 additions and 107 deletions.
7 changes: 0 additions & 7 deletions python/auto_sip.blacklist
Expand Up @@ -57,13 +57,6 @@ core/gps/qgsgpsdconnection.sip
core/gps/qgsgpsdetector.sip
core/gps/qgsnmeaconnection.sip
core/gps/qgsqtlocationconnection.sip
core/fieldformatter/qgsdatetimefieldformatter.sip
core/fieldformatter/qgsfallbackfieldformatter.sip
core/fieldformatter/qgskeyvaluefieldformatter.sip
core/fieldformatter/qgslistfieldformatter.sip
core/fieldformatter/qgsrelationreferencefieldformatter.sip
core/fieldformatter/qgsvaluemapfieldformatter.sip
core/fieldformatter/qgsvaluerelationfieldformatter.sip
core/raster/qgsbilinearrasterresampler.sip
core/raster/qgsbrightnesscontrastfilter.sip
core/raster/qgscliptominmaxenhancement.sip
Expand Down
57 changes: 39 additions & 18 deletions python/core/fieldformatter/qgsdatetimefieldformatter.sip
@@ -1,29 +1,50 @@
/***************************************************************************
qgsdatetimefieldformatter.sip - QgsDateTimeFieldFormatter

---------------------
begin : 2.12.2016
copyright : (C) 2016 by Matthias Kuhn
email : matthias@opengis.ch
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/fieldformatter/qgsdatetimefieldformatter.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/


class QgsDateTimeFieldFormatter : QgsFieldFormatter
{
%Docstring
Field formatter for a date time field.
This represents a date, time or datetime value based on
the field configuration.

.. versionadded:: 3.0
%End

%TypeHeaderCode
#include "qgsdatetimefieldformatter.h"
%End
public:
QgsDateTimeFieldFormatter();
static const QString DEFAULT_DATE_FORMAT;
static const QString DEFAULT_TIME_FORMAT;
static const QString DEFAULT_DATETIME_FORMAT;

QString id() const;
virtual QString id() const;

virtual QString representValue( QgsVectorLayer *layer, int fieldIndex, const QVariantMap &config, const QVariant &cache, const QVariant &value ) const;

static QString defaultFormat( const QVariant::Type type );
static QString defaultFormat( QVariant::Type type );
%Docstring
Get the default format in function of the type.
The type is expected to be one of

- QVariant.DateTime
- QVariant.Date
- QVariant.Time
:rtype: str
%End
};

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/fieldformatter/qgsdatetimefieldformatter.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
27 changes: 25 additions & 2 deletions python/core/fieldformatter/qgsfallbackfieldformatter.sip
@@ -1,9 +1,32 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/fieldformatter/qgsfallbackfieldformatter.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/


class QgsFallbackFieldFormatter : QgsFieldFormatter
{
%Docstring
A default fallback field formatter in case no specialized field formatter is defined.
The values will be returned unmodified.

.. versionadded:: 3.0
%End

%TypeHeaderCode
#include "qgsfallbackfieldformatter.h"
%End
public:
QgsFallbackFieldFormatter();
QString id() const;
virtual QString id() const;
};

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/fieldformatter/qgsfallbackfieldformatter.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
46 changes: 29 additions & 17 deletions python/core/fieldformatter/qgskeyvaluefieldformatter.sip
@@ -1,25 +1,37 @@
/***************************************************************************
qgskeyvaluefieldformatter.sip - QgsKeyValueFieldFormatter
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/fieldformatter/qgskeyvaluefieldformatter.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/


---------------------
begin : 3.12.2016
copyright : (C) 2016 by Matthias Kuhn
email : matthias@opengis.ch
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
class QgsKeyValueFieldFormatter : QgsFieldFormatter
{
%Docstring
Field formatter for a key value field.
This represents a list type value.
Values will be represented as a colon-delimited and
comma-separated list.

E.g. "color: yellow, amount: 5"

.. versionadded:: 3.0
%End

%TypeHeaderCode
#include "qgskeyvaluefieldformatter.h"
%End
public:
QgsKeyValueFieldFormatter();
QString id() const;
QString representValue( QgsVectorLayer *layer, int fieldIndex, const QVariantMap &config, const QVariant &cache, const QVariant &value ) const;
virtual QString id() const;
virtual QString representValue( QgsVectorLayer *layer, int fieldIndex, const QVariantMap &config, const QVariant &cache, const QVariant &value ) const;
};

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/fieldformatter/qgskeyvaluefieldformatter.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
45 changes: 26 additions & 19 deletions python/core/fieldformatter/qgslistfieldformatter.sip
@@ -1,28 +1,35 @@
/***************************************************************************
qgslistfieldformatter.sip - QgsListFieldFormatter
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/fieldformatter/qgslistfieldformatter.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/


---------------------
begin : 3.12.2016
copyright : (C) 2016 by Matthias Kuhn
email : matthias@opengis.ch
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
class QgsListFieldFormatter : QgsFieldFormatter
{
%Docstring
Field formatter for a list field.
This represents a list type value.
Values will be represented as a comma-separated list.

.. versionadded:: 3.0
%End

%TypeHeaderCode
#include "qgslistfieldformatter.h"
%End

public:
QgsListFieldFormatter();

QString id() const;
virtual QString id() const;

QString representValue( QgsVectorLayer *layer, int fieldIndex, const QVariantMap &config, const QVariant &cache, const QVariant &value ) const;
virtual QString representValue( QgsVectorLayer *layer, int fieldIndex, const QVariantMap &config, const QVariant &cache, const QVariant &value ) const;
};

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/fieldformatter/qgslistfieldformatter.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
31 changes: 28 additions & 3 deletions python/core/fieldformatter/qgsrelationreferencefieldformatter.sip
@@ -1,12 +1,37 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/fieldformatter/qgsrelationreferencefieldformatter.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/


class QgsRelationReferenceFieldFormatter : QgsFieldFormatter
{
%Docstring
Field formatter for a relation reference field.
A value relation field formatter looks up the values from
features on another layer.

.. versionadded:: 3.0
%End

%TypeHeaderCode
#include "qgsrelationreferencefieldformatter.h"
%End
public:
QgsRelationReferenceFieldFormatter();
virtual QString id() const;

QString id() const;
virtual QString representValue( QgsVectorLayer *layer, int fieldIndex, const QVariantMap &config, const QVariant &cache, const QVariant &value ) const;
virtual QVariant sortValue( QgsVectorLayer *layer, int fieldIndex, const QVariantMap&config, const QVariant &cache, const QVariant &value ) const;

virtual QVariant sortValue( QgsVectorLayer *layer, int fieldIndex, const QVariantMap &config, const QVariant &cache, const QVariant &value ) const;
};

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/fieldformatter/qgsrelationreferencefieldformatter.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
62 changes: 43 additions & 19 deletions python/core/fieldformatter/qgsvaluemapfieldformatter.sip
@@ -1,29 +1,53 @@
/***************************************************************************
qgsvaluemapfieldformatter.sip - QgsValueMapFieldFormatter

---------------------
begin : 3.12.2016
copyright : (C) 2016 by Matthias Kuhn
email : matthias@opengis.ch
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/fieldformatter/qgsvaluemapfieldformatter.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/


class QgsValueMapFieldFormatter : QgsFieldFormatter
{
%Docstring
Field formatter for a ValueMap field.
A value relation field formatter looks up the values a map.

The map is defined in the configuration as dictionary under the key "map".

{ "map": { 1: "one", 2: "two", 3: "three" } }

Values that are not on the map will be wrapped in parentheses. So with the above
configuration:

- 3 => "three"
- 5 => "(5)"

.. versionadded:: 3.0
%End

%TypeHeaderCode
#include "qgsvaluemapfieldformatter.h"
%End
public:
QgsValueMapFieldFormatter();

QString id() const;
static const QString NULL_VALUE;
%Docstring
Will be saved in the configuration when a value is NULL.
It's the magic UUID {2839923C-8B7D-419E-B84B-CA2FE9B80EC7}
%End

virtual QString id() const;

QString representValue( QgsVectorLayer *layer, int fieldIndex, const QVariantMap &config, const QVariant &cache, const QVariant &value ) const;
virtual QString representValue( QgsVectorLayer *layer, int fieldIndex, const QVariantMap &config, const QVariant &cache, const QVariant &value ) const;

QVariant sortValue( QgsVectorLayer *layer, int fieldIndex, const QVariantMap &config, const QVariant &cache, const QVariant &value ) const;
virtual QVariant sortValue( QgsVectorLayer *layer, int fieldIndex, const QVariantMap &config, const QVariant &cache, const QVariant &value ) const;
};

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/fieldformatter/qgsvaluemapfieldformatter.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/

0 comments on commit cf68aed

Please sign in to comment.