aboutsummaryrefslogtreecommitdiff
path: root/include/cru/base
diff options
context:
space:
mode:
Diffstat (limited to 'include/cru/base')
-rw-r--r--include/cru/base/Exception.h1
-rw-r--r--include/cru/base/StringUtil.h5
-rw-r--r--include/cru/base/platform/win/Exception.h7
-rw-r--r--include/cru/base/platform/win/Win32FileStream.h7
4 files changed, 11 insertions, 9 deletions
diff --git a/include/cru/base/Exception.h b/include/cru/base/Exception.h
index e4da91f5..c45cdc58 100644
--- a/include/cru/base/Exception.h
+++ b/include/cru/base/Exception.h
@@ -4,6 +4,7 @@
#include <exception>
#include <optional>
#include <string_view>
+#include <string>
namespace cru {
#ifdef _MSC_VER
diff --git a/include/cru/base/StringUtil.h b/include/cru/base/StringUtil.h
index 8c7841d7..a69bb884 100644
--- a/include/cru/base/StringUtil.h
+++ b/include/cru/base/StringUtil.h
@@ -380,4 +380,9 @@ Index Utf8IndexCodeUnitToCodePoint(const Utf8CodeUnit* ptr, Index size, Index po
Index Utf8IndexCodePointToCodeUnit(const Utf8CodeUnit* ptr, Index size, Index position);
Index Utf16IndexCodeUnitToCodePoint(const Utf16CodeUnit* ptr, Index size, Index position);
Index Utf16IndexCodePointToCodeUnit(const Utf16CodeUnit* ptr, Index size, Index position);
+
+#ifdef _WIN32
+std::wstring ToUtf16(std::string_view str);
+std::string ToUtf8(std::wstring_view str);
+#endif
} // namespace cru::string
diff --git a/include/cru/base/platform/win/Exception.h b/include/cru/base/platform/win/Exception.h
index 12f3d108..21851bb9 100644
--- a/include/cru/base/platform/win/Exception.h
+++ b/include/cru/base/platform/win/Exception.h
@@ -8,9 +8,6 @@
#include "../../Exception.h"
-#include <stdexcept>
-#include <string_view>
-
namespace cru::platform::win {
class CRU_BASE_API HResultError : public Exception {
public:
@@ -35,8 +32,8 @@ class CRU_BASE_API Win32Error : public Exception {
public:
// ::GetLastError is automatically called to get the error code.
// The same as Win32Error(::GetLastError(), message)
- explicit Win32Error(String message);
- Win32Error(DWORD error_code, String message);
+ explicit Win32Error(std::string_view message);
+ Win32Error(DWORD error_code, std::string_view message);
DWORD GetErrorCode() const { return error_code_; }
diff --git a/include/cru/base/platform/win/Win32FileStream.h b/include/cru/base/platform/win/Win32FileStream.h
index 61f1a33d..d0339b11 100644
--- a/include/cru/base/platform/win/Win32FileStream.h
+++ b/include/cru/base/platform/win/Win32FileStream.h
@@ -2,7 +2,6 @@
#ifdef CRU_PLATFORM_WINDOWS
-#include "../../String.h"
#include "../../io/OpenFileFlag.h"
#include "../../io/Stream.h"
@@ -13,7 +12,7 @@ class Win32FileStreamPrivate;
class CRU_BASE_API Win32FileStream : public io::Stream {
public:
- Win32FileStream(String path, io::OpenFileFlag flags);
+ Win32FileStream(std::string path, io::OpenFileFlag flags);
~Win32FileStream() override;
protected:
@@ -22,7 +21,7 @@ class CRU_BASE_API Win32FileStream : public io::Stream {
Index DoWrite(const std::byte* buffer, Index offset, Index size) override;
public:
- String GetPath() const { return path_; }
+ std::string GetPath() const { return path_; }
io::OpenFileFlag GetOpenFileFlags() const { return flags_; }
details::Win32FileStreamPrivate* GetPrivate_() { return p_; }
@@ -33,7 +32,7 @@ class CRU_BASE_API Win32FileStream : public io::Stream {
void DoClose();
private:
- String path_;
+ std::string path_;
io::OpenFileFlag flags_;
details::Win32FileStreamPrivate* p_;