test_posix_tools.hpp 686 B

12345678910111213141516171819202122232425262728293031
  1. //
  2. // Copyright (c) 2009-2011 Artyom Beilis (Tonkikh)
  3. //
  4. // Distributed under the Boost Software License, Version 1.0. (See
  5. // accompanying file LICENSE_1_0.txt or copy at
  6. // http://www.boost.org/LICENSE_1_0.txt)
  7. //
  8. #ifndef BOOST_LOCLAE_TEST_LOCALE_POSIX_TOOLS_HPP
  9. #define BOOST_LOCLAE_TEST_LOCALE_POSIX_TOOLS_HPP
  10. #include <locale.h>
  11. #include <string>
  12. #if defined(__APPLE__) || defined(__FreeBSD__)
  13. #include <xlocale.h>
  14. #endif
  15. inline bool have_locale(std::string const &name)
  16. {
  17. locale_t l=newlocale(LC_ALL_MASK,name.c_str(),0);
  18. if(l) {
  19. freelocale(l);
  20. return true;
  21. }
  22. return false;
  23. }
  24. #endif
  25. // vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4