Example #1
0
bool
P::utf8Support (const std::ostream& o)
{
   string name = o.getloc().name();
   return (name.find ("UTF-8") != string::npos
        || name.find ("utf-8") != string::npos);
}
Example #2
0
void float2string(std::ostream& os, float value)
{
#ifdef SEXP_USE_CXX17
  constexpr size_t len = std::numeric_limits<float>::digits10 + 1;
  char buffer[len];
  auto result = std::to_chars(buffer, buffer + len, value);
  assert(result.ec == std::errc());
  os.write(buffer, result.ptr - buffer);
#else
  auto precision = os.precision(std::numeric_limits<float>::digits10 + 1);
#  ifdef SEXP_USE_LOCALE
  const auto& loc = os.getloc();
  os.imbue(std::locale::classic());
  os << value;
  os.imbue(loc);
#  else
  os << value;
#  endif
  os.precision(precision);
#endif
}
Example #3
0
void to_title::operator()(std::ostream &out) const
{
    out << locale::to_title(obj_.get(out),out.getloc());
}
Example #4
0
void to_upper::operator()(std::ostream &out) const
{
    std::string tmp =obj_.get(out) ;
    std::locale loc = out.getloc();
    out << ::cppcms::locale::to_upper( tmp,loc);
}