changed things to include plog
This commit is contained in:
parent
b018a44f10
commit
68a1618743
34 changed files with 2702 additions and 27 deletions
28
include/plog/Converters/UTF8Converter.h
Normal file
28
include/plog/Converters/UTF8Converter.h
Normal file
|
@ -0,0 +1,28 @@
|
|||
#pragma once
|
||||
#include <plog/Util.h>
|
||||
|
||||
namespace plog
|
||||
{
|
||||
class UTF8Converter
|
||||
{
|
||||
public:
|
||||
static std::string header(const util::nstring& str)
|
||||
{
|
||||
const char kBOM[] = "\xEF\xBB\xBF";
|
||||
|
||||
return std::string(kBOM) + convert(str);
|
||||
}
|
||||
|
||||
#if PLOG_CHAR_IS_UTF8
|
||||
static const std::string& convert(const util::nstring& str)
|
||||
{
|
||||
return str;
|
||||
}
|
||||
#else
|
||||
static std::string convert(const util::nstring& str)
|
||||
{
|
||||
return util::toNarrow(str, codePage::kUTF8);
|
||||
}
|
||||
#endif
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue