25 lines
1.2 KiB
C++
25 lines
1.2 KiB
C++
|
/***
|
||
|
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
||
|
|
||
|
File: Encoding.hpp
|
||
|
Date: 2021-8-20
|
||
|
Author: Reece
|
||
|
***/
|
||
|
#pragma once
|
||
|
|
||
|
namespace Aurora::Locale::Encoding
|
||
|
{
|
||
|
AUKN_SYM AuStreamReadWrittenPair_t EncodeUTF8(const void *utf8, AuUInt32 ut8Length, void *binary, AuUInt32 binaryLength, ECodePage page = ECodePage::eUnsupported);
|
||
|
static inline AuStreamReadWrittenPair_t EncodeUTF8(const AuString &out, void *binary, AuUInt32 binaryLength, ECodePage page = ECodePage::eUnsupported)
|
||
|
{
|
||
|
return EncodeUTF8(out.data(), static_cast<AuUInt32>(out.size()), binary, binaryLength, page);
|
||
|
}
|
||
|
|
||
|
AUKN_SYM std::optional<AuPair<ECodePage, AuUInt8>> DecodeBOM(const void *binary, AuUInt32 binaryLength);
|
||
|
|
||
|
/// Translates a buffer, possibly a slice of a stream, to UTF-8
|
||
|
/// Returns a pair; bytes consumed, bytes written
|
||
|
AUKN_SYM AuStreamReadWrittenPair_t DecodeUTF8(const void *binary, AuUInt32 binaryLength, void *utf8, AuUInt32 utf8Max, ECodePage page = ECodePage::eUnsupported);
|
||
|
|
||
|
AUKN_SYM AuStreamReadWrittenPair_t DecodeUTF8(const void *binary, AuUInt32 binaryLength, AuString &out, ECodePage page = ECodePage::eUnsupported);
|
||
|
}
|