wavelength 1.0.0
Loading...
Searching...
No Matches
utf8.h
Go to the documentation of this file.
1#pragma once
2
3#ifdef VIDEO_STANDARD_PAL
4
5#include <memory>
6
7#include "os/string.h"
8
18int Utf8Size(const char *pszText);
19
30void Utf8Encode(char *pszOut, const char *pszText, int nSize);
31
43int Utf8DecodedSize(const char *pszUtf8);
44
57void Utf8Decode(char *pszOut, const char *pszUtf8, int nSize);
58
67inline String Utf8String(const char *pszText) {
68 const int nSize = Utf8Size(pszText);
69 auto pszBuffer = std::make_unique<char[]>(nSize);
70 Utf8Encode(pszBuffer.get(), pszText, nSize);
71 String text(pszBuffer.get());
72 return text;
73}
74
83inline String Utf8DecodedString(const char *pszUtf8) {
84 const int nSize = Utf8DecodedSize(pszUtf8);
85 auto pszBuffer = std::make_unique<char[]>(nSize);
86 Utf8Decode(pszBuffer.get(), pszUtf8, nSize);
87 String text(pszBuffer.get());
88 return text;
89}
90
91#endif
Growable text buffer that is also a PrnStream.
Definition string.h:19