aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/winapi/utf8.hpp
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2021-09-26 16:27:19 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2021-09-26 17:59:32 +0300
commit00393a40e5fdddd99c39106a0082d5f4b9b0315c (patch)
tree8a5580f7a26a548c5f53a63cb1469490b67da341 /include/winapi/utf8.hpp
parentworkflows/ci: use default clang-format (diff)
downloadwinapi-utf8-00393a40e5fdddd99c39106a0082d5f4b9b0315c.tar.gz
winapi-utf8-00393a40e5fdddd99c39106a0082d5f4b9b0315c.zip
add Doxygen docs
Diffstat (limited to 'include/winapi/utf8.hpp')
-rw-r--r--include/winapi/utf8.hpp33
1 files changed, 29 insertions, 4 deletions
diff --git a/include/winapi/utf8.hpp b/include/winapi/utf8.hpp
index 9469fd7..c5ec9ac 100644
--- a/include/winapi/utf8.hpp
+++ b/include/winapi/utf8.hpp
@@ -3,6 +3,11 @@
// For details, see https://github.com/egor-tensin/winapi-utf8.
// Distributed under the MIT License.
+/**
+ * @file
+ * @brief UTF-8 <-> UTF-16 conversion functions
+ */
+
#pragma once
#include <cstddef>
@@ -12,17 +17,37 @@
namespace winapi {
+/** Convert UTF-8 string to UTF-16. */
std::wstring widen(const std::string&);
-std::wstring widen(const void*, std::size_t nb);
-
+/**
+ * Convert UTF-8 string to UTF-16.
+ * \param src Pointer to UTF-8 string.
+ * \param nb Number of bytes pointed to src.
+ */
+std::wstring widen(const void* src, std::size_t nb);
+
+/**
+ * Convert UTF-8 string to UTF-16.
+ * \param src UTF-8 string.
+ */
template <typename T, typename Alloc = std::allocator<T>>
std::wstring widen(const std::vector<T, Alloc>& src) {
return widen(src.data(), src.size() * sizeof(T));
}
+/** Convert UTF-16 string to UTF-8. */
std::string narrow(const std::wstring&);
-std::string narrow(const void*, std::size_t nb);
-
+/**
+ * Convert UTF-16 string to UTF-8.
+ * \param src Pointer to UTF-16 string.
+ * \param nb Number of bytes pointed to by src.
+ */
+std::string narrow(const void* src, std::size_t nb);
+
+/**
+ * Convert UTF-16 string to UTF-8.
+ * \param src UTF-16 string.
+ */
template <typename T, typename Alloc = std::allocator<T>>
std::string narrow(const std::vector<T, Alloc>& src) {
return narrow(src.data(), src.size() * sizeof(T));