lokalize
#include <catalogfileplugin.h>
Public Member Functions | |
CatalogImportPlugin () | |
virtual | ~CatalogImportPlugin () |
virtual ConversionStatus | load (QIODevice *)=0 |
ConversionStatus | open (QIODevice *, GettextStorage *catalog, int *errorLine) |
Protected Member Functions | |
void | appendCatalogItem (const CatalogItem &item, const bool obsolete=false) |
void | commitTransaction () |
void | setCatalogExtraData (const QStringList &data) |
void | setCodec (QTextCodec *codec) |
void | setErrorIndex (const QList< int > &errors) |
void | setGeneratedFromDocbook (const bool fromDocbook) |
void | setHeader (const CatalogItem &header) |
void | startTransaction () |
Protected Attributes | |
int | _errorLine |
short | _maxLineLength |
short | _trailingNewLines |
Detailed Description
HISTORY: this was a base class for Catalog import plugins in KBabel, but this architecture isn't not suitable for XML-based files (when whole DOM-tree is stored in memory to prevent file clashes)
This class is the base for import plugins for catalogs. It provides "transactional behavior", so the changes are stored in catalog only if the import process finishes successfully.
To use it, just subclass and redefine load() and id() methods. When importing, you can use the protected methods for setting the catalog. New catalog items can be added using appendCatalogItem.
Base class for GettextCatalog import plugins
Definition at line 85 of file catalogfileplugin.h.
Constructor & Destructor Documentation
GettextCatalog::CatalogImportPlugin::CatalogImportPlugin | ( | ) |
Definition at line 51 of file importplugin.cpp.
|
virtual |
Definition at line 57 of file importplugin.cpp.
Member Function Documentation
|
protected |
Append a new catalog item, either as normal or as an obsolete one.
- Parameters
-
item the new item obsolete flag that the item is obsolete
Definition at line 62 of file importplugin.cpp.
|
protected |
commit the data in the current transaction.
You should never call this method.
Definition at line 125 of file importplugin.cpp.
|
pure virtual |
Reimplement this method to load the local file passed as an argument.
Throughout the run, you can use the protected methods for setting the contents of the resulting catalog. This method must call
- See also
- setMimeTypes to setup correct MIME types for the loaded file. Also, it should use
- isStopped to abort loading and the signals for providing user feedback.
- Parameters
-
file file to be loaded mimetype the expected MIME type (the type used for plugin selection
Implemented in GettextCatalog::GettextImportPlugin.
ConversionStatus GettextCatalog::CatalogImportPlugin::open | ( | QIODevice * | device, |
GettextStorage * | catalog, | ||
int * | errorLine | ||
) |
Load the file and fill the corresponding catalog.
The file is considered to be of mimetype MIME type.
- Parameters
-
file local file name to be opened mimetype the MIME type is should be handled as catalog the catalog to be filled
- Returns
- result of the operation
Definition at line 101 of file importplugin.cpp.
|
protected |
set extra data for the catalog, which can't be stored in CatalogItem.
The format can be arbitrary
Definition at line 72 of file importplugin.cpp.
|
protected |
Set the character encoding used in the catalog file.
Definition at line 96 of file importplugin.cpp.
|
protected |
set the list of parse error indexes
Definition at line 84 of file importplugin.cpp.
|
protected |
set flag that the file is generated from DocBook
Definition at line 78 of file importplugin.cpp.
|
protected |
set the header catalog item
Definition at line 90 of file importplugin.cpp.
|
protected |
start a new transaction.
You should never call this method.
Definition at line 115 of file importplugin.cpp.
Member Data Documentation
|
protected |
Definition at line 142 of file catalogfileplugin.h.
|
protected |
Definition at line 140 of file catalogfileplugin.h.
|
protected |
Definition at line 141 of file catalogfileplugin.h.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:40:07 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.