16 #ifndef QGSPATHRESOLVER_H 
   17 #define QGSPATHRESOLVER_H 
   19 #include "qgis_core.h" 
   35     explicit QgsPathResolver( 
const QString &baseFileName = QString(), 
const QString &attachmentDir = QString() );
 
   42     QString writePath( 
const QString &filename ) 
const;
 
   45     QString readPath( 
const QString &filename ) 
const;
 
   67     static QString setPathPreprocessor( 
const std::function< QString( 
const QString &filename )> &processor );
 
  113     static QString setPathPreprocessor( SIP_PYCALLABLE / AllowNone / );
 
  116     Py_BEGIN_ALLOW_THREADS
 
  122       PyObject *s = sipCallMethod( NULL, a0, 
"D", &arg, sipType_QString, NULL );
 
  125       QString *t1 = 
reinterpret_cast<QString *
>( sipConvertToType( s, sipType_QString, 0, SIP_NOT_NONE, &state, &sipIsError ) );
 
  126       if ( sipIsError == 0 )
 
  128         res = QString( *t1 );
 
  130       sipReleaseType( t1, sipType_QString, state );
 
  135     s = sipConvertFromNewType( 
new QString( 
id ), sipType_QString, 0 );
 
  153     static bool removePathPreprocessor( 
const QString &
id );
 
  166     static void removePathPreprocessor( 
const QString &
id );
 
  170       PyErr_SetString( PyExc_KeyError, QStringLiteral( 
"No processor with id %1 exists." ).arg( *a0 ).toUtf8().constData() );
 
  197     static QString setPathWriter( 
const std::function< QString( 
const QString &filename )> &writer );
 
  223     static QString setPathWriter( SIP_PYCALLABLE / AllowNone / );
 
  226     Py_BEGIN_ALLOW_THREADS
 
  232       PyObject *s = sipCallMethod( NULL, a0, 
"D", &arg, sipType_QString, NULL );
 
  235       QString *t1 = 
reinterpret_cast<QString *
>( sipConvertToType( s, sipType_QString, 0, SIP_NOT_NONE, &state, &sipIsError ) );
 
  236       if ( sipIsError == 0 )
 
  238         res = QString( *t1 );
 
  240       sipReleaseType( t1, sipType_QString, state );
 
  245     s = sipConvertFromNewType( 
new QString( 
id ), sipType_QString, 0 );
 
  262     static bool removePathWriter( 
const QString &
id );
 
  274     static void removePathWriter( 
const QString &
id );
 
  278       PyErr_SetString( PyExc_KeyError, QStringLiteral( 
"No writer with id %1 exists." ).arg( *a0 ).toUtf8().constData() );
 
  286     QString mBaseFileName;
 
  288     QString mAttachmentDir;
 
Resolves relative paths into absolute paths and vice versa.
static bool removePathPreprocessor(const QString &id)
Removes the custom pre-processor function with matching id.
static QString setPathPreprocessor(const std::function< QString(const QString &filename)> &processor)
Sets a path pre-processor function, which allows for manipulation of paths and data sources prior to ...
static bool removePathWriter(const QString &id)
Removes the custom writer function with matching id.
static QString setPathWriter(const std::function< QString(const QString &filename)> &writer)
Sets a path writer function, which allows for manipulation of paths and data sources prior to writing...