handle min()/max() macros offending std::numeric_limits<T>::min()/max() on MSVC in one spot

This commit is contained in:
Juergen E. Fischer 2012-08-18 19:43:53 +02:00
parent a38ce7369e
commit 24603eafd8
5 changed files with 8 additions and 29 deletions

View File

@ -289,6 +289,8 @@ ENDIF (CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES RelWithDebInfo
IF(MSVC)
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DQGISDEBUG=1")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DQGISDEBUG=1")
# disable macros that offend std::numeric_limits<T>::min()/max()
ADD_DEFINITIONS(-DNOMINMAX)
ENDIF(MSVC)
#############################################################

View File

@ -39,13 +39,6 @@ INCLUDE_DIRECTORIES(
${CMAKE_BINARY_DIR} # qgsconfig.h, qgsversion.h
)
# In Windef.h there are min() and max() macros that interfere with the usage
# of std::numeric_limits<T>::min() and :max() in qgsrasterbands.h.
IF(MSVC)
ADD_DEFINITIONS(-DNOMINMAX)
ENDIF(MSVC)
IF(PYQT4_VERSION_NUM LESS 263680) # 0x040600
SET(SIP_DISABLE_FEATURES ${SIP_DISABLE_FEATURES} PROXY_FACTORY)
ENDIF(PYQT4_VERSION_NUM LESS 263680)

View File

@ -707,7 +707,7 @@ void QgsAttributeTableDialog::on_mAddAttribute_clicked()
mLayer->destroyEditCommand();
}
// update model - a field has been added or updated
mModel->reload( mModel->index( 0, 0 ), mModel->index( mModel->rowCount() - 1, mModel->columnCount() - 1 ) );\
mModel->reload( mModel->index( 0, 0 ), mModel->index( mModel->rowCount() - 1, mModel->columnCount() - 1 ) );
columnBoxInit();
}
}

View File

@ -22,15 +22,6 @@
#include <QList>
#include <QPair>
#ifdef _MSC_VER
// qextserialport.h includes windows.h,
// which defines min()/max() macros w/o NOMINMAX,
// which in turn breaks limits std::numeric_limits<T>::min()/max()
#ifndef NOMINMAX
#define NOMINMAX
#endif
#endif
#include "qextserialport.h"
class QgsGPSConnection;

View File

@ -82,14 +82,6 @@ email : tim at linfiniti.com
typedef void buildsupportedrasterfilefilter_t( QString & theFileFiltersString );
typedef bool isvalidrasterfilename_t( QString const & theFileNameQString, QString & retErrMsg );
// workaround for MSVC compiler which already has defined macro max
// that interferes with calling std::numeric_limits<int>::max
#ifdef _MSC_VER
# ifdef max
# undef max
# endif
#endif
// Comparison value for equality; i.e., we shouldn't directly compare two
// floats so it's better to take their difference and see if they're within
// a certain range -- in this case twenty times the smallest value that
@ -339,6 +331,7 @@ int QgsRasterLayer::bandNumber( QString const & theBandName ) const
return 0; //no band was found
}
#if 0
/**
* Private method to calculate statistics for a band. Populates rasterStatsMemArray.
* Calculates:
@ -358,7 +351,6 @@ int QgsRasterLayer::bandNumber( QString const & theBandName ) const
* @sa RasterBandStats
* @note This is a cpu intensive and slow task!
*/
/*
const QgsRasterBandStats QgsRasterLayer::bandStatistics( int theBandNo )
{
QgsDebugMsg( "theBandNo = " + QString::number( theBandNo ) );
@ -431,7 +423,7 @@ const QgsRasterBandStats QgsRasterLayer::bandStatistics( QString const & theBand
return QgsRasterBandStats(); // return a null one
}
*/
#endif
QString QgsRasterLayer::buildPyramids( RasterPyramidList const & theRasterPyramidList,
QString const & theResamplingMethod, bool theTryInternalFlag )
@ -2234,8 +2226,8 @@ void QgsRasterLayer::setRenderer( QgsRasterRenderer* theRenderer )
mPipe.set( theRenderer );
}
#if 0
// not sure if we want it
/*
void QgsRasterLayer::setResampleFilter( QgsRasterResampleFilter* resampleFilter )
{
QgsDebugMsg( "Entered" );
@ -2246,7 +2238,8 @@ void QgsRasterLayer::setResampleFilter( QgsRasterResampleFilter* resampleFilter
QgsDebugMsg( "Cannot set resample filter." );
}
}
*/
#endif
void QgsRasterLayer::showProgress( int theValue )
{
emit progressUpdate( theValue );