• 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
  • kasten
  • gui
  • io
  • streamencoder
  • viewtext
valuebytearraycolumntextrenderer.cpp
Go to the documentation of this file.
1 /*
2  This file is part of the Okteta Kasten module, made within the KDE community.
3 
4  Copyright 2003,2008 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 #include "valuebytearraycolumntextrenderer.h"
24 
25 // Okteta core
26 #include <valuecodec.h>
27 #include <abstractbytearraymodel.h>
28 // Qt
29 #include <QtCore/QTextStream>
30 
31 
32 namespace Kasten2
33 {
34 
35 ValueByteArrayColumnTextRenderer::ValueByteArrayColumnTextRenderer(
36  const Okteta::AbstractByteArrayModel* byteArrayModel, Okteta::Address offset,
37  const Okteta::CoordRange& coordRange,
38  int noOfBytesPerLine, int byteSpacingWidth, int noOfGroupedBytes,
39  Okteta::ValueCoding valueCoding )
40  : AbstractByteArrayColumnTextRenderer( byteArrayModel, offset, coordRange,
41  noOfBytesPerLine ),
42  mValueCodec( Okteta::ValueCodec::createCodec(valueCoding) )
43 {
44  setWidths( mValueCodec->encodingWidth(), byteSpacingWidth, noOfGroupedBytes );
45 }
46 
47 
48 void ValueByteArrayColumnTextRenderer::renderLine( QTextStream* stream, bool isSubline ) const
49 {
50 Q_UNUSED( isSubline )
51 
52  int p = 0;
53  int pEnd = mNoOfBytesPerLine;
54  // correct boundaries
55  if( mRenderLine == mCoordRange.start().line() )
56  p = mCoordRange.start().pos();
57  if( mRenderLine == mCoordRange.end().line() )
58  pEnd = mCoordRange.end().pos()+1;
59 
60  QString E;
61  E.resize( mValueCodec->encodingWidth() );
62  // draw individual chars
63  uint e = 0;
64  for( ; p<pEnd; ++p, ++mOffset )
65  {
66  // get next position
67  const uint t = mLinePositions[p];
68  // clear spacing
69  *stream << whiteSpace( t-e );
70  mValueCodec->encode( E, 0, mByteArrayModel->byte(mOffset) );
71  *stream << E;
72  e = t + mValueCodec->encodingWidth();
73  }
74 
75  *stream << whiteSpace( mNoOfCharsPerLine-e );
76  ++mRenderLine;
77 }
78 
79 ValueByteArrayColumnTextRenderer::~ValueByteArrayColumnTextRenderer()
80 {
81  delete mValueCodec;
82 }
83 
84 }
Okteta::CoordRange
describes a range in the buffercoord
Definition: coordrange.h:51
Okteta::Address
qint32 Address
Definition: address.h:34
Okteta::AbstractByteArrayModel
could it be useful to hide the data access behind an iterator? * class KDataBufferIterator { public: ...
Definition: abstractbytearraymodel.h:79
abstractbytearraymodel.h
Kasten2::AbstractColumnTextRenderer::whiteSpace
static QString whiteSpace(unsigned int length)
Definition: abstractcolumntextrenderer.cpp:35
KDE::Range::start
T start() const
Definition: range.h:86
Kasten2::AbstractByteArrayColumnTextRenderer::mNoOfBytesPerLine
const int mNoOfBytesPerLine
Definition: abstractbytearraycolumntextrenderer.h:69
Kasten2::AbstractByteArrayColumnTextRenderer::setWidths
void setWidths(int byteWidth, int byteSpacingWidth, int noOfGroupedBytes)
Definition: abstractbytearraycolumntextrenderer.cpp:43
Kasten2::ValueByteArrayColumnTextRenderer::ValueByteArrayColumnTextRenderer
ValueByteArrayColumnTextRenderer(const Okteta::AbstractByteArrayModel *byteArrayModel, Okteta::Address offset, const Okteta::CoordRange &coordRange, int noOfBytesPerLine, int byteSpacingWidth, int noOfGroupedBytes, Okteta::ValueCoding valueCoding)
Definition: valuebytearraycolumntextrenderer.cpp:35
Kasten2::AbstractByteArrayColumnTextRenderer::mCoordRange
const Okteta::CoordRange mCoordRange
Definition: abstractbytearraycolumntextrenderer.h:67
KDE::Range::end
T end() const
Definition: range.h:88
Kasten2::AbstractByteArrayColumnTextRenderer::mLinePositions
int *const mLinePositions
Definition: abstractbytearraycolumntextrenderer.h:79
valuecodec.h
Kasten2::AbstractByteArrayColumnTextRenderer
Definition: abstractbytearraycolumntextrenderer.h:42
Okteta::AbstractByteArrayModel::byte
virtual Byte byte(Address offset) const =0
locates working range The idea behind is to tell buffer which range will be requested in the followin...
Kasten2::AbstractByteArrayColumnTextRenderer::mByteArrayModel
const Okteta::AbstractByteArrayModel * mByteArrayModel
Definition: abstractbytearraycolumntextrenderer.h:65
Kasten2::ValueByteArrayColumnTextRenderer::renderLine
virtual void renderLine(QTextStream *stream, bool isSubline) const
Definition: valuebytearraycolumntextrenderer.cpp:48
Kasten2::ValueByteArrayColumnTextRenderer::~ValueByteArrayColumnTextRenderer
virtual ~ValueByteArrayColumnTextRenderer()
Definition: valuebytearraycolumntextrenderer.cpp:79
valuebytearraycolumntextrenderer.h
Kasten2::ValueByteArrayColumnTextRenderer::mValueCodec
const Okteta::ValueCodec * mValueCodec
Definition: valuebytearraycolumntextrenderer.h:52
Kasten2::AbstractByteArrayColumnTextRenderer::mNoOfCharsPerLine
int mNoOfCharsPerLine
buffered value of how many chars a line needs
Definition: abstractbytearraycolumntextrenderer.h:77
Kasten2::AbstractByteArrayColumnTextRenderer::mOffset
Okteta::Address mOffset
Data to print.
Definition: abstractbytearraycolumntextrenderer.h:74
Okteta::ValueCoding
ValueCoding
Definition: oktetacore.h:34
Kasten2::AbstractByteArrayColumnTextRenderer::mRenderLine
int mRenderLine
Line to print.
Definition: abstractbytearraycolumntextrenderer.h:72
Okteta::ValueCodec::encodingWidth
virtual unsigned int encodingWidth() const =0
Okteta::ValueCodec::encode
virtual void encode(QString &digits, unsigned int pos, Byte byte) const =0
Encodes the byte using full coding width, prefixing with 0s if needed, and writes the result to digit...
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:04:09 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