Skip to content
Permalink
Browse files

OGR provider: moved QgsCPLErrorHandler to its own header file

This is being reused in gpkg data items
  • Loading branch information
elpaso committed Aug 22, 2017
1 parent ab2589b commit 13c9e1de0181346359f9034a103f595ea769f42c
Showing with 49 additions and 25 deletions.
  1. +48 −0 src/providers/ogr/qgscplerrorhandler.h
  2. +1 −25 src/providers/ogr/qgsogrprovider.cpp
@@ -0,0 +1,48 @@
/***************************************************************************
qgscplerrorhandler.h - QgsCplErrorHandler
---------------------
begin : Oct 29, 2003
copyright : (C) 2003 by Gary E.Sherman
email : sherman at mrcc.com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSCPLERRORHANDLER_H
#define QGSCPLERRORHANDLER_H

#include "gdal.h"
#include "qgsmessagelog.h"

class QgsCPLErrorHandler
{
static void CPL_STDCALL showError( CPLErr errClass, int errNo, const char *msg )
{
if ( errNo != OGRERR_NONE )
QgsMessageLog::logMessage( QObject::tr( "OGR[%1] error %2: %3" ).arg( errClass ).arg( errNo ).arg( msg ), QObject::tr( "OGR" ) );
}

public:
QgsCPLErrorHandler()
{
CPLPushErrorHandler( showError );
}

~QgsCPLErrorHandler()
{
CPLPopErrorHandler();
}

private:
QgsCPLErrorHandler( const QgsCPLErrorHandler &other );
QgsCPLErrorHandler &operator=( const QgsCPLErrorHandler &other );

};


#endif // QGSCPLERRORHANDLER_H
@@ -16,6 +16,7 @@ email : sherman at mrcc.com
***************************************************************************/

#include "qgsogrprovider.h"
#include "qgscplerrorhandler.h"
#include "qgsogrfeatureiterator.h"
#include "qgslogger.h"
#include "qgsmessagelog.h"
@@ -80,31 +81,6 @@ static const QString TEXT_PROVIDER_DESCRIPTION =
static OGRwkbGeometryType ogrWkbGeometryTypeFromName( const QString &typeName );
class QgsCPLErrorHandler
{
static void CPL_STDCALL showError( CPLErr errClass, int errNo, const char *msg )
{
if ( errNo != OGRERR_NONE )
QgsMessageLog::logMessage( QObject::tr( "OGR[%1] error %2: %3" ).arg( errClass ).arg( errNo ).arg( msg ), QObject::tr( "OGR" ) );
}
public:
QgsCPLErrorHandler()
{
CPLPushErrorHandler( showError );
}
~QgsCPLErrorHandler()
{
CPLPopErrorHandler();
}
private:
QgsCPLErrorHandler( const QgsCPLErrorHandler &other );
QgsCPLErrorHandler &operator=( const QgsCPLErrorHandler &other );
};
bool QgsOgrProvider::convertField( QgsField &field, const QTextCodec &encoding )
{

0 comments on commit 13c9e1d

Please sign in to comment.
You can’t perform that action at this time.