File indexing completed on 2024-06-30 05:51:25

0001 /*
0002     This file is part of the Okteta Kasten Framework, made within the KDE community.
0003 
0004     SPDX-FileCopyrightText: 2011, 2012 Alex Richardson <alex.richardson@gmx.de>
0005 
0006     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0007 */
0008 
0009 #ifndef KASTEN_PRIMITIVETEMPLATEINFO_HPP
0010 #define KASTEN_PRIMITIVETEMPLATEINFO_HPP
0011 
0012 #include "../primitivedatatype.hpp"
0013 #include "booldatainformation.hpp"
0014 #include "floatdatainformation.hpp"
0015 #include "doubledatainformation.hpp"
0016 #include "uintdatainformation.hpp"
0017 #include "sintdatainformation.hpp"
0018 #include "chardatainformation.hpp"
0019 #include "basicprimitivedatainformation.hpp"
0020 
0021 using UInt8DataInformation =  BasicPrimitiveDataInformation<quint8,  UIntDataInformationMethods<quint8>>;
0022 using UInt16DataInformation = BasicPrimitiveDataInformation<quint16, UIntDataInformationMethods<quint16>>;
0023 using UInt32DataInformation = BasicPrimitiveDataInformation<quint32, UIntDataInformationMethods<quint32>>;
0024 using UInt64DataInformation = BasicPrimitiveDataInformation<quint64, UIntDataInformationMethods<quint64>>;
0025 
0026 using SInt8DataInformation =  BasicPrimitiveDataInformation<qint8,  SIntDataInformationMethods<qint8>>;
0027 using SInt16DataInformation = BasicPrimitiveDataInformation<qint16, SIntDataInformationMethods<qint16>>;
0028 using SInt32DataInformation = BasicPrimitiveDataInformation<qint32, SIntDataInformationMethods<qint32>>;
0029 using SInt64DataInformation = BasicPrimitiveDataInformation<qint64, SIntDataInformationMethods<qint64>>;
0030 
0031 using Bool8DataInformation =  BasicPrimitiveDataInformation<quint8,  BoolDataInformationMethods<quint8>>;
0032 using Bool16DataInformation = BasicPrimitiveDataInformation<quint16, BoolDataInformationMethods<quint16>>;
0033 using Bool32DataInformation = BasicPrimitiveDataInformation<quint32, BoolDataInformationMethods<quint32>>;
0034 using Bool64DataInformation = BasicPrimitiveDataInformation<quint64, BoolDataInformationMethods<quint64>>;
0035 
0036 using CharDataInformation =   BasicPrimitiveDataInformation<quint8, CharDataInformationMethods>;
0037 using FloatDataInformation =  BasicPrimitiveDataInformation<float,  FloatDataInformationMethods>;
0038 using DoubleDataInformation = BasicPrimitiveDataInformation<double, DoubleDataInformationMethods>;
0039 
0040 // just to simplify usage of those classes (no need to specify two template parameters)
0041 template <PrimitiveDataType T> struct PrimitiveInfo
0042 {
0043     using valueType = void;
0044     using Class =     void; // to cause compiler errors with e.g. PrimitiveDataType::NotPrimitive
0045     using Methods =   void; // to cause compiler errors with e.g. PrimitiveDataType::NotPrimitive
0046 };
0047 
0048 template <> struct PrimitiveInfo<PrimitiveDataType::Bool8>
0049 {
0050     using valueType = quint8;
0051     using Class =     Bool8DataInformation;
0052     using Methods =   BoolDataInformationMethods<valueType>;
0053 };
0054 template <> struct PrimitiveInfo<PrimitiveDataType::Bool16>
0055 {
0056     using valueType = quint16;
0057     using Class =     Bool16DataInformation;
0058     using Methods =   BoolDataInformationMethods<valueType>;
0059 };
0060 template <> struct PrimitiveInfo<PrimitiveDataType::Bool32>
0061 {
0062     using valueType = quint32;
0063     using Class =     Bool32DataInformation;
0064     using Methods =   BoolDataInformationMethods<valueType>;
0065 };
0066 template <> struct PrimitiveInfo<PrimitiveDataType::Bool64>
0067 {
0068     using valueType = quint64;
0069     using Class =     Bool64DataInformation;
0070     using Methods =   BoolDataInformationMethods<valueType>;
0071 };
0072 
0073 template <> struct PrimitiveInfo<PrimitiveDataType::UInt8>
0074 {
0075     using valueType = quint8;
0076     using Class =     UInt8DataInformation;
0077     using Methods =   UIntDataInformationMethods<valueType>;
0078 };
0079 template <> struct PrimitiveInfo<PrimitiveDataType::UInt16>
0080 {
0081     using valueType = quint16;
0082     using Class =     UInt16DataInformation;
0083     using Methods =   UIntDataInformationMethods<valueType>;
0084 };
0085 template <> struct PrimitiveInfo<PrimitiveDataType::UInt32>
0086 {
0087     using valueType = quint32;
0088     using Class =     UInt32DataInformation;
0089     using Methods =   UIntDataInformationMethods<valueType>;
0090 };
0091 template <> struct PrimitiveInfo<PrimitiveDataType::UInt64>
0092 {
0093     using valueType = quint64;
0094     using Class =     UInt64DataInformation;
0095     using Methods =   UIntDataInformationMethods<valueType>;
0096 };
0097 
0098 template <> struct PrimitiveInfo<PrimitiveDataType::Int8>
0099 {
0100     using valueType = qint8;
0101     using Class =     SInt8DataInformation;
0102     using Methods =   SIntDataInformationMethods<valueType>;
0103 };
0104 template <> struct PrimitiveInfo<PrimitiveDataType::Int16>
0105 {
0106     using valueType = qint16;
0107     using Class =     SInt16DataInformation;
0108     using Methods =   SIntDataInformationMethods<valueType>;
0109 };
0110 template <> struct PrimitiveInfo<PrimitiveDataType::Int32>
0111 {
0112     using valueType = qint32;
0113     using Class =     SInt32DataInformation;
0114     using Methods =   SIntDataInformationMethods<valueType>;
0115 };
0116 template <> struct PrimitiveInfo<PrimitiveDataType::Int64>
0117 {
0118     using valueType = qint64;
0119     using Class =     SInt64DataInformation;
0120     using Methods =   SIntDataInformationMethods<valueType>;
0121 };
0122 
0123 template <> struct PrimitiveInfo<PrimitiveDataType::Char>
0124 {
0125     using valueType = quint8;
0126     using Class =     CharDataInformation;
0127     using Methods =   CharDataInformationMethods;
0128 };
0129 template <> struct PrimitiveInfo<PrimitiveDataType::Float>
0130 {
0131     using valueType = float;
0132     using Class =     FloatDataInformation;
0133     using Methods =   FloatDataInformationMethods;
0134 };
0135 template <> struct PrimitiveInfo<PrimitiveDataType::Double>
0136 {
0137     using valueType = double;
0138     using Class =     DoubleDataInformation;
0139     using Methods =   DoubleDataInformationMethods;
0140 };
0141 
0142 #endif // KASTEN_PRIMITIVETEMPLATEINFO_HPP