odbus/Types: use using instead of typedef

This commit is contained in:
Max Kellermann 2020-10-23 11:46:26 +02:00 committed by Max Kellermann
parent 0c28d8dcbe
commit fc01d11b8d

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2007-2017 Content Management AG * Copyright 2007-2020 CM4all GmbH
* All rights reserved. * All rights reserved.
* *
* author: Max Kellermann <mk@cm4all.com> * author: Max Kellermann <mk@cm4all.com>
@ -42,7 +42,7 @@ namespace ODBus {
template<int type> template<int type>
struct BasicTypeTraits { struct BasicTypeTraits {
static constexpr int TYPE = type; static constexpr int TYPE = type;
typedef TemplateString::CharAsString<TYPE> TypeAsString; using TypeAsString = TemplateString::CharAsString<TYPE>;
}; };
template<typename T> template<typename T>
@ -70,20 +70,23 @@ using BooleanTypeTraits = BasicTypeTraits<DBUS_TYPE_BOOLEAN>;
template<typename T> template<typename T>
struct ArrayTypeTraits { struct ArrayTypeTraits {
typedef T ContainedTraits; using ContainedTraits = T;
static constexpr int TYPE = DBUS_TYPE_ARRAY; static constexpr int TYPE = DBUS_TYPE_ARRAY;
typedef TemplateString::InsertBefore<TYPE, typename ContainedTraits::TypeAsString> TypeAsString; using TypeAsString =
TemplateString::InsertBefore<TYPE,
typename ContainedTraits::TypeAsString>;
}; };
template<typename KeyT, typename ValueT> template<typename KeyT, typename ValueT>
struct DictEntryTypeTraits { struct DictEntryTypeTraits {
static constexpr int TYPE = DBUS_TYPE_DICT_ENTRY; static constexpr int TYPE = DBUS_TYPE_DICT_ENTRY;
typedef TemplateString::Concat<TemplateString::CharAsString<DBUS_DICT_ENTRY_BEGIN_CHAR>, using TypeAsString =
TemplateString::Concat<TemplateString::CharAsString<DBUS_DICT_ENTRY_BEGIN_CHAR>,
typename KeyT::TypeAsString, typename KeyT::TypeAsString,
typename ValueT::TypeAsString, typename ValueT::TypeAsString,
TemplateString::CharAsString<DBUS_DICT_ENTRY_END_CHAR>> TypeAsString; TemplateString::CharAsString<DBUS_DICT_ENTRY_END_CHAR>>;
}; };
using VariantTypeTraits = BasicTypeTraits<DBUS_TYPE_VARIANT>; using VariantTypeTraits = BasicTypeTraits<DBUS_TYPE_VARIANT>;
@ -103,9 +106,10 @@ template<typename... ContainedTraits>
struct StructTypeTraits { struct StructTypeTraits {
static constexpr int TYPE = DBUS_TYPE_STRUCT; static constexpr int TYPE = DBUS_TYPE_STRUCT;
typedef TemplateString::Concat<TemplateString::CharAsString<DBUS_STRUCT_BEGIN_CHAR>, using TypeAsString =
TemplateString::Concat<TemplateString::CharAsString<DBUS_STRUCT_BEGIN_CHAR>,
ConcatTypeAsString<ContainedTraits...>, ConcatTypeAsString<ContainedTraits...>,
TemplateString::CharAsString<DBUS_STRUCT_END_CHAR>> TypeAsString; TemplateString::CharAsString<DBUS_STRUCT_END_CHAR>>;
}; };
} /* namespace ODBus */ } /* namespace ODBus */