sandbox
Loading...
Searching...
No Matches
tag.hpp
1// SPDX-License-Identifier: MIT
2#ifndef LIBSBX_SCENES_COMPONENTS_TAG_HPP_
3#define LIBSBX_SCENES_COMPONENTS_TAG_HPP_
4
5#include <string>
6
7#include <libsbx/utility/hashed_string.hpp>
8
9namespace sbx::scenes {
10
11template<typename Char>
12class basic_tag final : public utility::basic_hashed_string<Char> {
13
15
16public:
17
18 template<typename... Args>
19 basic_tag(Args&&... args)
20 : base{std::forward<Args>(args)...} { }
21
22}; // class tag
23
24using tag = basic_tag<char>;
25
26} // namespace sbx::scenes
27
28template<typename Char>
29struct fmt::formatter<sbx::scenes::basic_tag<Char>> : fmt::formatter<sbx::utility::basic_hashed_string<Char>> {
30
31 template<typename ParseContext>
32 constexpr auto parse(ParseContext& ctx) -> decltype(ctx.begin()) {
33 return ctx.begin();
34 }
35
36 template<typename FormatContext>
37 auto format(const sbx::scenes::basic_tag<Char>& tag, FormatContext& ctx) const -> decltype(ctx.out()) {
38 return fmt::format_to(ctx.out(), "{}", tag.c_str());
39 }
40
41}; // struct fmt::formatter
42
43#endif // LIBSBX_SCENES_COMPONENTS_TAG_HPP_
Definition: tag.hpp:12
Definition: hashed_string.hpp:17