• 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
catalogstring.h
Go to the documentation of this file.
1 /* ****************************************************************************
2  This file is part of Lokalize
3 
4  Copyright (C) 2008-2009 by Nick Shaforostoff <shafff@ukr.net>
5 
6  This program is free software; you can redistribute it and/or
7  modify it under the terms of the GNU General Public License as
8  published by the Free Software Foundation; either version 2 of
9  the License or (at your option) version 3 or any later version
10  accepted by the membership of KDE e.V. (or its successor approved
11  by the membership of KDE e.V.), which shall act as a proxy
12  defined in Section 14 of version 3 of the license.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program. If not, see <http://www.gnu.org/licenses/>.
21 
22 **************************************************************************** */
23 
24 #ifndef CATALOGSTRING_H
25 #define CATALOGSTRING_H
26 
27 #include <QList>
28 #include <QMap>
29 #include <QString>
30 #include <QMetaType>
31 
32 //#define TAGRANGE_IMAGE_SYMBOL 65532
33 #define TAGRANGE_IMAGE_SYMBOL QChar::ObjectReplacementCharacter
34 
44 struct InlineTag
45 {
46  //sub = can contain <sub>-flow tag
47  //recursive = can contain other inline markup tags
49  enum InlineElement
50  {
51  _unknown,
52  bpt, //sub
53  ept, //sub
54  ph, //sub
55  it, //sub
56  //_subContainersDelimiter,
57  mrk, //recursive, no id
58  g, //recursive
59  sub, //recursive, no id
60  _pairedXmlTagDelimiter,
61  x, //empty
62  bx, //empty
63  ex, //empty
64  InlineElementCount
65  };
66 
67 
68  int start;
69  int end;
70  InlineElement type;
71  QString id;
72  QString xid;
73  QString equivText;
74  QString ctype;
75 
76  explicit InlineTag(): start(-1), end(-1), type(_unknown){}
77 
78  InlineTag(int start_, int end_, InlineElement type_,QString id_=QString(),QString xid_=QString(),QString equivText_=QString(),QString ctype_=QString())
79  : start(start_), end(end_), type(type_), id(id_), xid(xid_), equivText(equivText_), ctype(ctype_){}
80 
89  bool isEmpty()const{return start==-1;}
90 
98  InlineTag getPlaceholder() const;
99 
101  static InlineElement getElementType(const QByteArray&);
102  static const char* getElementName(InlineElement type);
103  const char* getElementName()const{return getElementName(type);}
104  const char* name()const{return getElementName();}
105  static bool isPaired(InlineElement type){return type<InlineTag::_pairedXmlTagDelimiter;}
106  bool isPaired()const{return isPaired(type);}
107 
108  QString displayName() const;
109 
110  bool operator<(const InlineTag& other)const
111  {
112  return start<other.start;
113  }
114 
115 };
116 Q_DECLARE_METATYPE(InlineTag)
117 Q_DECLARE_METATYPE(QList<InlineTag>)
118 
119 
128 struct CatalogString
129 {
130  QString string;
131  QList<InlineTag> tags;
132 
133  CatalogString(){}
134  CatalogString(QString str):string(str){}
135  CatalogString(QString str, QByteArray tagsByteArray);
136  QMap<QString,int> tagIdToIndex() const; //assigns same indexes for tags with same ids
137 
138  QByteArray tagsAsByteArray()const;
139 
140  void remove(int position, int len);
141  void insert(int position, const QString& str);
142  void replace(int position, int len, const QString& str){remove(position,len);insert(position,str);}
143  void clear(){string.clear();tags.clear();}
144  bool isEmpty() const {return string.isEmpty();}
145 };
146 Q_DECLARE_METATYPE(CatalogString)
147 
148 
149 #include <QDataStream>
150 QDataStream &operator<<(QDataStream &out, const InlineTag &myObj);
151 QDataStream &operator>>(QDataStream &in, InlineTag &myObj);
152 QDataStream &operator<<(QDataStream &out, const CatalogString &myObj);
153 QDataStream &operator>>(QDataStream &in, CatalogString &myObj);
154 
155 
157 void adaptCatalogString(CatalogString& target, const CatalogString& ref);
158 
159 
160 #endif
QList::clear
void clear()
InlineTag::operator<
bool operator<(const InlineTag &other) const
Definition: catalogstring.h:110
CatalogString::clear
void clear()
Definition: catalogstring.h:143
operator>>
QDataStream & operator>>(QDataStream &in, InlineTag &myObj)
Definition: catalogstring.cpp:252
InlineTag::isPaired
static bool isPaired(InlineElement type)
Definition: catalogstring.h:105
InlineTag::xid
QString xid
Definition: catalogstring.h:72
CatalogString::CatalogString
CatalogString()
Definition: catalogstring.h:133
QByteArray
QDataStream
InlineTag::equivText
QString equivText
Definition: catalogstring.h:73
QMap< QString, int >
InlineTag::bx
Definition: catalogstring.h:62
InlineTag::g
Definition: catalogstring.h:58
InlineTag::ex
Definition: catalogstring.h:63
CatalogString::string
QString string
Definition: catalogstring.h:130
InlineTag::getElementType
static InlineElement getElementType(const QByteArray &)
Definition: catalogstring.cpp:58
CatalogString::isEmpty
bool isEmpty() const
Definition: catalogstring.h:144
InlineTag::isPaired
bool isPaired() const
Definition: catalogstring.h:106
InlineTag::it
Definition: catalogstring.h:55
InlineTag::InlineElementCount
Definition: catalogstring.h:64
InlineTag::ept
Definition: catalogstring.h:53
CatalogString::CatalogString
CatalogString(QString str)
Definition: catalogstring.h:134
InlineTag::displayName
QString displayName() const
Definition: catalogstring.cpp:68
InlineTag::InlineElement
InlineElement
Definition: catalogstring.h:49
InlineTag::type
InlineElement type
Definition: catalogstring.h:70
InlineTag::_pairedXmlTagDelimiter
Definition: catalogstring.h:60
InlineTag::InlineTag
InlineTag(int start_, int end_, InlineElement type_, QString id_=QString(), QString xid_=QString(), QString equivText_=QString(), QString ctype_=QString())
Definition: catalogstring.h:78
InlineTag::_unknown
Definition: catalogstring.h:51
InlineTag::start
int start
Definition: catalogstring.h:68
InlineTag::ph
Definition: catalogstring.h:54
InlineTag::id
QString id
Definition: catalogstring.h:71
operator<<
QDataStream & operator<<(QDataStream &out, const InlineTag &myObj)
Definition: catalogstring.cpp:247
QString
QList
InlineTag::name
const char * name() const
Definition: catalogstring.h:104
InlineTag::sub
Definition: catalogstring.h:59
adaptCatalogString
void adaptCatalogString(CatalogString &target, const CatalogString &ref)
prepares
Definition: catalogstring.cpp:271
CatalogString
data structure used to pass info about inline elements a XLIFF tag is represented by a TAGRANGE_IMAGE...
Definition: catalogstring.h:128
InlineTag::getElementName
const char * getElementName() const
Definition: catalogstring.h:103
InlineTag::InlineTag
InlineTag()
Definition: catalogstring.h:76
CatalogString::tags
QList< InlineTag > tags
Definition: catalogstring.h:131
InlineTag::ctype
QString ctype
Definition: catalogstring.h:74
InlineTag::x
Definition: catalogstring.h:61
InlineTag::mrk
Definition: catalogstring.h:57
InlineTag::bpt
Definition: catalogstring.h:52
CatalogString::replace
void replace(int position, int len, const QString &str)
Definition: catalogstring.h:142
InlineTag::isEmpty
bool isEmpty() const
for situations when target doesn't contain tag (of the same type and with the same id) from source tr...
Definition: catalogstring.h:89
InlineTag::end
int end
Definition: catalogstring.h:69
InlineTag
data structure used to pass info about inline elements a XLIFF tag is represented by a TAGRANGE_IMAGE...
Definition: catalogstring.h:44
InlineTag::getPlaceholder
InlineTag getPlaceholder() const
used to denote tag that doesn't present in target, to have parallel numbering in view ...
Definition: catalogstring.cpp:50
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