• 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
  • controllers
  • view
  • poddecoder
poddecodertool.h
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 2007-2010 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 PODDECODERTOOL_H
24 #define PODDECODERTOOL_H
25 
26 // lib
27 #include "oktetakastencontrollers_export.h"
28 // tool
29 #include "poddata.h"
30 // Kasten core
31 #include <abstracttool.h>
32 // Okteta core
33 #include <oktetacore.h>
34 #include <address.h>
35 // Qt
36 #include <QtCore/QVector>
37 
38 namespace Okteta {
39 class AbstractTypeCodec;
40 class CharCodec;
41 class AbstractByteArrayModel;
42 }
43 
44 
45 namespace Kasten2
46 {
47 class AbstractDifferentSizeDialog;
48 class ByteArrayView;
49 
50 
51 class OKTETAKASTENCONTROLLERS_EXPORT PODDecoderTool : public AbstractTool
52 {
53  Q_OBJECT
54 
55  public:
56  static const int MaxPODSize = sizeof(double);
57  // ensure strict alignment for double as needed on some architectures (e.g. PA-RISC)
58  typedef union { unsigned char Data[MaxPODSize]; double Dummy; } Aligned64Bit;
59 
60  public:
61  PODDecoderTool();
62 
63  virtual ~PODDecoderTool();
64 
65  public: // AbstractTool API
66 // virtual AbstractModel* targetModel() const;
67  virtual QString title() const;
68 
69  virtual void setTargetModel( AbstractModel* model );
70 
71  public:
72  bool isApplyable() const; // candidate for AbstractTool API
73  bool isReadOnly() const;
74  QVariant value( int podId ) const;
75  QString nameOfPOD( int podId ) const;
76  int podCount() const;
77 
78  bool isUnsignedAsHex() const;
79  Okteta::ByteOrder byteOrder() const;
80  Okteta::CharCodec* charCodec() const;
81 
82  public:
83  void setData( const QVariant& data, int podId );
84  void markPOD( int podId );
85  void unmarkPOD();
86 
87  void setDifferentSizeDialog( AbstractDifferentSizeDialog* differentSizeDialog );
88 
89  public Q_SLOTS:
90  void setUnsignedAsHex( bool unsignedAsHex );
91  void setByteOrder( int byteOrder );
92 
93  Q_SIGNALS: // changes to the setting currently not signalled, because only controlled by view
94  void isApplyableChanged( bool isApplyable ); // candidate for AbstractTool API
95  void readOnlyChanged( bool isReadOnly );
96  void dataChanged();
97 
98  private:
99  void updateData();
100  void setupDecoder();
101 
102  private Q_SLOTS:
103  void onCursorPositionChange( Okteta::Address pos );
104  void onContentsChange();
105  void onReadOnlyChanged();
106 
107  void onCharCodecChange( const QString& codecName );
108 // void onUndefinedCharChanged( const QChar& undefinedChar );
109 
110  private: // source
111  ByteArrayView* mByteArrayView;
112  Okteta::AbstractByteArrayModel* mByteArrayModel;
113  Okteta::Address mCursorIndex;
114 
115  bool mReadOnly :1;
116  bool mIsPodMarked :1;
117 
118  QVector<Okteta::AbstractTypeCodec*> mTypeCodecs;
119  Okteta::CharCodec* mCharCodec;
120  AbstractDifferentSizeDialog* mDifferentSizeDialog;
121 
122  private: // settings
123  bool mUnsignedAsHex :1;
124 
125  private: // decoded data
126  Okteta::PODData mPODData;
127  QVector<QVariant> mDecodedValueList;
128  QVector<int> mDecodedValueByteCountList;
129 };
130 
131 
132 inline bool PODDecoderTool::isUnsignedAsHex() const { return mUnsignedAsHex; }
133 inline Okteta::ByteOrder PODDecoderTool::byteOrder() const { return mPODData.byteOrder(); }
134 inline Okteta::CharCodec* PODDecoderTool::charCodec() const { return mCharCodec; }
135 
136 }
137 
138 #endif
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
Kasten2::AbstractDifferentSizeDialog
Definition: abstractdifferentsizedialog.h:33
Kasten2::PODDecoderTool
Definition: poddecodertool.h:51
Okteta::PODData
Definition: poddata.h:34
QVector< Okteta::AbstractTypeCodec * >
Okteta::ByteOrder
ByteOrder
Definition: oktetacore.h:111
Okteta::CharCodec
Definition: charcodec.h:42
oktetacore.h
address.h
Kasten2::PODDecoderTool::charCodec
Okteta::CharCodec * charCodec() const
Definition: poddecodertool.h:134
poddata.h
Kasten2::PODDecoderTool::Aligned64Bit::Dummy
double Dummy
Definition: poddecodertool.h:58
Kasten2::PODDecoderTool::isUnsignedAsHex
bool isUnsignedAsHex() const
Definition: poddecodertool.h:132
oktetakastencontrollers_export.h
Kasten2::PODDecoderTool::byteOrder
Okteta::ByteOrder byteOrder() const
Definition: poddecodertool.h:133
Kasten2::AbstractTool
Definition: abstracttool.h:40
Kasten2::AbstractModel
Definition: abstractmodel.h:40
OKTETAKASTENCONTROLLERS_EXPORT
#define OKTETAKASTENCONTROLLERS_EXPORT
Definition: oktetakastencontrollers_export.h:36
Kasten2::PODDecoderTool::Aligned64Bit
Definition: poddecodertool.h:58
Kasten2::ByteArrayView
Definition: bytearrayview.h:51
Okteta::PODData::byteOrder
ByteOrder byteOrder() const
Definition: poddata.cpp:47
abstracttool.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:04:08 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