Skip to content

Commit 8f29f28

Browse files
committed
fix windows build and some warnings
1 parent 13a5167 commit 8f29f28

18 files changed

+138
-56
lines changed

python/core/qgsfeaturerequest.sip

+80-11
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,39 @@ class QgsFeatureRequest
1515
};
1616
typedef QFlags<QgsFeatureRequest::Flag> Flags;
1717

18+
/**
19+
* Types of filters.
20+
*/
1821
enum FilterType
1922
{
2023
FilterNone, //!< No filter is applied
21-
FilterRect, //!< Filter using a rectangle, no need to set NoGeometry
24+
FilterRect, //!< Obsolete, will be ignored. If a filterRect is set it will be used anyway. Filter using a rectangle, no need to set NoGeometry. Instead check for request.filterRect().isNull()
2225
FilterFid, //!< Filter using feature ID
2326
FilterExpression, //!< Filter using expression
2427
FilterFids //!< Filter using feature IDs
2528
};
2629

2730
/**
28-
* @brief The OrderByClause class represents an order by clause for a QgsFeatureRequest
31+
* The OrderByClause class represents an order by clause for a QgsFeatureRequest.
32+
*
33+
* It can be a simple field or an expression. Multiple order by clauses can be added to
34+
* a QgsFeatureRequest to fine tune the behavior if a single field or expression is not
35+
* enough to completely specify the required behavior.
36+
*
37+
* If expression compilation is activated in the settings and the expression can be
38+
* translated for the provider in question, it will be evaluated on provider side.
39+
* If one of these two premises does not apply, the ordering will take place locally
40+
* which results in increased memory and CPU usage.
41+
*
42+
* If the ordering is done on strings, the order depends on the system's locale if the
43+
* local fallback implementation is used. The order depends on the server system's locale
44+
* and implementation if ordering is done on the server.
45+
*
46+
* In case the fallback code needs to be used, a limit set on the request will be respected
47+
* for the features returned by the iterator but internally all features will be requested
48+
* from the provider.
49+
*
50+
* @note added in QGIS 2.14
2951
*/
3052
class OrderByClause
3153
{
@@ -35,8 +57,8 @@ class QgsFeatureRequest
3557
*
3658
* @param expression The expression to use for ordering
3759
* @param ascending If the order should be ascending (1,2,3) or descending (3,2,1)
38-
* If thr order is ascending, by default nulls are last
39-
* If thr order is descending, by default nulls are first
60+
* If the order is ascending, by default nulls are last
61+
* If the order is descending, by default nulls are first
4062
*/
4163
OrderByClause( const QString &expression, bool ascending = true );
4264
/**
@@ -76,13 +98,29 @@ class QgsFeatureRequest
7698
*/
7799
void setNullsFirst( bool nullsFirst );
78100

101+
/**
102+
* Dumps the content to an SQL equivalent
103+
*/
104+
QString dump() const;
79105
};
80106

107+
/**
108+
* Represents a list of OrderByClauses, with the most important first and the least
109+
* important last.
110+
*
111+
* @note added in QGIS 2.14
112+
*/
81113
class OrderBy
82114
{
83115
public:
116+
/**
117+
* Create a new empty order by
118+
*/
84119
OrderBy();
85120

121+
/**
122+
* Create a new order by from a list of clauses
123+
*/
86124
OrderBy( const QList<QgsFeatureRequest::OrderByClause>& other );
87125

88126
/**
@@ -127,20 +165,36 @@ class QgsFeatureRequest
127165
explicit QgsFeatureRequest( const QgsRectangle& rect );
128166
//! construct a request with a filter expression
129167
explicit QgsFeatureRequest( const QgsExpression& expr, const QgsExpressionContext& context = QgsExpressionContext() );
168+
//! copy constructor
169+
QgsFeatureRequest( const QgsFeatureRequest& rh );
170+
171+
~QgsFeatureRequest();
130172

173+
/**
174+
* Return the filter type which is currently set on this request
175+
*
176+
* @return Filter type
177+
*/
131178
FilterType filterType() const;
132179

133-
//! Set rectangle from which features will be taken. Empty rectangle removes the filter.
134-
//!
180+
/**
181+
* Set rectangle from which features will be taken. Empty rectangle removes the filter.
182+
*/
135183
QgsFeatureRequest& setFilterRect( const QgsRectangle& rect );
184+
185+
/**
186+
* Get the rectangle from which features will be taken.
187+
*/
136188
const QgsRectangle& filterRect() const;
137189

138190
//! Set feature ID that should be fetched.
139191
QgsFeatureRequest& setFilterFid( qint64 fid );
192+
//! Get the feature ID that should be fetched.
140193
qint64 filterFid() const;
141194

142-
//! Set feature ID that should be fetched.
195+
//! Set feature IDs that should be fetched.
143196
QgsFeatureRequest& setFilterFids( const QgsFeatureIds& fids );
197+
//! Get feature IDs that should be fetched.
144198
const QgsFeatureIds& filterFids() const;
145199

146200
/** Set the filter expression. {@see QgsExpression}
@@ -166,12 +220,14 @@ class QgsFeatureRequest
166220
/** Returns the expression context used to evaluate filter expressions.
167221
* @note added in QGIS 2.12
168222
* @see setExpressionContext
223+
* @see filterExpression
169224
*/
170225
QgsExpressionContext* expressionContext();
171226

172227
/** Sets the expression context used to evaluate filter expressions.
173228
* @note added in QGIS 2.12
174229
* @see expressionContext
230+
* @see setFilterExpression
175231
*/
176232
QgsFeatureRequest& setExpressionContext( const QgsExpressionContext& context );
177233

@@ -186,14 +242,14 @@ class QgsFeatureRequest
186242
QgsFeatureRequest& disableFilter();
187243

188244
/**
189-
* Adds a new OrderByClause
245+
* Adds a new OrderByClause, appending it as the least important one.
190246
*
191247
* @param expression The expression to use for ordering
192248
* @param ascending If the order should be ascending (1,2,3) or descending (3,2,1)
193249
* If the order is ascending, by default nulls are last
194250
* If the order is descending, by default nulls are first
195251
*
196-
* @added in QGIS 2.14
252+
* @note added in QGIS 2.14
197253
*/
198254

199255
QgsFeatureRequest& addOrderBy( const QString &expression, bool ascending = true );
@@ -204,19 +260,23 @@ class QgsFeatureRequest
204260
* @param ascending If the order should be ascending (1,2,3) or descending (3,2,1)
205261
* @param nullsfirst If true, NULLS are at the beginning, if false, NULLS are at the end
206262
*
207-
* @added in QGIS 2.14
263+
* @note added in QGIS 2.14
208264
*/
209265
QgsFeatureRequest& addOrderBy( const QString &expression, bool ascending, bool nullsfirst );
210266

211267
/**
212268
* Return a list of order by clauses specified for this feature request.
269+
*
270+
* @note added in 2.14
213271
*/
214272
QgsFeatureRequest::OrderBy orderBy() const;
215273

216274
/**
217275
* Set a list of order by clauses.
276+
*
277+
* @note added in 2.14
218278
*/
219-
QgsFeatureRequest& setOrderBy(const QgsFeatureRequest::OrderBy& orderBy );
279+
QgsFeatureRequest& setOrderBy( const QgsFeatureRequest::OrderBy& orderBy );
220280

221281
/** Set the maximum number of features to request.
222282
* @param limit maximum number of features, or -1 to request all features.
@@ -238,6 +298,10 @@ class QgsFeatureRequest
238298
//! Set a subset of attributes that will be fetched. Empty list means that all attributes are used.
239299
//! To disable fetching attributes, reset the FetchAttributes flag (which is set by default)
240300
QgsFeatureRequest& setSubsetOfAttributes( const QgsAttributeList& attrs );
301+
/**
302+
* Return the subset of attributes which at least need to be fetched
303+
* @return A list of attributes to be fetched
304+
*/
241305
const QgsAttributeList& subsetOfAttributes() const;
242306

243307
//! Set a subset of attributes by names that will be fetched
@@ -275,6 +339,11 @@ class QgsAbstractFeatureSource
275339
public:
276340
virtual ~QgsAbstractFeatureSource();
277341

342+
/**
343+
* Get an iterator for features matching the specified request
344+
* @param request The request
345+
* @return A feature iterator
346+
*/
278347
virtual QgsFeatureIterator getFeatures( const QgsFeatureRequest& request ) = 0;
279348

280349
protected:

src/analysis/CMakeLists.txt

+11-1
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,20 @@ ADD_FLEX_FILES_PREFIX(QGIS_ANALYSIS_SRCS raster raster/qgsrastercalclexer.ll)
6262

6363
ADD_BISON_FILES_PREFIX(QGIS_ANALYSIS_SRCS raster raster/qgsrastercalcparser.yy)
6464

65-
SET_SOURCE_FILES_PROPERTIES(
65+
IF(NOT MSVC)
66+
SET_SOURCE_FILES_PROPERTIES(
6667
${CMAKE_BINARY_DIR}/src/analysis/qgsrastercalcparser.cpp
6768
PROPERTIES COMPILE_FLAGS "-w"
6869
)
70+
ELSE(NOT MSVC)
71+
IF(PEDANTIC)
72+
# 4702 unreachable code
73+
SET_SOURCE_FILES_PROPERTIES(
74+
${CMAKE_BINARY_DIR}/src/analysis/qgsrastercalcparser.cpp
75+
PROPERTIES COMPILE_FLAGS "-wd4702"
76+
)
77+
ENDIF(PEDANTIC)
78+
ENDIF(NOT MSVC)
6979

7080
IF (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
7181
SET_SOURCE_FILES_PROPERTIES(

src/app/qgsstatusbarcoordinateswidget.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ void QgsStatusBarCoordinatesWidget::validateCoordinates()
140140

141141
bool xOk = false;
142142
bool yOk = false;
143-
double x, y;
143+
double x = 0., y = 0.;
144144
QString coordText = mLineEdit->text();
145145
coordText.replace( QRegExp( " {2,}" ), " " );
146146

src/app/qgsvectorlayerproperties.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -1052,6 +1052,7 @@ void QgsVectorLayerProperties::showListOfStylesFromDatabase()
10521052
QMessageBox::warning( this, tr( "Error occured retrieving styles from database" ), errorMsg );
10531053
return;
10541054
}
1055+
Q_NOWARN_DEPRECATED_PUSH
10551056
if ( layer->applyNamedStyle( qmlStyle, errorMsg ) )
10561057
{
10571058
syncToLayer();
@@ -1062,7 +1063,7 @@ void QgsVectorLayerProperties::showListOfStylesFromDatabase()
10621063
tr( "The retrieved style is not a valid named style. Error message: %1" )
10631064
.arg( errorMsg ) );
10641065
}
1065-
1066+
Q_NOWARN_DEPRECATED_POP
10661067
}
10671068
}
10681069

src/astyle/CMakeLists.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
SET(ASTYLE_SRCS astyle_main.cpp ASBeautifier.cpp ASFormatter.cpp ASEnhancer.cpp ASResource.cpp)
22
# No warnings for astyle build
3-
SET_SOURCE_FILES_PROPERTIES( ${ASTYLE_SRCS} PROPERTIES COMPILE_FLAGS -w )
3+
IF(NOT MSVC)
4+
SET_SOURCE_FILES_PROPERTIES(${ASTYLE_SRCS} PROPERTIES COMPILE_FLAGS -w)
5+
ENDIF(NOT MSVC)
46
ADD_EXECUTABLE(qgisstyle ${ASTYLE_SRCS})
57
SET_TARGET_PROPERTIES(qgisstyle PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/scripts)

src/core/CMakeLists.txt

+6-2
Original file line numberDiff line numberDiff line change
@@ -403,10 +403,14 @@ IF (QT_MOBILITY_LOCATION_FOUND OR Qt5Positioning_FOUND)
403403
ENDIF (QT_MOBILITY_LOCATION_FOUND OR Qt5Positioning_FOUND)
404404

405405
ADD_FLEX_FILES(QGIS_CORE_SRCS qgsexpressionlexer.ll)
406-
407406
ADD_BISON_FILES(QGIS_CORE_SRCS qgsexpressionparser.yy)
408407

409-
SET_SOURCE_FILES_PROPERTIES( qgsexpressionparser.cpp PROPERTIES COMPILE_FLAGS -w )
408+
IF(NOT MSVC)
409+
SET_SOURCE_FILES_PROPERTIES(qgsexpressionparser.cpp PROPERTIES COMPILE_FLAGS -w)
410+
ELSE(NOT MSVC)
411+
# -wd4702 unreachable code
412+
SET_SOURCE_FILES_PROPERTIES(geometry/qgsgeos.cpp PROPERTIES COMPILE_FLAGS -wd4702)
413+
ENDIF(NOT MSVC)
410414

411415
SET(QGIS_CORE_MOC_HDRS
412416
qgsapplication.h

src/core/qgsexpression.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -4478,4 +4478,7 @@ QVariant QgsExpression::StaticFunction::func( const QVariantList &values, const
44784478
Q_NOWARN_DEPRECATED_POP
44794479
}
44804480

4481-
const QgsExpression::Node* QgsExpression::rootNode() const { return d->mRootNode; }
4481+
const QgsExpression::Node* QgsExpression::rootNode() const
4482+
{
4483+
return d->mRootNode;
4484+
}

src/core/qgsfeatureiterator.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ inline bool QgsFeatureIterator::isClosed() const
262262

263263
inline bool operator== ( const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2 )
264264
{
265-
return ( fi1.mIter == fi2.mIter );
265+
return fi1.mIter == fi2.mIter;
266266
}
267267

268268
inline bool operator!= ( const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2 )

src/core/qgsfeaturerequest.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,8 @@ QSet<QString> QgsFeatureRequest::OrderBy::usedAttributes() const
381381

382382
return usedAttributes;
383383
}
384-
QString QgsFeatureRequest::OrderBy::dump() const
384+
385+
QString QgsFeatureRequest::OrderBy::dump( void ) const
385386
{
386387
QStringList results;
387388

src/core/qgsfeaturerequest.h

+10-8
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@
1616
#define QGSFEATUREREQUEST_H
1717

1818
#include <QFlags>
19+
#include <QList>
1920

2021
#include "qgsfeature.h"
2122
#include "qgsrectangle.h"
2223
#include "qgsexpression.h"
2324
#include "qgsexpressioncontext.h"
2425
#include "qgssimplifymethod.h"
2526

26-
#include <QList>
2727
typedef QList<int> QgsAttributeList;
2828

2929
/**
@@ -160,6 +160,8 @@ class CORE_EXPORT QgsFeatureRequest
160160
*/
161161
QString dump() const;
162162

163+
// friend inline int qHash(const OrderByClause &a) { return qHash(a.mExpression.expression()) ^ qHash(a.mAscending) ^ qHash( a.mNullsFirst); }
164+
163165
private:
164166
QgsExpression mExpression;
165167
bool mAscending;
@@ -178,42 +180,42 @@ class CORE_EXPORT QgsFeatureRequest
178180
/**
179181
* Create a new empty order by
180182
*/
181-
OrderBy()
183+
CORE_EXPORT OrderBy()
182184
: QList<OrderByClause>()
183185
{}
184186

185187
/**
186188
* Create a new order by from a list of clauses
187189
*/
188-
OrderBy( const QList<OrderByClause>& other );
190+
CORE_EXPORT OrderBy( const QList<OrderByClause>& other );
189191

190192
/**
191193
* Get a copy as a list of OrderByClauses
192194
*
193195
* This is only required in python where the inheritance
194196
* is not properly propagated and this makes it usable.
195197
*/
196-
QList<OrderByClause> list() const;
198+
QList<OrderByClause> CORE_EXPORT list() const;
197199

198200
/**
199201
* Serialize to XML
200202
*/
201-
void save( QDomElement& elem ) const;
203+
void CORE_EXPORT save( QDomElement& elem ) const;
202204

203205
/**
204206
* Deserialize from XML
205207
*/
206-
void load( const QDomElement& elem );
208+
void CORE_EXPORT load( const QDomElement& elem );
207209

208210
/**
209211
* Returns a set of used attributes
210212
*/
211-
QSet<QString> usedAttributes() const;
213+
QSet<QString> CORE_EXPORT usedAttributes() const;
212214

213215
/**
214216
* Dumps the content to an SQL equivalent syntax
215217
*/
216-
QString dump() const;
218+
QString CORE_EXPORT dump() const;
217219
};
218220

219221
/**

src/core/qgsvectorlayer.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -3878,7 +3878,9 @@ QString QgsVectorLayer::loadNamedStyle( const QString &theURI, bool &theResultFl
38783878
qml = loadStyleExternalMethod( mDataSource, errorMsg );
38793879
if ( !qml.isEmpty() )
38803880
{
3881+
Q_NOWARN_DEPRECATED_PUSH
38813882
theResultFlag = applyNamedStyle( qml, errorMsg );
3883+
Q_NOWARN_DEPRECATED_POP
38823884
return QObject::tr( "Loaded from Provider" );
38833885
}
38843886
}

0 commit comments

Comments
 (0)