MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / value

Class value

extlibs/fmt/include/fmt/core.h:837–900  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

835
836// A formatting argument value.
837template <typename Context> class value {
838 public:
839 using char_type = typename Context::char_type;
840
841 union {
842 int int_value;
843 unsigned uint_value;
844 long long long_long_value;
845 unsigned long long ulong_long_value;
846 int128_t int128_value;
847 uint128_t uint128_value;
848 bool bool_value;
849 char_type char_value;
850 float float_value;
851 double double_value;
852 long double long_double_value;
853 const void* pointer;
854 string_value<char_type> string;
855 custom_value<Context> custom;
856 const named_arg_base<char_type>* named_arg;
857 };
858
859 FMT_CONSTEXPR value(int val = 0) : int_value(val) {}
860 FMT_CONSTEXPR value(unsigned val) : uint_value(val) {}
861 value(long long val) : long_long_value(val) {}
862 value(unsigned long long val) : ulong_long_value(val) {}
863 value(int128_t val) : int128_value(val) {}
864 value(uint128_t val) : uint128_value(val) {}
865 value(float val) : float_value(val) {}
866 value(double val) : double_value(val) {}
867 value(long double val) : long_double_value(val) {}
868 value(bool val) : bool_value(val) {}
869 value(char_type val) : char_value(val) {}
870 value(const char_type* val) { string.data = val; }
871 value(basic_string_view<char_type> val) {
872 string.data = val.data();
873 string.size = val.size();
874 }
875 value(const void* val) : pointer(val) {}
876
877 template <typename T> value(const T& val) {
878 custom.value = &val;
879 // Get the formatter type through the context to allow different contexts
880 // have different extension points, e.g. `formatter<T>` for `format` and
881 // `printf_formatter<T>` for `printf`.
882 custom.format = format_custom_arg<
883 T, conditional_t<has_formatter<T, Context>::value,
884 typename Context::template formatter_type<T>,
885 fallback_formatter<T, char_type>>>;
886 }
887
888 value(const named_arg_base<char_type>& val) { named_arg = &val; }
889
890 private:
891 // Formats an argument of a custom type, such as a user-defined class.
892 template <typename T, typename Formatter>
893 static void format_custom_arg(
894 const void* arg, basic_format_parse_context<char_type>& parse_ctx,

Callers 5

sol.hppFile · 0.50
emplaceFunction · 0.50
as_container_t<T&>Class · 0.50
property_wrapperClass · 0.50
readonly_wrapperClass · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected