• 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
  • structures
  • datatypes
  • primitive
primitivedatainformation.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of the Okteta Kasten Framework, made within the KDE community.
3  *
4  * Copyright 2009, 2010, 2011, 2012 Alex Richardson <alex.richardson@gmx.de>
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 #include "primitivedatainformation.h"
23 #include "../datainformation.h"
24 #include "../topleveldatainformation.h"
25 #include "structviewpreferences.h"
26 
27 const QString PrimitiveDataInformation::hexPrefix = QLatin1String("0x");
28 const QString PrimitiveDataInformation::octalPrefix = QLatin1String("0o");
29 const QString PrimitiveDataInformation::binaryPrefix = QLatin1String("0b");
30 
31 Qt::ItemFlags PrimitiveDataInformation::flags(int column, bool fileLoaded) const
32 {
33  if (column == (int) DataInformation::ColumnValue && fileLoaded)
34  return Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable;
35  else
36  return Qt::ItemIsSelectable | Qt::ItemIsEnabled;
37 }
38 
39 // The inline destructor makes the compiler unhappy
40 PrimitiveDataInformation::~PrimitiveDataInformation()
41 {
42 }
43 
44 PrimitiveDataInformationWrapper::PrimitiveDataInformationWrapper(const PrimitiveDataInformationWrapper& d)
45  : PrimitiveDataInformation(d), mValue(d.mValue->clone())
46 {
47  mValue->setParent(this);
48 }
49 
50 PrimitiveDataInformationWrapper::PrimitiveDataInformationWrapper(const QString& name,
51  PrimitiveDataInformation* valueType, DataInformation* parent)
52  : PrimitiveDataInformation(name, parent), mValue(valueType)
53 {
54  Q_CHECK_PTR(valueType);
55  mValue->setParent(this);
56 
57 }
58 
59 QScriptValue PrimitiveDataInformationWrapper::valueAsQScriptValue() const
60 {
61  return mValue->valueAsQScriptValue();
62 }
63 
64 qint64 PrimitiveDataInformationWrapper::readData(Okteta::AbstractByteArrayModel* input,
65  Okteta::Address address, BitCount64 bitsRemaining, quint8* bitOffset)
66 {
67  Q_ASSERT(mHasBeenUpdated); //update must have been called prior to reading
68  mValue->mHasBeenUpdated = true; //value does not get updated
69  qint64 retVal = mValue->readData(input, address, bitsRemaining, bitOffset);
70  mWasAbleToRead = mValue->wasAbleToRead();
71  return retVal;
72 }
PrimitiveDataInformation::binaryPrefix
static const QString binaryPrefix
Definition: primitivedatainformation.h:58
DataInformation
Interface that must be implemented by all datatypes.
Definition: datainformation.h:67
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
BitCount64
quint64 BitCount64
Definition: datainformationbase.h:42
structviewpreferences.h
DataInformation::ColumnValue
Definition: datainformation.h:84
DataInformation::mWasAbleToRead
bool mWasAbleToRead
Definition: datainformation.h:243
PrimitiveDataInformationWrapper::valueAsQScriptValue
virtual QScriptValue valueAsQScriptValue() const
Definition: primitivedatainformation.cpp:59
DataInformation::mHasBeenUpdated
bool mHasBeenUpdated
Definition: datainformation.h:242
PrimitiveDataInformation::octalPrefix
static const QString octalPrefix
Definition: primitivedatainformation.h:59
PrimitiveDataInformationWrapper::mValue
QScopedPointer< PrimitiveDataInformation > mValue
Definition: primitivedatainformation.h:116
PrimitiveDataInformation::flags
virtual Qt::ItemFlags flags(int column, bool fileLoaded=true) const
Definition: primitivedatainformation.cpp:31
PrimitiveDataInformationWrapper::PrimitiveDataInformationWrapper
PrimitiveDataInformationWrapper(const PrimitiveDataInformationWrapper &d)
Definition: primitivedatainformation.cpp:44
PrimitiveDataInformation::~PrimitiveDataInformation
virtual ~PrimitiveDataInformation()
Definition: primitivedatainformation.cpp:40
PrimitiveDataInformationWrapper::readData
virtual qint64 readData(Okteta::AbstractByteArrayModel *input, Okteta::Address address, BitCount64 bitsRemaining, quint8 *bitOffset)
Reads the necessary data from input and returns the number of bytes read.
Definition: primitivedatainformation.cpp:64
PrimitiveDataInformationWrapper
A base class for data types which just wrap an underlying primitive data type.
Definition: primitivedatainformation.h:76
PrimitiveDataInformation::hexPrefix
static const QString hexPrefix
Definition: primitivedatainformation.h:60
PrimitiveDataInformation
A base class for all primitive data elements (e.g.
Definition: primitivedatainformation.h:34
primitivedatainformation.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