26 #include <pluginterfaces/base/ftypes.h> 27 #include <base/source/fstring.h> 37 std::wstring_convert<std::codecvt_utf8_utf16<Steinberg::char16>, Steinberg::char16> converter{};
38 return converter.to_bytes(iString);
50 std::string
toUTF8String(T
const &iValue, Steinberg::int32 iPrecision)
52 if constexpr(Utils::is_operator_write_to_ostream_defined<T>)
57 s.precision(iPrecision);
58 s.setf(std::ios::fixed);
69 template<
typename... Args>
73 s.printf(iFormat.c_str(), std::forward<Args>(iArgs)...);
88 template<
typename T,
typename... Args>
91 auto ptr =
new T(std::forward<Args>(iArgs)...);
92 std::shared_ptr<T> sptr(ptr, [](T *p) { p->release(); });
std::string toUTF8String(T const &iValue, Steinberg::int32 iPrecision)
This generic function will determine (at compilation time) whether T can be written to an ostream and...
Definition: Utils.h:50
Definition: ExpiringDataCache.h:27
std::basic_string< Steinberg::char16 > VstString16
Strings made of char16 characters are represented by the native C++11 type std::basic_string<Steinber...
Definition: Types.h:43
VstString16 printf16(VstString16 const &iFormat, Args &&...iArgs)
Equivalent to printf but for VstString16
Definition: Utils.h:70
std::shared_ptr< T > make_sfo(Args &&...iArgs)
The VST SDK uses the concept of FObject (which are self contained reference counted objects) but requ...
Definition: Utils.h:89
std::string toUT8String(VstString16 const &iString)
Converts a VstString16 to a regular std::string that is properly utf-8 encoded.
Definition: Utils.h:35