• 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
pos.h
Go to the documentation of this file.
1 /* ****************************************************************************
2  This file is part of Lokalize
3 
4  Copyright (C) 2007-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 POS_H
25 #define POS_H
26 
27 #include <QMetaType>
28 #include <QHash>
29 
30 class Catalog;
31 
38 struct DocPosition
39 {
40  enum Part
41  {
42  UndefPart=0,
43  Source=1,
44  Target=2,
45  Comment=4
46  };
47 
48  int entry:32;
49  Part part:8;
50  char form:8;
51  uint offset:16;
52 
53  DocPosition(): entry(-1),part(Target),form(0),offset(0){}
54 
55  DocPosition(int entry_, Part part_, char form_=0, uint offset_=0)
56  : entry(entry_)
57  , part(part_)
58  , form(form_)
59  , offset(offset_)
60  {}
61 
62  DocPosition(int entry_, char form_=0, uint offset_=0)
63  : entry(entry_)
64  , part(Target)
65  , form(form_)
66  , offset(offset_)
67  {}
68 
69  bool operator==(const DocPosition& pos) const
70  {return entry==pos.entry && form==pos.form;};
71 
72 };
73 Q_DECLARE_METATYPE(DocPosition)
74 
75 bool switchPrev(Catalog*&,DocPosition& pos,int parts=DocPosition::Target);
76 bool switchNext(Catalog*&,DocPosition& pos,int parts=DocPosition::Target);
77 
78 
82 struct DocPos
83 {
84  int entry:24;
85  uchar form:8;
86 
87  DocPos():entry(-1), form(0){}
88 
89  DocPos(int _entry, uchar _form):
90  entry(_entry),
91  form(_form)
92  {}
93  DocPos(const DocPosition& pos):
94  entry(pos.entry),
95  form(pos.form)
96  {}
97 
98  bool operator<(const DocPos& pos) const
99  {return entry==pos.entry?form<pos.form:entry<pos.entry;};
100 
101  bool operator==(const DocPos& pos) const
102  {return entry==pos.entry && form==pos.form;};
103 
104  bool operator!=(const DocPos& pos) const
105  {return entry!=pos.entry || form!=pos.form;};
106 
107  DocPosition toDocPosition()
108  {
109  return DocPosition(entry, DocPosition::Target, form);
110  }
111 
112 };
113 Q_DECLARE_METATYPE(DocPos)
114 
115 
116 inline uint qHash(const DocPos &key)
117 {
118  return qHash((key.entry<<8)|key.form);
119 }
120 
121 
122 
123 #endif
DocPosition::part
Part part
Definition: pos.h:49
DocPosition::DocPosition
DocPosition()
Definition: pos.h:53
DocPosition::Target
Definition: pos.h:44
DocPosition::Part
Part
Definition: pos.h:40
DocPos::form
uchar form
Definition: pos.h:85
switchPrev
bool switchPrev(Catalog *&, DocPosition &pos, int parts=DocPosition::Target)
Definition: pos.cpp:38
DocPosition::DocPosition
DocPosition(int entry_, char form_=0, uint offset_=0)
Definition: pos.h:62
DocPosition::offset
uint offset
Definition: pos.h:51
DocPosition::entry
int entry
Definition: pos.h:48
DocPos::DocPos
DocPos()
Definition: pos.h:87
DocPosition
This struct represents a position in a catalog.
Definition: pos.h:38
DocPos::DocPos
DocPos(int _entry, uchar _form)
Definition: pos.h:89
switchNext
bool switchNext(Catalog *&, DocPosition &pos, int parts=DocPosition::Target)
Definition: pos.cpp:88
DocPos::DocPos
DocPos(const DocPosition &pos)
Definition: pos.h:93
DocPosition::form
char form
Definition: pos.h:50
DocPos::operator!=
bool operator!=(const DocPos &pos) const
Definition: pos.h:104
DocPosition::operator==
bool operator==(const DocPosition &pos) const
Definition: pos.h:69
qHash
uint qHash(const DocPos &key)
Definition: pos.h:116
DocPosition::Source
Definition: pos.h:43
DocPos
simpler version of DocPosition for use in QMap
Definition: pos.h:82
DocPos::entry
int entry
Definition: pos.h:84
Catalog
This class represents a catalog It uses CatalogStorage interface to work with catalogs in different f...
Definition: catalog.h:74
DocPosition::DocPosition
DocPosition(int entry_, Part part_, char form_=0, uint offset_=0)
Definition: pos.h:55
DocPos::operator<
bool operator<(const DocPos &pos) const
Definition: pos.h:98
DocPos::operator==
bool operator==(const DocPos &pos) const
Definition: pos.h:101
DocPosition::UndefPart
Definition: pos.h:42
DocPos::toDocPosition
DocPosition toDocPosition()
Definition: pos.h:107
DocPosition::Comment
Definition: pos.h:45
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