• 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
primitivedatatype.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 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 "primitivedatatype.h"
23 #include "structviewpreferences.h"
24 
25 #include <KLocalizedString>
26 #include <QDebug>
27 
28 static const char* longTypeNames[Type_END + 1] =
29  {
30  I18N_NOOP2("data type", "bool (1 byte)"),
31  I18N_NOOP2("data type", "signed byte"),
32  I18N_NOOP2("data type", "unsigned byte"),
33  I18N_NOOP2("data type", "char"),
34  I18N_NOOP2("data type", "bool (2 bytes)"),
35  I18N_NOOP2("data type", "signed short"),
36  I18N_NOOP2("data type", "unsigned short"),
37  I18N_NOOP2("data type", "bool (4 bytes)"),
38  I18N_NOOP2("data type", "signed int"),
39  I18N_NOOP2("data type", "unsigned int"),
40  I18N_NOOP2("data type", "bool (8 bytes)"),
41  I18N_NOOP2("data type", "signed long"),
42  I18N_NOOP2("data type", "unsigned long"),
43  I18N_NOOP2("data type", "float"),
44  I18N_NOOP2("data type", "double"),
45  I18N_NOOP2("data type", "bitfield"),
46  };
47 
48 static const char* typeNames[Type_END + 1] =
49  {
50  "bool8",
51  "int8",
52  "uint8",
53  "char",
54  "bool16",
55  "int16",
56  "uint16",
57  "bool32",
58  "int32",
59  "uint32",
60  "bool64",
61  "int64",
62  "uint64",
63  "float",
64  "double",
65  "bitfield",
66  };
67 
68 QString PrimitiveType::typeName(PrimitiveDataType type)
69 {
70  if (Kasten2::StructViewPreferences::shortTypeNames())
71  return standardTypeName(type);
72  else
73  return longTypeName(type);
74 }
75 
76 QString PrimitiveType::standardTypeName(PrimitiveDataType type_)
77 {
78  PrimitiveDataTypeEnum type = type_.value;
79  if (type >= Type_START && type <= Type_END)
80  return QLatin1String(typeNames[type]);
81  else
82  return QLatin1String("invalid");
83 }
84 
85 QString PrimitiveType::longTypeName(PrimitiveDataType type_)
86 {
87  PrimitiveDataTypeEnum type = type_.value;
88  if (type >= Type_START && type <= Type_END)
89  return i18n(longTypeNames[type]);
90  else
91  return i18n("invalid type");
92 }
93 
94 QDebug operator<<(QDebug dbg, PrimitiveDataType type)
95 {
96  dbg.nospace() << "primitive type(" << PrimitiveType::standardTypeName(type) << ")";
97  return dbg.space();
98 }
99 
PrimitiveType::typeName
QString typeName(PrimitiveDataType type)
Definition: primitivedatatype.cpp:68
PrimitiveType::longTypeName
QString longTypeName(PrimitiveDataType type)
Definition: primitivedatatype.cpp:85
Type_END
Definition: primitivedatatype.h:49
structviewpreferences.h
PrimitiveDataType
Definition: primitivedatatype.h:54
Kasten2::StructViewPreferences::shortTypeNames
static bool shortTypeNames()
Get ShortTypeNames.
Definition: structviewpreferences.h:169
operator<<
QDebug operator<<(QDebug dbg, PrimitiveDataType type)
Definition: primitivedatatype.cpp:94
typeNames
static const char * typeNames[Type_END+1]
Definition: primitivedatatype.cpp:48
longTypeNames
static const char * longTypeNames[Type_END+1]
Definition: primitivedatatype.cpp:28
PrimitiveType::standardTypeName
QString standardTypeName(PrimitiveDataType type)
Definition: primitivedatatype.cpp:76
PrimitiveDataTypeEnum
PrimitiveDataTypeEnum
Definition: primitivedatatype.h:28
primitivedatatype.h
Type_START
Definition: primitivedatatype.h:32
PrimitiveDataType::value
PrimitiveDataTypeEnum value
Definition: primitivedatatype.h:56
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