• 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
gettextstorage.h
Go to the documentation of this file.
1 /*
2 Copyright 2008-2009 Nick Shaforostoff <shaforostoff@kde.ru>
3 
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License as
6 published by the Free Software Foundation; either version 2 of
7 the License or (at your option) version 3 or any later version
8 accepted by the membership of KDE e.V. (or its successor approved
9 by the membership of KDE e.V.), which shall act as a proxy
10 defined in Section 14 of version 3 of the license.
11 
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20 
21 
22 #ifndef GETTEXTSTORAGE_H
23 #define GETTEXTSTORAGE_H
24 
25 #include <QTextCodec>
26 #include <QVector>
27 #include "catalogitem.h"
28 #include "catalogstorage.h"
29 
33 namespace GettextCatalog {
34 
39 class GettextStorage: public CatalogStorage
40 {
41 public:
42  GettextStorage();
43  ~GettextStorage();
44 
45  int capabilities() const{return 0;}
46 
47  int load(QIODevice* device/*, bool readonly=false*/);
48  bool save(QIODevice* device, bool belongsToProject=false);
49 
50  int size() const;
51 
52  //flat-model interface (ignores XLIFF grouping)
53  QString source(const DocPosition& pos) const;
54  QString target(const DocPosition& pos) const;
55  CatalogString sourceWithTags(DocPosition pos) const;
56  CatalogString targetWithTags(DocPosition pos) const;
57  CatalogString catalogString(const DocPosition& pos) const{return pos.part==DocPosition::Target?targetWithTags(pos):sourceWithTags(pos);}
58 
59  void targetDelete(const DocPosition& pos, int count);
60  void targetInsert(const DocPosition& pos, const QString& arg);
61  void setTarget(const DocPosition& pos, const QString& arg);//called for mergeCatalog
62 
63  void targetInsertTag(const DocPosition&, const InlineTag&);
64  InlineTag targetDeleteTag(const DocPosition&);
65 
66  QStringList sourceAllForms(const DocPosition& pos, bool stripNewLines=false) const;
67  QStringList targetAllForms(const DocPosition& pos, bool stripNewLines=false) const;
68 
69  QVector<Note> notes(const DocPosition& pos) const;
70  Note setNote(DocPosition pos, const Note& note);
71  QVector<AltTrans> altTrans(const DocPosition& pos) const;
72  QStringList sourceFiles(const DocPosition& pos) const;
73  QVector<Note> developerNotes(const DocPosition& pos) const;
74 
75  QStringList context(const DocPosition& pos) const;
76 
77  QStringList matchData(const DocPosition& pos) const;
78  QString id(const DocPosition& pos) const;
79 
80  bool isPlural(const DocPosition& pos) const;
81 
82  bool isApproved(const DocPosition& pos) const;
83  void setApproved(const DocPosition& pos, bool approved);
84 
85  bool isEmpty(const DocPosition& pos) const;
86 
87  QString mimetype()const{return "text/x-gettext-translation";}
88 
89 private:
90  bool setHeader(const CatalogItem& newHeader);
91  void setCodec(QTextCodec* codec) {m_codec = codec;}
92 
93  QVector<Note> notes(const DocPosition& pos, const QRegExp& re, int preLen) const;
94 
95 private:
96  QVector<CatalogItem> m_entries;
97  QVector<CatalogItem> m_obsoleteEntries;
98  CatalogItem m_header;
99  QTextCodec* m_codec;
100 
101  short m_maxLineLength;
102  short m_trailingNewLines;
103  bool m_generatedFromDocbook;
104 
105  QStringList m_catalogExtraData;
106  QByteArray m_catalogExtraDataCompressed;
107 
108  friend class CatalogImportPlugin;
109  friend class GettextExportPlugin;
110 };
111 
112 }
113 
114 #endif
GettextCatalog::GettextStorage::save
bool save(QIODevice *device, bool belongsToProject=false)
Definition: gettextstorage.cpp:89
QIODevice
GettextCatalog::GettextStorage::isApproved
bool isApproved(const DocPosition &pos) const
Definition: gettextstorage.cpp:368
DocPosition::part
Part part
Definition: pos.h:49
GettextCatalog::GettextStorage::capabilities
int capabilities() const
Definition: gettextstorage.h:45
GettextCatalog::GettextStorage::targetInsert
void targetInsert(const DocPosition &pos, const QString &arg)
Definition: gettextstorage.cpp:173
GettextCatalog::GettextStorage::notes
QVector< Note > notes(const DocPosition &pos) const
Definition: gettextstorage.cpp:295
QByteArray
DocPosition::Target
Definition: pos.h:44
GettextCatalog::GettextStorage::sourceWithTags
CatalogString sourceWithTags(DocPosition pos) const
Definition: gettextstorage.cpp:151
GettextCatalog::GettextStorage::developerNotes
QVector< Note > developerNotes(const DocPosition &pos) const
Definition: gettextstorage.cpp:301
GettextCatalog::CatalogItem
This class represents an entry in a catalog.
Definition: catalogitem.h:55
GettextCatalog::GettextExportPlugin
The class for exporting GNU gettext PO files.
Definition: gettextexport.h:53
catalogstorage.h
Note
Definition: note.h:29
catalogitem.h
GettextCatalog::GettextStorage::id
QString id(const DocPosition &pos) const
entry id unique for this file
Definition: gettextstorage.cpp:349
GettextCatalog::GettextStorage::~GettextStorage
~GettextStorage()
Definition: gettextstorage.cpp:51
GettextCatalog::GettextStorage::altTrans
QVector< AltTrans > altTrans(const DocPosition &pos) const
Definition: gettextstorage.cpp:205
GettextCatalog::GettextStorage::targetWithTags
CatalogString targetWithTags(DocPosition pos) const
Definition: gettextstorage.cpp:155
GettextCatalog::GettextStorage::isEmpty
bool isEmpty(const DocPosition &pos) const
Definition: gettextstorage.cpp:380
GettextCatalog::GettextStorage::catalogString
CatalogString catalogString(const DocPosition &pos) const
Definition: gettextstorage.h:57
DocPosition
This struct represents a position in a catalog.
Definition: pos.h:38
QRegExp
GettextCatalog::GettextStorage::sourceAllForms
QStringList sourceAllForms(const DocPosition &pos, bool stripNewLines=false) const
all plural forms. pos.form doesn't matter
Definition: gettextstorage.cpp:195
GettextCatalog::GettextStorage::matchData
QStringList matchData(const DocPosition &pos) const
user-invisible data for matching, e.g.
Definition: gettextstorage.cpp:334
GettextCatalog::GettextStorage::mimetype
QString mimetype() const
Definition: gettextstorage.h:87
GettextCatalog::GettextStorage::context
QStringList context(const DocPosition &pos) const
Definition: gettextstorage.cpp:329
QString
QTextCodec
GettextCatalog::GettextStorage::source
QString source(const DocPosition &pos) const
flat-model interface (ignores XLIFF grouping)
Definition: gettextstorage.cpp:160
CatalogStorage
Abstract interface for storage of translation file.
Definition: catalogstorage.h:45
QStringList
GettextCatalog::GettextStorage::setNote
Note setNote(DocPosition pos, const Note &note)
Definition: gettextstorage.cpp:243
GettextCatalog::GettextStorage::sourceFiles
QStringList sourceFiles(const DocPosition &pos) const
Definition: gettextstorage.cpp:307
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::GettextStorage::targetDelete
void targetDelete(const DocPosition &pos, int count)
edit operations used by undo/redo system and sync-mode
Definition: gettextstorage.cpp:169
CatalogString
data structure used to pass info about inline elements a XLIFF tag is represented by a TAGRANGE_IMAGE...
Definition: catalogstring.h:128
QVector
GettextCatalog::GettextStorage::setApproved
void setApproved(const DocPosition &pos, bool approved)
Definition: gettextstorage.cpp:372
GettextCatalog::GettextStorage::load
int load(QIODevice *device)
Definition: gettextstorage.cpp:57
GettextCatalog::GettextStorage::targetAllForms
QStringList targetAllForms(const DocPosition &pos, bool stripNewLines=false) const
Definition: gettextstorage.cpp:200
GettextCatalog::GettextStorage::size
int size() const
Definition: gettextstorage.cpp:120
GettextCatalog::GettextStorage::targetDeleteTag
InlineTag targetDeleteTag(const DocPosition &)
Definition: gettextstorage.cpp:189
GettextCatalog::GettextStorage::setTarget
void setTarget(const DocPosition &pos, const QString &arg)
Definition: gettextstorage.cpp:177
GettextCatalog::GettextStorage::target
QString target(const DocPosition &pos) const
Definition: gettextstorage.cpp:164
GettextCatalog::GettextStorage::targetInsertTag
void targetInsertTag(const DocPosition &, const InlineTag &)
Definition: gettextstorage.cpp:183
GettextCatalog::GettextStorage
Implementation of storage for Gettext PO.
Definition: gettextstorage.h:39
GettextCatalog::GettextStorage::GettextStorage
GettextStorage()
Definition: gettextstorage.cpp:45
GettextCatalog::GettextStorage::isPlural
bool isPlural(const DocPosition &pos) const
Definition: gettextstorage.cpp:363
InlineTag
data structure used to pass info about inline elements a XLIFF tag is represented by a TAGRANGE_IMAGE...
Definition: catalogstring.h:44
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