console/kabcclient
#include <csvtemplatefactory.h>
Public Member Functions | |
CSVTemplateFactory () | |
~CSVTemplateFactory () | |
CSVTemplate * | createCachedTemplate (const QString &name) |
CSVTemplate * | createTemplate (const QString &name) |
QMap< QString, QString > | templateNames () |
Detailed Description
Factory for creation CSV template handlers.
KAddressBook supports configurable CSV (comma separated values) input/output through so-called "templates", i.e. KDE style (INI style) config files, which describe how columns of the CSV input are to be mapped from/to contact fields. See Handling of CSV (comma separated values) input/output for details.
This class is used by the CSVInput parser and CSVOutput formatter to create and configure a template handler based on the name specified by the user.
- See also
- CSVTemplate
Definition at line 44 of file csvtemplatefactory.h.
Constructor & Destructor Documentation
CSVTemplateFactory::CSVTemplateFactory | ( | ) |
Creates the factory instance.
Definition at line 36 of file csvtemplatefactory.cpp.
CSVTemplateFactory::~CSVTemplateFactory | ( | ) |
Destroys the instance.
Autodeletes the cached template instances created by createCachedTemplate()
Definition at line 42 of file csvtemplatefactory.cpp.
Member Function Documentation
CSVTemplate * CSVTemplateFactory::createCachedTemplate | ( | const QString & | name | ) |
Creates a template handler for a given name and caches the instance.
Basically equal to createTemplate(), but only creates an instance on the first call for each name, i.e. keeps one instance per name.
- Warning
- Cached instances are owned by the factory and will be deleted on its destruction
- Parameters
-
name the name of the CSV template to create a handler for
- Returns
- a CSV handler instance or
0
if thename
was empty or there is no template with such a name
- See also
- templateNames()
- findTemplateFile()
Definition at line 74 of file csvtemplatefactory.cpp.
CSVTemplate * CSVTemplateFactory::createTemplate | ( | const QString & | name | ) |
Creates a template handler for a given name.
The template's name is the basic file name (without the .desktop extension) of the template configuration file. It is the key of the respective entry in the map returned by templateNames()
- Note
- The caller becomes the owner of the returned instance
- Parameters
-
name the name of the CSV template to create a handler for
- Returns
- a CSV handler instance or
0
if thename
was empty or there is no template with such a name
- See also
- createCachedTemplate()
- findTemplateFile()
Definition at line 55 of file csvtemplatefactory.cpp.
Returns a set of available templates.
On the first call this method will check the current working directory and all of KAddressBook's data directories, as returned by KStandardDirs::findDirs(), for template configuration files.
The resulting map's keys are the identifiers used to create template handlers through createTemplate() or createCachedTemplate().
The map's values are the potentially localized name specified in the template configuration file itself.
- Note
- Only queries the filesystem on the first call and later on just returns the cached information of this first call
- Returns
- map of template identifiers to templates' UI names
Definition at line 96 of file csvtemplatefactory.cpp.
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:31:23 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.