23QString QgsShapefileEncodingInfoAlgorithm::name()
 const 
   25  return QStringLiteral( 
"shpencodinginfo" );
 
   28QString QgsShapefileEncodingInfoAlgorithm::displayName()
 const 
   30  return QObject::tr( 
"Extract Shapefile encoding" );
 
   33QStringList QgsShapefileEncodingInfoAlgorithm::tags()
 const 
   35  return QObject::tr( 
"shp,codepage,cpg,ldid,information,list,show" ).split( 
',' );
 
   38QString QgsShapefileEncodingInfoAlgorithm::group()
 const 
   40  return QObject::tr( 
"Vector general" );
 
   43QString QgsShapefileEncodingInfoAlgorithm::groupId()
 const 
   45  return QStringLiteral( 
"vectorgeneral" );
 
   48QString QgsShapefileEncodingInfoAlgorithm::shortHelpString()
 const 
   50  return QObject::tr( 
"This algorithm extracts the attribute encoding information embedded in a Shapefile.\n\n" 
   51                      "Both the encoding specified by an optional .cpg file and any encoding details present in the " 
   52                      ".dbf LDID header block are considered." );
 
   55QString QgsShapefileEncodingInfoAlgorithm::shortDescription()
 const 
   57  return QObject::tr( 
"Extracts the attribute encoding information embedded in a Shapefile." );
 
   60QgsShapefileEncodingInfoAlgorithm *QgsShapefileEncodingInfoAlgorithm::createInstance()
 const 
   62  return new QgsShapefileEncodingInfoAlgorithm();
 
   65void QgsShapefileEncodingInfoAlgorithm::initAlgorithm( 
const QVariantMap & )
 
   68                QString(), QVariant(), 
false, QObject::tr( 
"Shapefiles (%1)" ).arg( QLatin1String( 
"*.shp *.SHP" ) ) ) );
 
   77  const QString path = parameterAsFile( parameters, QStringLiteral( 
"INPUT" ), context );
 
   80  if ( mCpgEncoding.isEmpty() )
 
   81    feedback->
pushInfo( QObject::tr( 
"No encoding information present in CPG file" ) );
 
   83    feedback->
pushInfo( QObject::tr( 
"Detected encoding from CPG file: %1" ).arg( mCpgEncoding ) );
 
   86  if ( mLdidEncoding.isEmpty() )
 
   87    feedback->
pushInfo( QObject::tr( 
"No encoding information present in DBF LDID header" ) );
 
   89    feedback->
pushInfo( QObject::tr( 
"Detected encoding from DBF LDID header: %1" ).arg( mLdidEncoding ) );
 
   98  outputs.insert( QStringLiteral( 
"ENCODING" ), mCpgEncoding.isEmpty() ? mLdidEncoding : mCpgEncoding );
 
   99  outputs.insert( QStringLiteral( 
"CPG_ENCODING" ), mCpgEncoding );
 
  100  outputs.insert( QStringLiteral( 
"LDID_ENCODING" ), mLdidEncoding );
 
static QString readShapefileEncodingFromCpg(const QString &path)
Reads the encoding of the shapefile at the specified path (where path is the location of the "....
 
static QString readShapefileEncodingFromLdid(const QString &path)
Reads the encoding of the shapefile at the specified path (where path is the location of the "....
 
Contains information about the context in which a processing algorithm is executed.
 
Base class for providing feedback from a processing algorithm.
 
virtual void pushInfo(const QString &info)
Pushes a general informational message from the algorithm.
 
A string output for processing algorithms.
 
An input file or folder parameter for processing algorithms.
 
@ File
Parameter is a single file.