[Kernel] stringstream<< > string.push_back as LLVM libc++ doesn't support char16_t stream

This commit is contained in:
Triang3l 2021-09-12 13:04:03 +03:00
parent 9d992e3d06
commit 6241b4f907
1 changed files with 7 additions and 6 deletions

View File

@ -10,6 +10,7 @@
#include <cstring> #include <cstring>
#include <iomanip> #include <iomanip>
#include <sstream> #include <sstream>
#include <string>
#include "xenia/base/logging.h" #include "xenia/base/logging.h"
#include "xenia/kernel/kernel_state.h" #include "xenia/kernel/kernel_state.h"
@ -737,15 +738,15 @@ class StringFormatData : public FormatData {
if (c >= 0x100) { if (c >= 0x100) {
return false; return false;
} }
output_ << (char)c; output_.push_back(char(c));
return true; return true;
} }
std::string str() const { return output_.str(); } const std::string& str() const { return output_; }
private: private:
const uint8_t* input_; const uint8_t* input_;
std::ostringstream output_; std::string output_;
}; };
class WideStringFormatData : public FormatData { class WideStringFormatData : public FormatData {
@ -771,15 +772,15 @@ class WideStringFormatData : public FormatData {
} }
bool put(uint16_t c) { bool put(uint16_t c) {
output_ << (char16_t)c; output_.push_back(char16_t(c));
return true; return true;
} }
std::u16string wstr() const { return output_.str(); } const std::u16string& wstr() const { return output_; }
private: private:
const uint16_t* input_; const uint16_t* input_;
std::basic_stringstream<char16_t> output_; std::u16string output_;
}; };
class WideCountFormatData : public FormatData { class WideCountFormatData : public FormatData {