wcslen.hpp 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #ifndef BOOST_ARCHIVE_WCSLEN_HPP
  2. #define BOOST_ARCHIVE_WCSLEN_HPP
  3. // MS compatible compilers support #pragma once
  4. #if defined(_MSC_VER)
  5. # pragma once
  6. #endif
  7. /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
  8. // wcslen.hpp:
  9. // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
  10. // Use, modification and distribution is subject to the Boost Software
  11. // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  12. // http://www.boost.org/LICENSE_1_0.txt)
  13. // See http://www.boost.org for updates, documentation, and revision history.
  14. #include <cstddef> // size_t
  15. #include <boost/config.hpp>
  16. #if defined(BOOST_NO_STDC_NAMESPACE)
  17. namespace std{
  18. using ::size_t;
  19. } // namespace std
  20. #endif
  21. #ifndef BOOST_NO_CWCHAR
  22. // a couple of libraries which include wchar_t don't include
  23. // wcslen
  24. #if defined(BOOST_DINKUMWARE_STDLIB) && BOOST_DINKUMWARE_STDLIB < 306 \
  25. || defined(__LIBCOMO__)
  26. namespace std {
  27. inline std::size_t wcslen(const wchar_t * ws)
  28. {
  29. const wchar_t * eows = ws;
  30. while(* eows != 0)
  31. ++eows;
  32. return eows - ws;
  33. }
  34. } // namespace std
  35. #else
  36. #include <cwchar>
  37. #ifdef BOOST_NO_STDC_NAMESPACE
  38. namespace std{ using ::wcslen; }
  39. #endif
  40. #endif // wcslen
  41. #endif //BOOST_NO_CWCHAR
  42. #endif //BOOST_ARCHIVE_WCSLEN_HPP