Merged master 8748
This commit is contained in:
@@ -1,96 +0,0 @@
|
||||
#include "IARURegions.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <QString>
|
||||
#include <QVariant>
|
||||
#include <QModelIndex>
|
||||
#include <QMetaType>
|
||||
|
||||
#include "moc_IARURegions.cpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
// human readable strings for each Region enumeration value
|
||||
char const * const region_names[] =
|
||||
{
|
||||
"All",
|
||||
"Region 1",
|
||||
"Region 2",
|
||||
"Region 3",
|
||||
};
|
||||
std::size_t constexpr region_names_size = sizeof (region_names) / sizeof (region_names[0]);
|
||||
}
|
||||
|
||||
IARURegions::IARURegions (QObject * parent)
|
||||
: QAbstractListModel {parent}
|
||||
{
|
||||
static_assert (region_names_size == SENTINAL,
|
||||
"region_names array must match Region enumeration");
|
||||
}
|
||||
|
||||
char const * IARURegions::name (Region r)
|
||||
{
|
||||
return region_names[static_cast<int> (r)];
|
||||
}
|
||||
|
||||
auto IARURegions::value (int r) -> Region
|
||||
{
|
||||
if (r < 0 || r + 1 >= SENTINAL) return ALL;
|
||||
return static_cast<Region> (r);
|
||||
}
|
||||
|
||||
QVariant IARURegions::data (QModelIndex const& index, int role) const
|
||||
{
|
||||
QVariant item;
|
||||
|
||||
if (index.isValid ())
|
||||
{
|
||||
auto const& row = index.row ();
|
||||
switch (role)
|
||||
{
|
||||
case Qt::ToolTipRole:
|
||||
case Qt::AccessibleDescriptionRole:
|
||||
item = tr ("IARU Region");
|
||||
break;
|
||||
|
||||
case Qt::EditRole:
|
||||
item = static_cast<Region> (row);
|
||||
break;
|
||||
|
||||
case Qt::DisplayRole:
|
||||
case Qt::AccessibleTextRole:
|
||||
item = region_names[row];
|
||||
break;
|
||||
|
||||
case Qt::TextAlignmentRole:
|
||||
item = Qt::AlignHCenter + Qt::AlignVCenter;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
QVariant IARURegions::headerData (int section, Qt::Orientation orientation, int role) const
|
||||
{
|
||||
QVariant result;
|
||||
|
||||
if (Qt::DisplayRole == role && Qt::Horizontal == orientation)
|
||||
{
|
||||
result = tr ("IARU Region");
|
||||
}
|
||||
else
|
||||
{
|
||||
result = QAbstractListModel::headerData (section, orientation, role);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#if !defined (QT_NO_DEBUG_STREAM)
|
||||
ENUM_QDEBUG_OPS_IMPL (IARURegions, Region);
|
||||
#endif
|
||||
|
||||
ENUM_QDATASTREAM_OPS_IMPL (IARURegions, Region);
|
||||
ENUM_CONVERSION_OPS_IMPL (IARURegions, Region);
|
||||
@@ -0,0 +1,54 @@
|
||||
module crc
|
||||
use, intrinsic :: iso_c_binding, only: c_int, c_loc, c_int8_t, c_bool, c_short
|
||||
interface
|
||||
|
||||
function crc14 (data, length) bind (C, name="crc14")
|
||||
use, intrinsic :: iso_c_binding, only: c_short, c_ptr, c_int
|
||||
implicit none
|
||||
integer (c_short) :: crc14
|
||||
type (c_ptr), value :: data
|
||||
integer (c_int), value :: length
|
||||
end function crc14
|
||||
|
||||
function crc14_check (data, length) bind (C, name="crc16_check")
|
||||
use, intrinsic :: iso_c_binding, only: c_bool, c_ptr, c_int
|
||||
implicit none
|
||||
logical (c_bool) :: crc14_check
|
||||
type (c_ptr), value :: data
|
||||
integer (c_int), value :: length
|
||||
end function crc14_check
|
||||
|
||||
function crc12 (data, length) bind (C, name="crc12")
|
||||
use, intrinsic :: iso_c_binding, only: c_short, c_ptr, c_int
|
||||
implicit none
|
||||
integer (c_short) :: crc12
|
||||
type (c_ptr), value :: data
|
||||
integer (c_int), value :: length
|
||||
end function crc12
|
||||
|
||||
function crc12_check (data, length) bind (C, name="crc12_check")
|
||||
use, intrinsic :: iso_c_binding, only: c_bool, c_ptr, c_int
|
||||
implicit none
|
||||
logical (c_bool) :: crc12_check
|
||||
type (c_ptr), value :: data
|
||||
integer (c_int), value :: length
|
||||
end function crc12_check
|
||||
|
||||
function crc10 (data, length) bind (C, name="crc10")
|
||||
use, intrinsic :: iso_c_binding, only: c_short, c_ptr, c_int
|
||||
implicit none
|
||||
integer (c_short) :: crc10
|
||||
type (c_ptr), value :: data
|
||||
integer (c_int), value :: length
|
||||
end function crc10
|
||||
|
||||
function crc10_check (data, length) bind (C, name="crc10_check")
|
||||
use, intrinsic :: iso_c_binding, only: c_bool, c_ptr, c_int
|
||||
implicit none
|
||||
logical (c_bool) :: crc10_check
|
||||
type (c_ptr), value :: data
|
||||
integer (c_int), value :: length
|
||||
end function crc10_check
|
||||
|
||||
end interface
|
||||
end module crc
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.7 KiB |
Reference in New Issue
Block a user