Browse Source

Add support for bool formatting

Michael Hansen 10 years ago
parent
commit
63557352f2
  1. 5
      Sources/Plasma/CoreLib/plFormat.cpp
  2. 4
      Sources/Plasma/CoreLib/plFormat.h

5
Sources/Plasma/CoreLib/plFormat.cpp

@ -485,3 +485,8 @@ PL_FORMAT_IMPL(const std::wstring &)
{
return _formatString(format, plString::FromWchar(value.c_str(), value.size()).ToUtf8());
}
PL_FORMAT_IMPL(bool)
{
return PL_FORMAT_FORWARD(format, value ? "true" : "false");
}

4
Sources/Plasma/CoreLib/plFormat.h

@ -170,6 +170,10 @@ PL_FORMAT_TYPE(const std::wstring &)
// TODO: Implement floating point types (float, double). They're harder
// than the others, so I'll get around to them later >.>
// Formats as "true" or "false", following normal string formatting rules.
// To use other formats, don't pass us a bool directly...
PL_FORMAT_TYPE(bool)
// End of the chain -- emits the last piece (if any) and builds the final string
namespace plFormat_Private
{

Loading…
Cancel
Save