string.hpp 898 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. //
  2. // Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
  3. //
  4. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. //
  7. // Official repository: https://github.com/boostorg/beast
  8. //
  9. #ifndef BOOST_BEAST_DETAIL_STRING_HPP
  10. #define BOOST_BEAST_DETAIL_STRING_HPP
  11. #include <boost/beast/core/string_type.hpp>
  12. namespace boost {
  13. namespace beast {
  14. namespace detail {
  15. // Pulling in the UDL directly breaks in some places on MSVC,
  16. // so introduce a namespace for this purprose.
  17. namespace string_literals {
  18. inline
  19. string_view
  20. operator"" _sv(char const* p, std::size_t n)
  21. {
  22. return string_view{p, n};
  23. }
  24. } // string_literals
  25. inline
  26. char
  27. ascii_tolower(char c)
  28. {
  29. return ((static_cast<unsigned>(c) - 65U) < 26) ?
  30. c + 'a' - 'A' : c;
  31. }
  32. } // detail
  33. } // beast
  34. } // boost
  35. #endif