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

lokalize

  • sources
  • kde-4.14
  • kdesdk
  • lokalize
  • src
  • catalog
  • gettext
gettextimport.h
Go to the documentation of this file.
1 /* ****************************************************************************
2  This file is part of Lokalize
3  This file is based on the one from KBabel
4 
5  Copyright; 2007-2009 by Nick Shaforostoff <shafff@ukr.net>
6 
7 
8  This program is free software; you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation; either version 2 of the License, or
11  (at your option) any later version.
12 
13  This program is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with this program; if not, write to the Free Software
20  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 
22  In addition, as a special exception, the copyright holders give
23  permission to link the code of this program with any edition of
24  the Qt library by Trolltech AS, Norway (or with modified versions
25  of Qt that use the same license as Qt), and distribute linked
26  combinations including the two. You must obey the GNU General
27  Public License in all respects for all of the code used other than
28  Qt. If you modify this file, you may extend this exception to
29  your version of the file, but you are not obligated to do so. If
30  you do not wish to do so, delete this exception statement from
31  your version.
32 
33 **************************************************************************** */
34 #ifndef GETTEXTIMPORTPLUGIN_H
35 #define GETTEXTIMPORTPLUGIN_H
36 
37 #include "catalogfileplugin.h"
38 
39 #include <kdebug.h>
40 
41 #include <QStringList>
42 #include <QTextStream>
43 
44 class QTextCodec;
45 
46 namespace GettextCatalog {
47 
48 class ExtraDataSaver
49 {
50 public:
51  ExtraDataSaver(){}
52  virtual ~ExtraDataSaver(){}
53  void operator()(const QString& comment){extraData.append(comment);}
54  QStringList extraData;
55 };
56 
57 class ExtraDataSkipSaver:public ExtraDataSaver
58 {
59 public:
60  ExtraDataSkipSaver(){}
61  void operator()(const QString&){};
62 };
63 
70 class GettextImportPlugin: public CatalogImportPlugin
71 {
72 public:
73  GettextImportPlugin();
74  //GettextImportPlugin(ExtraDataSaver* extraDataSaver);
75  //~GettextImportPlugin(){delete _extraDataSaver;}
76  ConversionStatus load(QIODevice*);
77  const QString id() {return "GNU gettext";}
78 
79 private:
80  QTextCodec* codecForDevice(QIODevice* /*, bool* hadCodec*/);
81  ConversionStatus readEntryRaw(QTextStream& stream);
82  ConversionStatus readEntry(QTextStream& stream);
83 
84  // description of the last read entry
85  QString _msgctxt;
86  QStringList _msgid;
87  QStringList _msgstr;
88  QString _comment;
89  bool _msgidMultiline;
90  bool _msgstrMultiline;
91  bool _gettextPluralForm;
92  bool _testBorked;
93  bool _obsolete;
94  bool _msgctxtPresent;
95 
96  //ExtraDataSaver* _extraDataSaver;
97 
98  QRegExp _rxMsgCtxt;
99  QRegExp _rxMsgId;
100  QRegExp _rxMsgIdPlural;
101  QRegExp _rxMsgIdPluralBorked;
102  QRegExp _rxMsgIdBorked;
103  QRegExp _rxMsgIdRemQuotes;
104  QRegExp _rxMsgLineRemEndQuote;
105  QRegExp _rxMsgLineRemStartQuote;
106  QRegExp _rxMsgLine;
107  QRegExp _rxMsgLineBorked;
108  QRegExp _rxMsgStr;
109  QRegExp _rxMsgStrOther;
110  QRegExp _rxMsgStrPluralStart;
111  QRegExp _rxMsgStrPluralStartBorked;
112  QRegExp _rxMsgStrPlural;
113  QRegExp _rxMsgStrPluralBorked;
114  QRegExp _rxMsgStrRemQuotes;
115 
116  QString _obsoleteStart;
117  QString _msgctxtStart;
118  QString _bufferedLine;
119 };
120 }
121 #endif
QIODevice
GettextCatalog::ExtraDataSaver::extraData
QStringList extraData
Definition: gettextimport.h:54
GettextCatalog::GettextImportPlugin::id
const QString id()
Definition: gettextimport.h:77
GettextCatalog::ExtraDataSaver::ExtraDataSaver
ExtraDataSaver()
Definition: gettextimport.h:51
GettextCatalog::GettextImportPlugin::GettextImportPlugin
GettextImportPlugin()
Definition: gettextimport.cpp:63
QTextStream
GettextCatalog::ExtraDataSkipSaver
Definition: gettextimport.h:57
QRegExp
GettextCatalog::ExtraDataSaver::operator()
void operator()(const QString &comment)
Definition: gettextimport.h:53
QList::append
void append(const T &value)
GettextCatalog::ConversionStatus
ConversionStatus
Result of the conversion.
Definition: catalogfileplugin.h:53
QString
QTextCodec
QStringList
GettextCatalog::CatalogImportPlugin
HISTORY: this was a base class for Catalog import plugins in KBabel, but this architecture isn't not ...
Definition: catalogfileplugin.h:85
GettextCatalog::GettextImportPlugin::load
ConversionStatus load(QIODevice *)
Reimplement this method to load the local file passed as an argument.
Definition: gettextimport.cpp:89
GettextCatalog::ExtraDataSkipSaver::operator()
void operator()(const QString &)
Definition: gettextimport.h:61
GettextCatalog::ExtraDataSaver
Definition: gettextimport.h:48
GettextCatalog::ExtraDataSkipSaver::ExtraDataSkipSaver
ExtraDataSkipSaver()
Definition: gettextimport.h:60
GettextCatalog::ExtraDataSaver::~ExtraDataSaver
virtual ~ExtraDataSaver()
Definition: gettextimport.h:52
catalogfileplugin.h
GettextCatalog::GettextImportPlugin
The class for importing GNU gettext PO files.
Definition: gettextimport.h:70
This file is part of the KDE documentation.
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.

lokalize

Skip menu "lokalize"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdesdk API Reference

Skip menu "kdesdk API Reference"
  • kapptemplate
  • kcachegrind
  • kompare
  • lokalize
  • umbrello
  •   umbrello

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