• 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
  • core
fixedsizebytearraymodel.h
Go to the documentation of this file.
1 /*
2  This file is part of the Okteta Core library, made within the KDE community.
3 
4  Copyright 2003 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_FIXEDSIZEBYTEARRAYMODEL_H
24 #define OKTETA_FIXEDSIZEBYTEARRAYMODEL_H
25 
26 // lib
27 #include "abstractbytearraymodel.h"
28 
29 
30 namespace Okteta
31 {
32 
39 class FixedSizeByteArrayModel : public AbstractByteArrayModel
40 {
41  public:
43  FixedSizeByteArrayModel( Byte* data, int size, Byte fillUpChar = '\0', QObject* parent = 0 );
45  explicit FixedSizeByteArrayModel( int size, Byte fillUpChar = '\0', QObject* parent = 0 );
46 
47  virtual ~FixedSizeByteArrayModel();
48 
49  public: // AbstractByteArrayModel API
50  virtual Byte byte( Address offset ) const;
51  virtual Size size() const;
52  virtual bool isReadOnly() const;
53  virtual bool isModified() const;
54 
55  virtual Size insert( Address offset, const Byte* insertData, int insertLength );
56  virtual Size remove( const AddressRange& removeRange );
57  virtual Size replace( const AddressRange& removeRange, const Byte* insertData, int insertLength );
58  virtual bool swap( Address firstStart, const AddressRange& secondRange );
59  virtual Size fill( Byte fillByte, Address offset = 0, Size fillLength = -1 );
60  virtual void setByte( Address offset, Byte byte );
61 
62  virtual void setModified( bool modified = true );
63  virtual void setReadOnly( bool readOnly = true );
64 
65  public:
66  int compare( const AbstractByteArrayModel& other, const AddressRange& otherRange, Address offset = 0 );
67  int compare( const AbstractByteArrayModel& other, Address otherOffset, Size otherLength, Address offset = 0 );
68  int compare( const AbstractByteArrayModel& other );
69 
70  public:
71  Byte* rawData() const;
72 
73  protected:
74  void reset( unsigned int pos, unsigned int length );
75 
76  protected:
78  Byte* mData;
79  /***/
80  int mSize;
82  Byte mFillUpByte;
84  bool mReadOnly :1;
86  bool mModified :1;
88  bool mAutoDelete :1;
89 };
90 
91 
92 inline Byte FixedSizeByteArrayModel::byte( Address offset ) const { return mData[offset]; }
93 inline Size FixedSizeByteArrayModel::size() const { return mSize; }
94 
95 inline bool FixedSizeByteArrayModel::isReadOnly() const { return mReadOnly; }
96 inline bool FixedSizeByteArrayModel::isModified() const { return mModified; }
97 
98 inline void FixedSizeByteArrayModel::setReadOnly( bool readOnly ) { mReadOnly = readOnly; }
99 inline void FixedSizeByteArrayModel::setModified( bool modified ) { mModified = modified; }
100 
101 inline int FixedSizeByteArrayModel::compare( const AbstractByteArrayModel& other )
102 { return compare( other, AddressRange::fromWidth(0,other.size()), 0 ); }
103 
104 inline int FixedSizeByteArrayModel::compare( const AbstractByteArrayModel& other, Address otherOffset, Size otherLength, Address offset )
105 { return compare( other, AddressRange::fromWidth(otherOffset,otherLength), offset ); }
106 
107 inline Byte* FixedSizeByteArrayModel::rawData() const { return mData; }
108 
109 }
110 
111 #endif
Okteta::FixedSizeByteArrayModel::compare
int compare(const AbstractByteArrayModel &other, const AddressRange &otherRange, Address offset=0)
Definition: fixedsizebytearraymodel.cpp:275
Okteta::FixedSizeByteArrayModel::reset
void reset(unsigned int pos, unsigned int length)
Definition: fixedsizebytearraymodel.cpp:327
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
Okteta::FixedSizeByteArrayModel::swap
virtual bool swap(Address firstStart, const AddressRange &secondRange)
moves the second section before the start of the first which is the same as moving the first behind t...
Definition: fixedsizebytearraymodel.cpp:173
abstractbytearraymodel.h
Okteta::FixedSizeByteArrayModel::fill
virtual Size fill(Byte fillByte, Address offset=0, Size fillLength=-1)
fills the buffer with the FillChar.
Definition: fixedsizebytearraymodel.cpp:251
Okteta::FixedSizeByteArrayModel::insert
virtual Size insert(Address offset, const Byte *insertData, int insertLength)
inserts bytes copied from the given source at Position.
Definition: fixedsizebytearraymodel.cpp:72
Okteta::FixedSizeByteArrayModel
base class for all mData buffers that are used to display TODO: think about a way to inform KHexEdit ...
Definition: fixedsizebytearraymodel.h:39
KDE::NumberRange< Address, Size >
Okteta::Byte
unsigned char Byte
Definition: byte.h:29
Okteta::FixedSizeByteArrayModel::mModified
bool mModified
Definition: fixedsizebytearraymodel.h:86
QObject
Okteta::FixedSizeByteArrayModel::FixedSizeByteArrayModel
FixedSizeByteArrayModel(Byte *data, int size, Byte fillUpChar= '\0', QObject *parent=0)
creates a readonly buffer around the given data
Definition: fixedsizebytearraymodel.cpp:34
Okteta::FixedSizeByteArrayModel::mReadOnly
bool mReadOnly
Definition: fixedsizebytearraymodel.h:84
Okteta::AbstractByteArrayModel::size
virtual Size size() const =0
Okteta::FixedSizeByteArrayModel::mSize
int mSize
Definition: fixedsizebytearraymodel.h:80
Okteta::FixedSizeByteArrayModel::replace
virtual Size replace(const AddressRange &removeRange, const Byte *insertData, int insertLength)
replaces as much as possible
Definition: fixedsizebytearraymodel.cpp:128
Okteta::FixedSizeByteArrayModel::byte
virtual Byte byte(Address offset) const
locates working range The idea behind is to tell buffer which range will be requested in the followin...
Definition: fixedsizebytearraymodel.h:92
KDE::NumberRange< Address, Size >::fromWidth
static NumberRange fromWidth(AddressstartIndex, Sizewidth)
constructs a range by width
Okteta::FixedSizeByteArrayModel::setReadOnly
virtual void setReadOnly(bool readOnly=true)
sets the readonly flag for the byte array if this is possible.
Definition: fixedsizebytearraymodel.h:98
Okteta::FixedSizeByteArrayModel::setModified
virtual void setModified(bool modified=true)
sets the modified flag for the buffer
Definition: fixedsizebytearraymodel.h:99
Okteta::FixedSizeByteArrayModel::mFillUpByte
Byte mFillUpByte
Definition: fixedsizebytearraymodel.h:82
Okteta::FixedSizeByteArrayModel::rawData
Byte * rawData() const
Definition: fixedsizebytearraymodel.h:107
Okteta::FixedSizeByteArrayModel::setByte
virtual void setByte(Address offset, Byte byte)
sets a single byte if the offset is not valid the behaviour is undefined
Definition: fixedsizebytearraymodel.cpp:58
Okteta::FixedSizeByteArrayModel::isReadOnly
virtual bool isReadOnly() const
Default returns true.
Definition: fixedsizebytearraymodel.h:95
Okteta::Size
qint32 Size
Definition: size.h:33
Okteta::FixedSizeByteArrayModel::~FixedSizeByteArrayModel
virtual ~FixedSizeByteArrayModel()
Definition: fixedsizebytearraymodel.cpp:333
Okteta::FixedSizeByteArrayModel::mAutoDelete
bool mAutoDelete
Definition: fixedsizebytearraymodel.h:88
Okteta::FixedSizeByteArrayModel::size
virtual Size size() const
Definition: fixedsizebytearraymodel.h:93
Okteta::FixedSizeByteArrayModel::mData
Byte * mData
Definition: fixedsizebytearraymodel.h:78
Okteta::FixedSizeByteArrayModel::isModified
virtual bool isModified() const
Definition: fixedsizebytearraymodel.h:96
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