QGIS API Documentation  3.6.0-Noosa (5873452)
qgsattributes.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsattributes.cpp - QgsAttributes
3 
4  ---------------------
5  begin : 29.3.2017
6  copyright : (C) 2017 by Denis Rouzaud
7  email : [email protected]
8  ***************************************************************************
9  * *
10  * This program is free software; you can redistribute it and/or modify *
11  * it under the terms of the GNU General Public License as published by *
12  * the Free Software Foundation; either version 2 of the License, or *
13  * (at your option) any later version. *
14  * *
15  ***************************************************************************/
16 
17 #include "qgsattributes.h"
18 #include "qgis.h"
19 
20 
22 {
23  QgsAttributeMap map;
24  for ( int idx = 0; idx < count(); ++idx )
25  {
26  QVariant v = at( idx );
27  if ( v.isValid() )
28  map.insert( idx, v );
29  }
30  return map;
31 }
32 
33 uint qHash( const QgsAttributes &attributes )
34 {
35  if ( attributes.isEmpty() )
36  return ~0;
37  else
38  return qHash( attributes.at( 0 ) );
39 }
uint qHash(const QgsAttributes &attributes)
Hash for QgsAttributes.
QMap< int, QVariant > QgsAttributeMap
Definition: qgsattributes.h:38
QgsAttributeMap toMap() const
Returns a QgsAttributeMap of the attribute values.
A vector of attributes.
Definition: qgsattributes.h:57