util/TemplateString: rename CharAsString() to FromChar()

This commit is contained in:
Max Kellermann 2020-11-30 22:23:27 +01:00
parent 3af35aee9e
commit b47e0cffdd
2 changed files with 7 additions and 7 deletions

View File

@ -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;
static constexpr auto as_string = TemplateString::CharAsString(TYPE); static constexpr auto as_string = TemplateString::FromChar(TYPE);
}; };
template<typename T> template<typename T>
@ -74,7 +74,7 @@ struct ArrayTypeTraits {
static constexpr int TYPE = DBUS_TYPE_ARRAY; static constexpr int TYPE = DBUS_TYPE_ARRAY;
static constexpr auto as_string = static constexpr auto as_string =
TemplateString::Concat(TemplateString::CharAsString(TYPE), TemplateString::Concat(TemplateString::FromChar(TYPE),
ContainedTraits::as_string); ContainedTraits::as_string);
}; };
@ -83,10 +83,10 @@ struct DictEntryTypeTraits {
static constexpr int TYPE = DBUS_TYPE_DICT_ENTRY; static constexpr int TYPE = DBUS_TYPE_DICT_ENTRY;
static constexpr auto as_string = static constexpr auto as_string =
TemplateString::Concat(TemplateString::CharAsString(DBUS_DICT_ENTRY_BEGIN_CHAR), TemplateString::Concat(TemplateString::FromChar(DBUS_DICT_ENTRY_BEGIN_CHAR),
KeyT::as_string, KeyT::as_string,
ValueT::as_string, ValueT::as_string,
TemplateString::CharAsString(DBUS_DICT_ENTRY_END_CHAR)); TemplateString::FromChar(DBUS_DICT_ENTRY_END_CHAR));
}; };
using VariantTypeTraits = BasicTypeTraits<DBUS_TYPE_VARIANT>; using VariantTypeTraits = BasicTypeTraits<DBUS_TYPE_VARIANT>;
@ -111,9 +111,9 @@ struct StructTypeTraits {
static constexpr int TYPE = DBUS_TYPE_STRUCT; static constexpr int TYPE = DBUS_TYPE_STRUCT;
static constexpr auto as_string = static constexpr auto as_string =
TemplateString::Concat(TemplateString::CharAsString(DBUS_STRUCT_BEGIN_CHAR), TemplateString::Concat(TemplateString::FromChar(DBUS_STRUCT_BEGIN_CHAR),
ConcatTypeAsString<ContainedTraits...>::as_string, ConcatTypeAsString<ContainedTraits...>::as_string,
TemplateString::CharAsString(DBUS_STRUCT_END_CHAR)); TemplateString::FromChar(DBUS_STRUCT_END_CHAR));
}; };
} /* namespace ODBus */ } /* namespace ODBus */

View File

@ -63,7 +63,7 @@ Empty() noexcept
* A string consisting of a single character. * A string consisting of a single character.
*/ */
constexpr auto constexpr auto
CharAsString(char ch) noexcept FromChar(char ch) noexcept
{ {
Buffer<1> result{}; Buffer<1> result{};
result.value[0] = ch; result.value[0] = ch;