24QString QgsShapefileEncodingInfoAlgorithm::name()
const
26 return QStringLiteral(
"shpencodinginfo" );
29QString QgsShapefileEncodingInfoAlgorithm::displayName()
const
31 return QObject::tr(
"Extract Shapefile encoding" );
34QStringList QgsShapefileEncodingInfoAlgorithm::tags()
const
36 return QObject::tr(
"shp,codepage,cpg,ldid,information,list,show" ).split(
',' );
39QString QgsShapefileEncodingInfoAlgorithm::group()
const
41 return QObject::tr(
"Vector general" );
44QString QgsShapefileEncodingInfoAlgorithm::groupId()
const
46 return QStringLiteral(
"vectorgeneral" );
49QString QgsShapefileEncodingInfoAlgorithm::shortHelpString()
const
51 return QObject::tr(
"This algorithm extracts the attribute encoding information embedded in a Shapefile.\n\n"
52 "Both the encoding specified by an optional .cpg file and any encoding details present in the "
53 ".dbf LDID header block are considered." );
56QString QgsShapefileEncodingInfoAlgorithm::shortDescription()
const
58 return QObject::tr(
"Extracts the attribute encoding information embedded in a Shapefile." );
61QgsShapefileEncodingInfoAlgorithm *QgsShapefileEncodingInfoAlgorithm::createInstance()
const
63 return new QgsShapefileEncodingInfoAlgorithm();
66void QgsShapefileEncodingInfoAlgorithm::initAlgorithm(
const QVariantMap & )
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 );
@ File
Parameter is a single file.
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.