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

console/kabcclient

CSVInput Class Reference

#include <inputformatimpls.h>

Inheritance diagram for CSVInput:

Inheritance graph
[legend]

List of all members.


Detailed Description

Input parser for CSV (comma separated values).

Treats each line as a record composed columns, where a column is separated from the next column by a separator string, often a comma.

The actual parsing (splitting, unquoting, etc) is delegated to a CSVTemplate instance, fetched through CSVTemplateFactory based on a mandatory name parameter. See Handling of CSV (comma separated values) input/output

Available through FormatFactory::inputFormat(), name "csv"

Author:
Kevin Krammer, <kevin.krammer@gmx.at>
See also:
Handling of various input and output formats

Definition at line 233 of file inputformatimpls.h.


Public Member Functions

 CSVInput (CSVTemplateFactory *templateFactory)
virtual QString description () const
virtual QString optionUsage () const
virtual KABC::Addressee readAddressee (std::istream &stream)
virtual bool setCodec (QTextCodec *codec)
virtual bool setOptions (const QByteArray &options)

Constructor & Destructor Documentation

CSVInput::CSVInput ( CSVTemplateFactory *  templateFactory  ) 

Definition at line 372 of file inputformatimpls.cpp.


Member Function Documentation

QString CSVInput::description (  )  const [virtual]

Returns a translate description of the input format.

Returns a translated description of the parser and its general capabilities.

Returns:
a short descriptive string what kind of input format it can handle
Note:
Implementations should not include the optional settings a parser understands, this is what optionUsage() is for. As the description is displayed after the format name, it is recommended to add two tabs after each newline for aligned output

Implements InputFormat.

Definition at line 379 of file inputformatimpls.cpp.

QString CSVInput::optionUsage (  )  const [virtual]

Returns a translate message about the available format options.

The option description string contains each option and its respective description for displaying to the user.

Returns:
a short description of each option or QString() if the input format does not allow configuration options
Note:
Implementations can return any formatting in the string, but it is recommended to stay consistent with the other format implementations and return the following format: one line per option and each line formatted like this
 option-name tabs option-description
where tabs is either one or two tab characters depending on the length of the option-name, e.g. two tabs for length < 8 Default implementation returns QString()

Reimplemented from InputFormat.

Definition at line 398 of file inputformatimpls.cpp.

KABC::Addressee CSVInput::readAddressee ( std::istream &  stream  )  [virtual]

Reads one addressee from the input stream.

Creates a single KABC::Addressee object from the data available in the given input stream according to the parsers formatting rules.

Parameters:
stream the standard input stream to read text from
Returns:
a KABC::Addressee object containing the read data
See also:
KABC::Addressee

setCodec()

std::ios_base

Note:
This method is called until the stream is either at its end or gone bad, so if an implementation has more than one addressee to return it has to make sure neither of this conditions is met. If the data available in the stream is not sufficient to create an addressee according to the implementations format rules, it should return an empty object, i.e. the one creates by the Addressee class' default constructor.

Implements InputFormat.

Definition at line 439 of file inputformatimpls.cpp.

bool CSVInput::setCodec ( QTextCodec *  codec  )  [virtual]

Sets the text codec to use.

This allows to have the text read from the input stream interpreted according to a specific text encoding. Depending on the format's specifications not all technically available codecs might be valid

Warning:
Always set a codec, the input formats need it!
Parameters:
codec the text encoding handler to use
Returns:
true if the input format accepts this codec. i.e. can work with it reasonably. Otherwise returns false

Implements InputFormat.

Definition at line 428 of file inputformatimpls.cpp.

bool CSVInput::setOptions ( const QByteArray &  options  )  [virtual]

Configures the input format.

Sets parser options, i.e. format specific settings that change how the input format treats the input text.

Parameters:
options a string as taken from the commandline
Returns:
false if the options are not valid or if the input format doesn't support options. true if the options where valid
Note:
Implementations can use any format in their options string. However it is recommended to stay consistent with the other format implementations and use a comma separated list

Implements InputFormat.

Definition at line 386 of file inputformatimpls.cpp.


The documentation for this class was generated from the following files:
  • inputformatimpls.h
  • inputformatimpls.cpp

console/kabcclient

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

kdepim

Skip menu "kdepim"
  • akonadi
  •   clients
  •   kabc
  •   kcal
  •   kcm
  • akregator
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt
  • kdgantt1
  • kjots
  • kleopatra
  • kmail
  • kmobiletools
  • knode
  • knotes
  • kontact
  • kontactinterfaces
  • korganizer
  •   korgac
  • kpilot
  • ktimetracker
  • libkdepim
  • libkholidays
  • libkleo
  • libkpgp
  • maildir
Generated for kdepim by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal