• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

console/kabcclient

  • sources
  • kde-4.14
  • kdepim
  • console
  • kabcclient
  • src
formatfactory.cpp
Go to the documentation of this file.
1 //
2 // Copyright (C) 2005 - 2006 Kevin Krammer <kevin.krammer@gmx.at>
3 //
4 // This program is free software; you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation; either version 2 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 //
18 
19 // local includes
20 #include "formatfactory.h"
21 #include "csvtemplatefactory.h"
22 #include "inputformatimpls.h"
23 #include "outputformatimpls.h"
24 
26 
27 FormatFactory::FormatFactory() : m_csvtemplateFactory(0)
28 {
29  m_inputFormats.append("search");
30  m_inputFormats.append("uid");
31  m_inputFormats.append("vcard");
32  m_inputFormats.append("email");
33  m_inputFormats.append("name");
34  m_inputFormats.append("csv");
35  m_inputFormats.append("dialog");
36 
37  m_outputFormats.append("uid");
38  m_outputFormats.append("vcard");
39  m_outputFormats.append("email");
40  m_outputFormats.append("mutt");
41  m_outputFormats.append("csv");
42 }
43 
45 
46 FormatFactory::~FormatFactory()
47 {
48  delete m_csvtemplateFactory;
49 }
50 
52 
53 InputFormat* FormatFactory::inputFormat(const QByteArray& name)
54 {
55  if (!m_inputFormats.contains(name)) return 0;
56 
57  if (name == "search") return new SearchInput();
58 
59  if (name == "uid") return new UIDInput();
60 
61  if (name == "vcard") return new VCardInput();
62 
63  if (name == "email") return new EmailInput();
64 
65  if (name == "name") return new NameInput();
66 
67  if (name == "csv")
68  {
69  if (m_csvtemplateFactory == 0) m_csvtemplateFactory = new CSVTemplateFactory();
70 
71  return new CSVInput(m_csvtemplateFactory);
72  }
73 
74  if (name == "dialog") return new DialogInput();
75 
76  return 0;
77 }
78 
80 
81 OutputFormat* FormatFactory::outputFormat(const QByteArray& name)
82 {
83  if (!m_outputFormats.contains(name)) return 0;
84 
85  if (name == "uid") return new UIDOutput();
86 
87  if (name == "vcard") return new VCardOutput();
88 
89  if (name == "email") return new EmailOutput();
90 
91  if (name == "mutt") return new MuttOutput();
92 
93  if (name == "csv")
94  {
95  if (m_csvtemplateFactory == 0) m_csvtemplateFactory = new CSVTemplateFactory();
96 
97  return new CSVOutput(m_csvtemplateFactory);
98  }
99 
100  return 0;
101 }
102 
103 // End of file
DialogInput
Input selection through a GUI dialog.
Definition: inputformatimpls.h:297
inputformatimpls.h
FormatFactory::~FormatFactory
~FormatFactory()
Destroys the factory and its internal data.
Definition: formatfactory.cpp:46
QByteArray
InputFormat
Interface for input format parsers.
Definition: inputformat.h:51
NameInput
Input parser for people's names.
Definition: inputformatimpls.h:197
EmailInput
Input parser for email addresses.
Definition: inputformatimpls.h:130
EmailOutput
Output formatter for email addresses.
Definition: outputformatimpls.h:120
OutputFormat
Interface for output formatters.
Definition: outputformat.h:53
MuttOutput
Output formatter for use as input of the email client "mutt".
Definition: outputformatimpls.h:182
CSVOutput
Output formatter for CSV (comma separated values)
Definition: outputformatimpls.h:309
FormatFactory::inputFormat
InputFormat * inputFormat(const QByteArray &name)
Creates an InputFormat instance for the given name.
Definition: formatfactory.cpp:53
UIDOutput
Output formatter for KABC UIDs.
Definition: outputformatimpls.h:46
QList::append
void append(const T &value)
formatfactory.h
FormatFactory::outputFormat
OutputFormat * outputFormat(const QByteArray &name)
Creates an OutputFormat instance for the given name.
Definition: formatfactory.cpp:81
VCardOutput
Output formatter for VCard data.
Definition: outputformatimpls.h:80
csvtemplatefactory.h
QList::contains
bool contains(const T &value) const
CSVInput
Input parser for CSV (comma separated values)
Definition: inputformatimpls.h:233
UIDInput
Input parser for KABC UIDs.
Definition: inputformatimpls.h:46
FormatFactory::FormatFactory
FormatFactory()
Creates and initializes the factory.
Definition: formatfactory.cpp:27
SearchInput
Input parser for unspecified text queries.
Definition: inputformatimpls.h:165
outputformatimpls.h
CSVTemplateFactory
Factory for creation CSV template handlers.
Definition: csvtemplatefactory.h:44
VCardInput
Input parser for VCard data.
Definition: inputformatimpls.h:78
This file is part of the KDE documentation.
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.

console/kabcclient

Skip menu "console/kabcclient"
  • Main Page
  • Namespace List
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer
  • pimprint

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal