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






typedef QList< QgsVectorLayerJoinInfo > QgsVectorJoinList;


class QgsVectorLayerJoinBuffer : QObject, QgsFeatureSink
{
%Docstring
Manages joined fields for a vector layer*
%End

%TypeHeaderCode
#include "qgsvectorlayerjoinbuffer.h"
%End
  public:
    QgsVectorLayerJoinBuffer( QgsVectorLayer *layer = 0 );

    bool addJoin( const QgsVectorLayerJoinInfo &joinInfo );
%Docstring
Joins another vector layer to this layer

:param joinInfo: join object containing join layer id, target and source field

:return: (since 2.6) whether the join was successfully added
%End

    bool removeJoin( const QString &joinLayerId );
%Docstring
Removes a vector layer join

:return: true if join was found and successfully removed
%End

    void updateFields( QgsFields &fields );
%Docstring
Updates field map with joined attributes

:param fields: map to append joined attributes
%End

    void createJoinCaches();
%Docstring
Calls cacheJoinLayer() for all vector joins
%End

    void writeXml( QDomNode &layer_node, QDomDocument &document ) const;
%Docstring
Saves mVectorJoins to xml under the layer node
%End

    void readXml( const QDomNode &layer_node );
%Docstring
Reads joins from project file.
Does not resolve layer IDs to layers - call resolveReferences() afterwards
%End

    void resolveReferences( QgsProject *project );
%Docstring
Resolves layer IDs of joined layers using given project's available layers

.. versionadded:: 3.0
%End

    bool containsJoins() const;
%Docstring
Quick way to test if there is any join at all
%End

    const QgsVectorJoinList &vectorJoins() const;

    const QgsVectorLayerJoinInfo *joinForFieldIndex( int index, const QgsFields &fields, int &sourceFieldIndex /Out/ ) const;
%Docstring
Finds the vector join for a layer field index.

:param index: this layers attribute index
:param fields: fields of the vector layer (including joined fields)

:return: - the vector layer join info
         - sourceFieldIndex: Output: field's index in source layer
%End

    int joinedFieldsOffset( const QgsVectorLayerJoinInfo *info, const QgsFields &fields );
%Docstring
Find out what is the first index of the join within fields. Returns -1 if join is not present

.. versionadded:: 2.6
%End

    static QVector<int> joinSubsetIndices( QgsVectorLayer *joinLayer, const QStringList &joinFieldsSubset );
%Docstring
Returns a vector of indices for use in join based on field names from the layer

.. versionadded:: 2.6
%End

    QList<const QgsVectorLayerJoinInfo *> joinsWhereFieldIsId( const QgsField &field ) const;
%Docstring
Returns joins where the field of a target layer is considered as an id.

:param field: the field of a target layer

:return: a list of vector joins

.. versionadded:: 3.0
%End

    QgsFeature joinedFeatureOf( const QgsVectorLayerJoinInfo *info, const QgsFeature &feature ) const;
%Docstring
Returns the joined feature corresponding to the feature.

:param info: the vector join information
:param feature: the feature of the target layer

.. versionadded:: 3.0
%End

    QgsFeature targetedFeatureOf( const QgsVectorLayerJoinInfo *info, const QgsFeature &feature ) const;
%Docstring
Returns the targeted feature corresponding to the joined feature.

:param info: the vector join information
:param feature: the feature of the joined layer

.. versionadded:: 3.0
%End

    bool isAuxiliaryJoin( const QgsVectorLayerJoinInfo &info ) const;
%Docstring
Returns ``True`` if the join information is about auxiliary layer, ``False`` otherwise

:param info: The join information

:return: ``True`` if the join information is about auxiliary layer, ``False`` otherwise


.. versionadded:: 3.0
%End

    QgsVectorLayerJoinBuffer *clone() const /Factory/;
%Docstring
Create a copy of the join buffer

.. versionadded:: 2.6
%End

    virtual bool addFeatures( QgsFeatureList &features, QgsFeatureSink::Flags flags = 0 );

%Docstring
Adds a list of features in joined layers. Features given in parameter
are those added in target layer. If a corresponding joined feature yet
exists in a joined layer, then this feature is just updated. Note that
if a corresponding joined feature has only empty fields, then it's not
created nor added.

:param features: The list of features added in the target layer
:param flags: Unused parameter

:return: ``False`` if an error happened, ``True`` otherwise


.. versionadded:: 3.0
%End

    bool changeAttributeValue( QgsFeatureId fid, int field, const QVariant &newValue, const QVariant &oldValue = QVariant() );
%Docstring
Changes attribute value in joined layers. The feature id given in
parameter is the one added in target layer. If the corresponding joined
feature does not exist in a joined layer, then it's automatically
created if its fields are not empty.

:param fid: The feature id
:param field: The field to update
:param newValue: The new value of the attribute
:param oldValue: The old value of the attribute

:return: ``False`` if an error happened, ``True`` otherwise


.. versionadded:: 3.0
%End

    bool changeAttributeValues( QgsFeatureId fid, const QgsAttributeMap &newValues, const QgsAttributeMap &oldValues = QgsAttributeMap() );
%Docstring
Changes attributes' values in joined layers. The feature id given in
parameter is the one added in target layer. If the corresponding joined
feature does not exist in a joined layer, then it's automatically
created if its fields are not empty.

:param fid: The feature id
:param newValues: The new values for attributes
:param oldValues: The old values for attributes

:return: ``False`` if an error happened, ``True`` otherwise


.. versionadded:: 3.0
%End

    bool deleteFeature( QgsFeatureId fid ) const;
%Docstring
Deletes a feature from joined layers. The feature id given in
parameter is the one coming from the target layer.

:param fid: The feature id from the target layer to delete

:return: ``False`` if an error happened, ``True`` otherwise


.. versionadded:: 3.0
%End

    bool deleteFeatures( const QgsFeatureIds &fids ) const;
%Docstring
Deletes a list of features from joined layers. Feature ids given
in a parameter are those coming from the target layer.

:param fids: Feature ids from the target layer to delete

:return: ``False`` if an error happened, ``True`` otherwise


.. versionadded:: 3.0
%End

  signals:

    void joinedFieldsChanged();
%Docstring
Emitted whenever the list of joined fields changes (e.g. added join or joined layer's fields change)

.. versionadded:: 2.6
%End

};

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