mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-18 11:19:10 +00:00
Make life simpler. Make life less stupid. Make life work.
This commit is contained in:
@ -133,38 +133,34 @@ namespace plFormat_Private
|
|||||||
|
|
||||||
extern FormatSpec _FetchNextFormat(_IFormatDataObject &data);
|
extern FormatSpec _FetchNextFormat(_IFormatDataObject &data);
|
||||||
|
|
||||||
template <typename _type, typename... _Args>
|
template <typename _Type, typename... _Args>
|
||||||
plString _IFormat(_IFormatDataObject &data, _type, _Args...);
|
plString _IFormat(_IFormatDataObject &data, _Type value, _Args... args)
|
||||||
|
{
|
||||||
|
plFormat_Private::FormatSpec format = plFormat_Private::_FetchNextFormat(data);
|
||||||
|
data.fOutput.push_back(_impl_plFormat_DataHandler(format, value));
|
||||||
|
return _IFormat(data, args...);
|
||||||
|
}
|
||||||
|
|
||||||
// End of the chain -- emits the last piece (if any) and builds the final string
|
// End of the chain -- emits the last piece (if any) and builds the final string
|
||||||
plString _IFormat(_IFormatDataObject &data);
|
plString _IFormat(_IFormatDataObject &data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename _Type, typename... _Args>
|
||||||
|
plString plFormat(const char *fmt_str, _Type value, _Args... args)
|
||||||
|
{
|
||||||
|
plFormat_Private::_IFormatDataObject data;
|
||||||
|
data.fFormatStr = fmt_str;
|
||||||
|
plFormat_Private::FormatSpec format = plFormat_Private::_FetchNextFormat(data);
|
||||||
|
data.fOutput.push_back(_impl_plFormat_DataHandler(format, value));
|
||||||
|
return plFormat_Private::_IFormat(data, args...);
|
||||||
|
}
|
||||||
|
|
||||||
/** Declare a formattable type for `plFormat`.
|
/** Declare a formattable type for `plFormat`.
|
||||||
* \sa PL_FORMAT_IMPL()
|
* \sa PL_FORMAT_IMPL()
|
||||||
*/
|
*/
|
||||||
#define PL_FORMAT_TYPE(_type) \
|
#define PL_FORMAT_TYPE(_type) \
|
||||||
extern plStringBuffer<char> _impl_plFormat_DataHandler( \
|
extern plStringBuffer<char> _impl_plFormat_DataHandler( \
|
||||||
const plFormat_Private::FormatSpec &format, _type value); \
|
const plFormat_Private::FormatSpec &format, _type value);
|
||||||
namespace plFormat_Private \
|
|
||||||
{ \
|
|
||||||
template <typename... _Args> \
|
|
||||||
plString _IFormat(_IFormatDataObject &data, _type value, _Args... args) \
|
|
||||||
{ \
|
|
||||||
plFormat_Private::FormatSpec format = plFormat_Private::_FetchNextFormat(data); \
|
|
||||||
data.fOutput.push_back(_impl_plFormat_DataHandler(format, value)); \
|
|
||||||
return _IFormat(data, args...); \
|
|
||||||
} \
|
|
||||||
} \
|
|
||||||
template <typename... _Args> \
|
|
||||||
plString plFormat(const char *fmt_str, _type value, _Args... args) \
|
|
||||||
{ \
|
|
||||||
plFormat_Private::_IFormatDataObject data; \
|
|
||||||
data.fFormatStr = fmt_str; \
|
|
||||||
plFormat_Private::FormatSpec format = plFormat_Private::_FetchNextFormat(data); \
|
|
||||||
data.fOutput.push_back(_impl_plFormat_DataHandler(format, value)); \
|
|
||||||
return plFormat_Private::_IFormat(data, args...); \
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Provide the implementation for a formattable type for `plFormat`.
|
/** Provide the implementation for a formattable type for `plFormat`.
|
||||||
* \sa PL_FORMAT_TYPE(), PL_FORMAT_FORWARD()
|
* \sa PL_FORMAT_TYPE(), PL_FORMAT_FORWARD()
|
||||||
|
Reference in New Issue
Block a user