@@ -115,6 +115,16 @@ namespace cppwinrt
115115 }
116116 }
117117
118+ [[nodiscard]] static finish_with wrap_ifdef (writer& w, std::string_view macro)
119+ {
120+ auto format = R"( #ifdef %
121+ )" ;
122+
123+ w.write (format, macro);
124+
125+ return { w, write_endif };
126+ }
127+
118128 static void write_parent_depends (writer& w, cache const & c, std::string_view const & type_namespace)
119129 {
120130 auto pos = type_namespace.rfind (' .' );
@@ -3216,6 +3226,18 @@ struct __declspec(empty_bases) produce_dispatch_to_overridable<T, D, %>
32163226 type);
32173227 }
32183228
3229+ static void write_std_formatter (writer& w, TypeDef const & type)
3230+ {
3231+ if (implements_interface (type, " Windows.Foundation.IStringable" ))
3232+ {
3233+ auto generics = type.GenericParam ();
3234+
3235+ w.write (" template<%> struct formatter<%, wchar_t> : formatter<winrt::Windows::Foundation::IStringable, wchar_t> {};\n " ,
3236+ bind<write_generic_typenames>(generics),
3237+ type);
3238+ }
3239+ }
3240+
32193241 static void write_namespace_special (writer& w, std::string_view const & namespace_name)
32203242 {
32213243 if (namespace_name == " Windows.Foundation" )
@@ -3259,6 +3281,7 @@ struct __declspec(empty_bases) produce_dispatch_to_overridable<T, D, %>
32593281 if (namespace_name == " Windows.Foundation" )
32603282 {
32613283 w.write (strings::base_reference_produce_1);
3284+ w.write (strings::base_stringable_format);
32623285 }
32633286 }
32643287}
0 commit comments