2
0
mirror of https://github.com/boostorg/gil.git synced 2026-02-27 17:12:10 +00:00

Apply clang-tidy modernize-use-using to all tests (#199)

Run clang-tidy 7.0 with `-checks='-*,modernize-use-using' -fix`
against TU-s of all tests.

Manually refactor numerous typedef-s
- where missed by modernize-use-using check, not uncommon
- in code snippets in comments

Outcome is that searching for lower-case whole word typedef
in sources of all the tests should return no matches.
This commit is contained in:
Mateusz Loskot
2018-12-18 00:13:39 +01:00
committed by GitHub
parent 149b4c8605
commit bf67e796c6
57 changed files with 495 additions and 481 deletions

View File

@@ -42,8 +42,8 @@ auto c32f_max = channel_traits<float32_t>::max_value();
template <typename ChannelTestCore>
struct do_test : public ChannelTestCore {
typedef typename ChannelTestCore::channel_t channel_t;
typedef typename channel_traits<channel_t>::value_type channel_value_t;
using channel_t = typename ChannelTestCore::channel_t;
using channel_value_t = typename channel_traits<channel_t>::value_type;
do_test() : ChannelTestCore() {
error_if(this->_min_v != channel_traits<channel_t>::min_value());
@@ -158,23 +158,34 @@ struct do_test : public ChannelTestCore {
template <typename ChannelValue>
class value_core {
protected:
typedef ChannelValue channel_t;
channel_t _min_v, _max_v;
using channel_t = ChannelValue;
channel_t _min_v;
channel_t _max_v;
value_core() : _min_v(channel_traits<ChannelValue>::min_value()), _max_v(channel_traits<ChannelValue>::max_value()) {
value_core()
: _min_v(channel_traits<ChannelValue>::min_value())
, _max_v(channel_traits<ChannelValue>::max_value())
{
boost::function_requires<ChannelValueConcept<ChannelValue> >();
}
};
// For channel references we need to have separate channel values
template <typename ChannelRef>
class reference_core : public value_core<typename channel_traits<ChannelRef>::value_type> {
typedef value_core<typename channel_traits<ChannelRef>::value_type> parent_t;
protected:
typedef ChannelRef channel_t;
channel_t _min_v, _max_v;
class reference_core : public value_core<typename channel_traits<ChannelRef>::value_type>
{
using parent_t = value_core<typename channel_traits<ChannelRef>::value_type>;
reference_core() : parent_t(), _min_v(parent_t::_min_v), _max_v(parent_t::_max_v) {
protected:
using channel_t = ChannelRef;
channel_t _min_v;
channel_t _max_v;
reference_core()
: parent_t()
, _min_v(parent_t::_min_v)
, _max_v(parent_t::_max_v)
{
boost::function_requires<ChannelConcept<ChannelRef> >();
}
};
@@ -183,8 +194,8 @@ protected:
template <typename ChannelSubbyteRef, typename ChannelMutableRef = ChannelSubbyteRef>
class packed_reference_core {
protected:
typedef ChannelSubbyteRef channel_t;
typedef typename channel_t::integer_t integer_t;
using channel_t = ChannelSubbyteRef;
using integer_t = typename channel_t::integer_t;
channel_t _min_v, _max_v;
integer_t _min_buf, _max_buf;
@@ -201,7 +212,7 @@ protected:
template <typename ChannelSubbyteRef, typename ChannelMutableRef = ChannelSubbyteRef>
class packed_dynamic_reference_core {
protected:
typedef ChannelSubbyteRef channel_t;
using channel_t = ChannelSubbyteRef;
channel_t _min_v, _max_v;
typename channel_t::integer_t _min_buf, _max_buf;
@@ -280,11 +291,11 @@ struct channel_archetype {
template <typename Scalar> channel_archetype operator*=(Scalar) { return *this; }
template <typename Scalar> channel_archetype operator/=(Scalar) { return *this; }
typedef channel_value_archetype value_type;
typedef channel_archetype reference;
typedef const channel_archetype const_reference;
typedef channel_value_archetype* pointer;
typedef const channel_value_archetype* const_pointer;
using value_type = channel_value_archetype;
using reference = channel_archetype;
using const_reference = channel_archetype const;
using pointer = channel_value_archetype *;
using const_pointer = channel_value_archetype const*;
BOOST_STATIC_CONSTANT(bool, is_mutable=true);
static value_type min_value();
@@ -303,10 +314,11 @@ channel_value_archetype channel_archetype::min_value() { return channel_value_ar
channel_value_archetype channel_archetype::max_value() { return channel_value_archetype(); }
void test_packed_channel_reference() {
typedef packed_channel_reference<std::uint16_t, 0,5,true> channel16_0_5_reference_t;
typedef packed_channel_reference<std::uint16_t, 5,6,true> channel16_5_6_reference_t;
typedef packed_channel_reference<std::uint16_t, 11,5,true> channel16_11_5_reference_t;
void test_packed_channel_reference()
{
using channel16_0_5_reference_t = packed_channel_reference<std::uint16_t, 0, 5, true>;
using channel16_5_6_reference_t = packed_channel_reference<std::uint16_t, 5, 6, true>;
using channel16_11_5_reference_t = packed_channel_reference<std::uint16_t, 11, 5, true>;
std::uint16_t data=0;
channel16_0_5_reference_t channel1(&data);
@@ -323,9 +335,10 @@ void test_packed_channel_reference() {
test_packed_channel_reference<channel16_11_5_reference_t>();
}
void test_packed_dynamic_channel_reference() {
typedef packed_dynamic_channel_reference<std::uint16_t,5,true> channel16_5_reference_t;
typedef packed_dynamic_channel_reference<std::uint16_t,6,true> channel16_6_reference_t;
void test_packed_dynamic_channel_reference()
{
using channel16_5_reference_t = packed_dynamic_channel_reference<std::uint16_t, 5, true>;
using channel16_6_reference_t = packed_dynamic_channel_reference<std::uint16_t, 6, true>;
std::uint16_t data=0;
channel16_5_reference_t channel1(&data,0);