• 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
catalogitem_private.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 (C) 1999-2000 by Matthias Kiefer
6  <matthias.kiefer@gmx.de>
7  2002 by Stanislav Visnovsky <visnovsky@kde.org>
8  2007-2011 by Nick Shaforostoff <shafff@ukr.net>
9 
10  This program is free software; you can redistribute it and/or modify
11  it under the terms of the GNU General Public License as published by
12  the Free Software Foundation; either version 2 of the License, or
13  (at your option) any later version.
14 
15  This program is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU General Public License for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with this program; if not, write to the Free Software
22  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 
24  In addition, as a special exception, the copyright holders give
25  permission to link the code of this program with any edition of
26  the Qt library by Trolltech AS, Norway (or with modified versions
27  of Qt that use the same license as Qt), and distribute linked
28  combinations including the two. You must obey the GNU General
29  Public License in all respects for all of the code used other than
30  Qt. If you modify this file, you may extend this exception to
31  your version of the file, but you are not obligated to do so. If
32  you do not wish to do so, delete this exception statement from
33  your version.
34 
35 **************************************************************************** */
36 #ifndef CATALOGITEMPRIVATE_H
37 #define CATALOGITEMPRIVATE_H
38 
39 #include <QVector>
40 #include <QString>
41 #include <QByteArray>
42 
43 namespace GettextCatalog {
44 
57 class CatalogItemPrivate
58 {
59 
60 public:
61  bool _plural;
62  bool _valid;
63  bool _fuzzyCached;
64  bool _prependMsgIdEmptyLine;
65  bool _prependMsgStrEmptyLine;
66  bool _keepEmptyMsgCtxt;
67 
68  QByteArray _comment;
69  QString _msgctxt;
70 
71  QVector<QString> _msgidPlural;
72  QVector<QString> _msgstrPlural;
73 
74  //QVector<QString> _errors;
75 
76  CatalogItemPrivate()
77  : _plural(false)
78  , _valid(true)
79  , _fuzzyCached(false)
80  , _prependMsgIdEmptyLine(false)
81  , _prependMsgStrEmptyLine(false)
82  , _keepEmptyMsgCtxt(false)
83  {}
84 
85  void clear();
86  void assign(const CatalogItemPrivate& other);
87  bool isUntranslated() const;
88  bool isUntranslated(uint form) const;
89  const QString& msgid(const int form) const;
90 
91 };
92 
93 inline
94 void CatalogItemPrivate::clear()
95 {
96  _plural=false;
97  _valid=true;
98  _comment.clear();
99  _msgctxt.clear();
100  _msgidPlural.clear();
101  _msgstrPlural.clear();
102  //_errors.clear();
103 }
104 
105 inline
106 void CatalogItemPrivate::assign(const CatalogItemPrivate& other)
107 {
108  _comment=other._comment;
109  _msgctxt=other._msgctxt;
110  _msgidPlural=other._msgidPlural;
111  _msgstrPlural=other._msgstrPlural;
112  _valid=other._valid;
113  //_errors=other._errors;
114  _plural=other._plural;
115  _fuzzyCached=other._fuzzyCached;
116 }
117 
118 inline
119 bool CatalogItemPrivate::isUntranslated() const
120 {
121  int i=_msgstrPlural.size();
122  while (--i>=0)
123  if (_msgstrPlural.at(i).isEmpty())
124  return true;
125  return false;
126 }
127 
128 inline
129 bool CatalogItemPrivate::isUntranslated(uint form) const
130 {
131  if ((int)form<_msgstrPlural.size())
132  return _msgstrPlural.at(form).isEmpty();
133  else
134  return true;
135 }
136 
137 inline
138 const QString& CatalogItemPrivate::msgid(const int form) const
139 {
140  //if original lang is english, we have only 2 formz
141  return (form<_msgidPlural.size())?_msgidPlural.at(form):_msgidPlural.last();
142 }
143 
144 }
145 
146 #endif // CATALOGITEMPRIVATE_H
GettextCatalog::CatalogItemPrivate::_valid
bool _valid
Definition: catalogitem_private.h:62
QByteArray::clear
void clear()
QByteArray
QVector::last
T & last()
GettextCatalog::CatalogItemPrivate::assign
void assign(const CatalogItemPrivate &other)
Definition: catalogitem_private.h:106
GettextCatalog::CatalogItemPrivate::_keepEmptyMsgCtxt
bool _keepEmptyMsgCtxt
Definition: catalogitem_private.h:66
QString::clear
void clear()
QVector::clear
void clear()
GettextCatalog::CatalogItemPrivate::_prependMsgIdEmptyLine
bool _prependMsgIdEmptyLine
Definition: catalogitem_private.h:64
QString
GettextCatalog::CatalogItemPrivate::CatalogItemPrivate
CatalogItemPrivate()
Definition: catalogitem_private.h:76
GettextCatalog::CatalogItemPrivate::_msgctxt
QString _msgctxt
Definition: catalogitem_private.h:69
GettextCatalog::CatalogItemPrivate::msgid
const QString & msgid(const int form) const
Definition: catalogitem_private.h:138
GettextCatalog::CatalogItemPrivate::_plural
bool _plural
Definition: catalogitem_private.h:61
GettextCatalog::CatalogItemPrivate::isUntranslated
bool isUntranslated() const
Definition: catalogitem_private.h:119
QVector::at
const T & at(int i) const
QVector< QString >
GettextCatalog::CatalogItemPrivate::clear
void clear()
Definition: catalogitem_private.h:94
GettextCatalog::CatalogItemPrivate::_comment
QByteArray _comment
Definition: catalogitem_private.h:68
GettextCatalog::CatalogItemPrivate::_prependMsgStrEmptyLine
bool _prependMsgStrEmptyLine
Definition: catalogitem_private.h:65
GettextCatalog::CatalogItemPrivate::_msgidPlural
QVector< QString > _msgidPlural
Definition: catalogitem_private.h:71
GettextCatalog::CatalogItemPrivate::_fuzzyCached
bool _fuzzyCached
Definition: catalogitem_private.h:63
QVector::size
int size() const
GettextCatalog::CatalogItemPrivate::_msgstrPlural
QVector< QString > _msgstrPlural
Definition: catalogitem_private.h:72
GettextCatalog::CatalogItemPrivate
This class represents data for an entry in a catalog.
Definition: catalogitem_private.h:57
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:40:06 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