From c8e0e909b4a8d18319fc65434a10dc446434817c Mon Sep 17 00:00:00 2001 From: Daniel Wilhelm Date: Fri, 18 Apr 2014 17:19:49 +0200 Subject: 5.3 --- zen/file_error.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'zen/file_error.h') diff --git a/zen/file_error.h b/zen/file_error.h index 853267d4..4565d0b7 100644 --- a/zen/file_error.h +++ b/zen/file_error.h @@ -38,9 +38,22 @@ DEFINE_NEW_FILE_ERROR(ErrorFileLocked); //----------- facilitate usage of std::wstring for error messages -------------------- //allow implicit UTF8 conversion: since std::wstring models a GUI string, convenience is more important than performance -inline std::wstring operator+(const std::wstring& lhs, const Zstring& rhs) { return std::wstring(lhs) += zen::utf8CvrtTo(rhs); } +inline +std::wstring operator+(const std::wstring& lhs, const Zstring& rhs) { return std::wstring(lhs) += utf8CvrtTo(rhs); } //we musn't put our overloads in namespace std, but namespace zen (+ using directive) is sufficient + + +inline +std::wstring fmtFileName(const Zstring& filename) +{ + std::wstring output; + output.reserve(filename.size() + 2); + output += L'\"'; + output += utf8CvrtTo(filename); + output += L'\"'; + return output; +} } #endif // FILEERROR_H_INCLUDED -- cgit