mirror of
				https://github.com/qgis/QGIS.git
				synced 2025-11-03 00:14:12 -05:00 
			
		
		
		
	Rationale: - there was a lot of large objects passed by value, so potentially there's a speed bump from this - even for implicitly shared classes like QString/QList there's still a (small) cost for copying the objects when there's no reason to - it's the right thing to do!
		
			
				
	
	
		
			59 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			59 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
class QgsExpressionFieldBuffer
 | 
						|
{
 | 
						|
%TypeHeaderCode
 | 
						|
#include <qgsexpressionfieldbuffer.h>
 | 
						|
%End
 | 
						|
  public:
 | 
						|
    class ExpressionField
 | 
						|
    {
 | 
						|
      ExpressionField();
 | 
						|
      ExpressionField( const QString& exp, const QgsField& fld );
 | 
						|
    };
 | 
						|
 | 
						|
    QgsExpressionFieldBuffer();
 | 
						|
 | 
						|
    /**
 | 
						|
     * Add an expression to the buffer
 | 
						|
     *
 | 
						|
     * @param exp expression to add
 | 
						|
     * @param fld field to add
 | 
						|
     */
 | 
						|
    void addExpression( const QString& exp, const QgsField& fld );
 | 
						|
 | 
						|
    /**
 | 
						|
     * Remove an expression from the buffer
 | 
						|
     *
 | 
						|
     * @param index index of expression to remove
 | 
						|
     */
 | 
						|
    void removeExpression( int index );
 | 
						|
 | 
						|
    /**
 | 
						|
     * Changes the expression at a given index
 | 
						|
     *
 | 
						|
     * @param index The index of the expression to change
 | 
						|
     * @param exp   The new expression to set
 | 
						|
     *
 | 
						|
     * @note added in 2.9
 | 
						|
     */
 | 
						|
    void updateExpression( int index, const QString& exp );
 | 
						|
 | 
						|
    /**
 | 
						|
     * Saves expressions to xml under the layer node
 | 
						|
     */
 | 
						|
    void writeXml( QDomNode& layer_node, QDomDocument& document ) const;
 | 
						|
 | 
						|
    /**
 | 
						|
     * Reads expressions from project file
 | 
						|
     */
 | 
						|
    void readXml( const QDomNode& layer_node );
 | 
						|
 | 
						|
    /**
 | 
						|
     * Adds fields with the expressions buffered in this object to a QgsFields object
 | 
						|
     *
 | 
						|
     * @param flds The fields to be updated
 | 
						|
     */
 | 
						|
    void updateFields( QgsFields& flds );
 | 
						|
 | 
						|
    const QList<QgsExpressionFieldBuffer::ExpressionField>& expressions() const;
 | 
						|
};
 |