• 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
uintdatainformation.h
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 2011 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 #ifndef UINTDATAINFORMATION_H
23 #define UINTDATAINFORMATION_H
24 
25 #include "primitivedatainformation.h"
26 #include "structviewpreferences.h"
27 
28 template<typename T>
29 class UIntDataInformationMethods
30 {
31 public:
32  static QScriptValue asScriptValue(T value, QScriptEngine* engine, ScriptHandlerInfo* handler);
33  static QString staticValueString(T val, int base = Kasten2::StructViewPreferences::unsignedDisplayBase());
34  static PrimitiveDataType staticType();
35  static T fromVariant(const QVariant& value, bool* ok);
36 
37  static QWidget* staticCreateEditWidget(QWidget* parent);
38  static QVariant staticDataFromWidget(const QWidget* w);
39  static void staticSetWidgetData(T value, QWidget* w);
40 };
41 
42 template<>
43 inline PrimitiveDataType UIntDataInformationMethods<quint8>::staticType() { return Type_UInt8; }
44 template<>
45 inline PrimitiveDataType UIntDataInformationMethods<quint16>::staticType() { return Type_UInt16; }
46 template<>
47 inline PrimitiveDataType UIntDataInformationMethods<quint32>::staticType() { return Type_UInt32; }
48 template<>
49 inline PrimitiveDataType UIntDataInformationMethods<quint64>::staticType() { return Type_UInt64; }
50 
51 template<typename T>
52 inline T UIntDataInformationMethods<T>::fromVariant(const QVariant& value, bool* ok)
53 {
54  Q_CHECK_PTR(ok);
55  quint64 val = value.toULongLong(ok);
56  T result = T(val);
57  if (val != quint64(result))
58  *ok = false;
59  return result;
60 }
61 
62 #endif // UINTDATAINFORMATION_H
UIntDataInformationMethods::staticDataFromWidget
static QVariant staticDataFromWidget(const QWidget *w)
Definition: uintdatainformation.cpp:79
UIntDataInformationMethods::asScriptValue
static QScriptValue asScriptValue(T value, QScriptEngine *engine, ScriptHandlerInfo *handler)
Definition: uintdatainformation.cpp:34
QWidget
structviewpreferences.h
Type_UInt32
Definition: primitivedatatype.h:42
PrimitiveDataType
Definition: primitivedatatype.h:54
Type_UInt16
Definition: primitivedatatype.h:39
Type_UInt64
Definition: primitivedatatype.h:45
UIntDataInformationMethods::staticValueString
static QString staticValueString(T val, int base=Kasten2::StructViewPreferences::unsignedDisplayBase())
Definition: uintdatainformation.cpp:51
UIntDataInformationMethods::staticSetWidgetData
static void staticSetWidgetData(T value, QWidget *w)
Definition: uintdatainformation.cpp:90
UIntDataInformationMethods::fromVariant
static T fromVariant(const QVariant &value, bool *ok)
Definition: uintdatainformation.h:52
UIntDataInformationMethods::staticType
static PrimitiveDataType staticType()
UIntDataInformationMethods
Definition: uintdatainformation.h:29
ScriptHandlerInfo
Definition: scripthandlerinfo.h:39
UIntDataInformationMethods::staticCreateEditWidget
static QWidget * staticCreateEditWidget(QWidget *parent)
Definition: uintdatainformation.cpp:71
Type_UInt8
Definition: primitivedatatype.h:35
primitivedatainformation.h
Kasten2::StructViewPreferences::unsignedDisplayBase
static int unsignedDisplayBase()
Get UnsignedDisplayBase.
Definition: structviewpreferences.h:34
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