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

okteta

  • sources
  • kde-4.12
  • kdesdk
  • okteta
  • gui
bytearraytablelayout.h
Go to the documentation of this file.
1 /*
2  This file is part of the Okteta Gui library, made within the KDE community.
3 
4  Copyright 2003,2008-2009 Friedrich W. H. Kossebau <kossebau@kde.org>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Lesser General Public
8  License as published by the Free Software Foundation; either
9  version 2.1 of the License, or (at your option) version 3, or any
10  later version accepted by the membership of KDE e.V. (or its
11  successor approved by the membership of KDE e.V.), which shall
12  act as a proxy defined in Section 6 of version 3 of the license.
13 
14  This library 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 GNU
17  Lesser General Public License for more details.
18 
19  You should have received a copy of the GNU Lesser General Public
20  License along with this library. If not, see <http://www.gnu.org/licenses/>.
21 */
22 
23 #ifndef OKTETA_BYTEARRAYTABLELAYOUT_H
24 #define OKTETA_BYTEARRAYTABLELAYOUT_H
25 
26 // lib
27 #include "coordrange.h"
28 #include "oktetagui_export.h"
29 // Okteta core
30 #include "addressrange.h"
31 
32 
33 // TODO: rename things like startOffset and firstLineOffset, not really descriptive
34 namespace Okteta
35 {
36 
61 class OKTETAGUI_EXPORT ByteArrayTableLayout
62 {
63  public:
64  ByteArrayTableLayout( Size noOfBytesPerLine, Address firstLineOffset, Address startOffset, Address byteArrayOffset, Size byteArrayLength );
65  //ByteArrayTableLayout();
66 
67  ~ByteArrayTableLayout();
68 
69 
70  public: // given values
72  Address startOffset() const;
74  Address firstLineOffset() const;
76  Size noOfBytesPerLine() const;
78  Address byteArrayOffset() const;
80  Size length() const;
82  LineSize noOfLinesPerPage() const;
83 
84  public: // calculated values
85  Line startLine() const;
86  LinePosition firstStartLinePosition() const;
88  Coord startCoord() const;
89 
90  Line finalLine() const;
91  LinePosition lastFinalLinePosition() const;
93  Coord finalCoord() const;
94 
95  Address lastByteArrayOffset() const;
97  LineSize noOfLines() const;
98 
99 
100  public: // value calculation service
105  Address indexAtCCoord( const Coord& coord ) const;
110  Address indexAtCFirstLinePosition( Line line ) const;
115  Address indexAtCLastLinePosition( Line line ) const;
120  Line lineAtCIndex( Address index ) const;
125  Coord coordOfCIndex( Address index ) const;
126 
128  Address indexAtCoord( const Coord& coord ) const;
130  Address indexAtFirstLinePosition( Line line ) const;
132  Address indexAtLastLinePosition( Line line ) const;
134  Line lineAtIndex( Address index ) const;
136  Coord coordOfIndex( Address index ) const;
138  CoordRange coordRangeOfIndizes( const AddressRange& indizes ) const;
139 
141  LinePositionRange linePositions( Line line ) const;
143  LinePosition firstLinePosition( Line line ) const;
145  LinePosition lastLinePosition( Line line ) const;
147  LinePosition firstLinePosition( const Coord& coord ) const;
149  LinePosition lastLinePosition( const Coord& coord ) const;
151  bool hasContent( Line line ) const;
153  bool atFirstLinePosition( const Coord& coord ) const;
155  bool atLastLinePosition( const Coord& coord ) const;
156 
158  Address correctIndex( Address index ) const;
160  Coord correctCoord( const Coord& coord ) const;
161 
162 
163  public: // modification access; return true if changes
165  bool setStartOffset( Address startOffset );
167  bool setFirstLineOffset( Address firstLineOffset );
169  bool setNoOfBytesPerLine( LineSize noOfBytesPerLine );
171  bool setByteArrayOffset( Address byteArrayOffset );
173  bool setLength( Size length );
175  void setNoOfLinesPerPage( LineSize noOfLinesPerPage );
176 
177 
178  protected:
180  void calcStart();
182  void calcEnd();
183 
184 
185  protected:
187  Size mNoOfBytesPerLine;
189  Address mFirstLineOffset;
191  Address mStartOffset;
193  Address mRelativeStartOffset;
195  Address mByteArrayOffset;
197  Address mLastByteArrayOffset;
199  LineSize mNoOfLinesPerPage;
200 
201  protected: // calculated values, buffered
203  CoordRange mCoordRange;
204 };
205 
206 
207 inline Address ByteArrayTableLayout::startOffset() const { return mStartOffset; }
208 inline Address ByteArrayTableLayout::firstLineOffset() const { return mFirstLineOffset; }
209 inline Size ByteArrayTableLayout::noOfBytesPerLine() const { return mNoOfBytesPerLine; }
210 inline Address ByteArrayTableLayout::byteArrayOffset() const { return mByteArrayOffset; }
211 inline Size ByteArrayTableLayout::length() const { return mLastByteArrayOffset-mByteArrayOffset+1; }
212 inline Address ByteArrayTableLayout::lastByteArrayOffset() const { return mLastByteArrayOffset; }
213 
214 inline Coord ByteArrayTableLayout::finalCoord() const { return mCoordRange.end(); }
215 inline Coord ByteArrayTableLayout::startCoord() const { return mCoordRange.start(); }
216 inline LinePosition ByteArrayTableLayout::firstStartLinePosition() const { return startCoord().pos(); }
217 inline LinePosition ByteArrayTableLayout::lastFinalLinePosition() const { return finalCoord().pos(); }
218 inline Line ByteArrayTableLayout::startLine() const { return startCoord().line(); }
219 inline Line ByteArrayTableLayout::finalLine() const { return finalCoord().line(); }
220 inline LineSize ByteArrayTableLayout::noOfLinesPerPage() const { return mNoOfLinesPerPage; }
221 inline LineSize ByteArrayTableLayout::noOfLines() const { return mByteArrayOffset>mLastByteArrayOffset?0:finalLine()+1; }
222 
223 }
224 
225 #endif
Okteta::CoordRange
describes a range in the buffercoord
Definition: coordrange.h:51
Okteta::ByteArrayTableLayout::noOfLines
LineSize noOfLines() const
tells how much lines this layout needs (incl.
Definition: bytearraytablelayout.h:221
OKTETAGUI_EXPORT
#define OKTETAGUI_EXPORT
Definition: oktetagui_export.h:36
Okteta::ByteArrayTableLayout::startOffset
Address startOffset() const
Definition: bytearraytablelayout.h:207
Okteta::Address
qint32 Address
Definition: address.h:34
oktetagui_export.h
Okteta::ByteArrayTableLayout::noOfBytesPerLine
Size noOfBytesPerLine() const
returns number of bytes per line
Definition: bytearraytablelayout.h:209
Okteta::ByteArrayTableLayout::mFirstLineOffset
Address mFirstLineOffset
starting offset of the first displayed line
Definition: bytearraytablelayout.h:189
Okteta::ByteArrayTableLayout::firstLineOffset
Address firstLineOffset() const
Definition: bytearraytablelayout.h:208
KDE::NumberRange< Address, Size >
KDE::Range::start
T start() const
Definition: range.h:86
Okteta::ByteArrayTableLayout::mRelativeStartOffset
Address mRelativeStartOffset
Definition: bytearraytablelayout.h:193
Okteta::Coord
a class which represents a coord in a 2-dim.
Definition: coord.h:47
Okteta::ByteArrayTableLayout::finalCoord
Coord finalCoord() const
returns the coord of the end
Definition: bytearraytablelayout.h:214
Okteta::ByteArrayTableLayout::noOfLinesPerPage
LineSize noOfLinesPerPage() const
returns number of lines per visual page
Definition: bytearraytablelayout.h:220
Okteta::Line
qint32 Line
Definition: line.h:33
Okteta::ByteArrayTableLayout
the logical layout of a byte array table for a view
Definition: bytearraytablelayout.h:61
addressrange.h
Okteta::ByteArrayTableLayout::startLine
Line startLine() const
Definition: bytearraytablelayout.h:218
Okteta::ByteArrayTableLayout::mCoordRange
CoordRange mCoordRange
Definition: bytearraytablelayout.h:203
KDE::Range::end
T end() const
Definition: range.h:88
Okteta::Coord::pos
LinePosition pos() const
Definition: coord.h:213
Okteta::ByteArrayTableLayout::mNoOfBytesPerLine
Size mNoOfBytesPerLine
how many chars per line
Definition: bytearraytablelayout.h:187
Okteta::ByteArrayTableLayout::finalLine
Line finalLine() const
Definition: bytearraytablelayout.h:219
Okteta::ByteArrayTableLayout::lastByteArrayOffset
Address lastByteArrayOffset() const
Definition: bytearraytablelayout.h:212
Okteta::ByteArrayTableLayout::mNoOfLinesPerPage
LineSize mNoOfLinesPerPage
number of lines that are moved by page up/down
Definition: bytearraytablelayout.h:199
Okteta::LinePosition
qint32 LinePosition
Definition: lineposition.h:33
Okteta::ByteArrayTableLayout::mLastByteArrayOffset
Address mLastByteArrayOffset
last offset in the displayed bytearray section
Definition: bytearraytablelayout.h:197
Okteta::Coord::line
Line line() const
Definition: coord.h:214
Okteta::ByteArrayTableLayout::firstStartLinePosition
LinePosition firstStartLinePosition() const
Definition: bytearraytablelayout.h:216
Okteta::ByteArrayTableLayout::byteArrayOffset
Address byteArrayOffset() const
returns the offset of the start of the displayed byte array section
Definition: bytearraytablelayout.h:210
Okteta::Size
qint32 Size
Definition: size.h:33
Okteta::ByteArrayTableLayout::mStartOffset
Address mStartOffset
starting offset of the displayed bytearray
Definition: bytearraytablelayout.h:191
Okteta::ByteArrayTableLayout::startCoord
Coord startCoord() const
returns the coord of the start
Definition: bytearraytablelayout.h:215
coordrange.h
Okteta::LineSize
qint32 LineSize
Definition: line.h:34
Okteta::ByteArrayTableLayout::length
Size length() const
returns the length of the displayed byte array section
Definition: bytearraytablelayout.h:211
Okteta::ByteArrayTableLayout::lastFinalLinePosition
LinePosition lastFinalLinePosition() const
Definition: bytearraytablelayout.h:217
Okteta::ByteArrayTableLayout::mByteArrayOffset
Address mByteArrayOffset
offset in the given bytearray
Definition: bytearraytablelayout.h:195
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:04:07 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

okteta

Skip menu "okteta"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdesdk API Reference

Skip menu "kdesdk API Reference"
  • kapptemplate
  • kcachegrind
  • kompare
  • lokalize
  • okteta
  • 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