DISTRHO Plugin Framework
List of all members
ScopedSafeLocale Class Reference

#include <ScopedSafeLocale.hpp>

Detailed Description

ScopedSafeLocale is a handy class for setting current locale to C on constructor, and revert back on destructor. It tries to be thread-safe, but it is not always possible.

Put it inside a scope of code where string conversions happen to ensure they are consistent across many systems. For example:

// stack buffer to put converted float value in
char strbuf[0xff];
{
// safe locale operations during this scope
const ScopedSafeLocale sl;
snprintf(strbuf, 0xff, "%f", value);
}
// do something with `strbuf` now, locale is reverted and left just as it was before
Definition: ScopedSafeLocale.hpp:57

The documentation for this class was generated from the following file: