bux API Reference 1.9.0
Static library of whatever are seen required in general purpose but not directly supported from Modern C++. Or whatever reusable originated from my side projects.
Loading...
Searching...
No Matches
bux::C_UnicodeIn Class Reference

#include <UnicodeCvt.h>

Public Member Functions

 C_UnicodeIn (FH_ReadChar &&readc, T_Encoding codepage=0)
 
 C_UnicodeIn (std::string_view sv, T_Encoding codepage=0)
 
 C_UnicodeIn (std::string &&s, T_Encoding codepage=0)=delete
 
 C_UnicodeIn (const char *s, T_Encoding codepage=0)
 
 C_UnicodeIn (std::istream &in, T_Encoding codepage=0)
 
 ~C_UnicodeIn () noexcept
 
int get (T_Utf32 &c)
 
int get (T_Utf16 *dst)
 
int get (T_Utf8 *dst)
 
int lastError () const noexcept
 
T_Encoding encoding () const noexcept
 

Detailed Description

Definition at line 51 of file UnicodeCvt.h.

Constructor & Destructor Documentation

◆ C_UnicodeIn() [1/5]

bux::C_UnicodeIn::C_UnicodeIn ( FH_ReadChar && readc,
T_Encoding codepage = 0 )

Definition at line 210 of file UnicodeCvt.cpp.

◆ C_UnicodeIn() [2/5]

bux::C_UnicodeIn::C_UnicodeIn ( std::string_view sv,
T_Encoding codepage = 0 )

Definition at line 217 of file UnicodeCvt.cpp.

◆ C_UnicodeIn() [3/5]

bux::C_UnicodeIn::C_UnicodeIn ( std::string && s,
T_Encoding codepage = 0 )
delete

◆ C_UnicodeIn() [4/5]

bux::C_UnicodeIn::C_UnicodeIn ( const char * s,
T_Encoding codepage = 0 )
inline

Definition at line 59 of file UnicodeCvt.h.

◆ C_UnicodeIn() [5/5]

bux::C_UnicodeIn::C_UnicodeIn ( std::istream & in,
T_Encoding codepage = 0 )
Parameters
inReference of input stream
codepageEncoding type of input stream. Value 0 to guess the finest.

HEADSUP: When codepage is 0 and in reference to a stream instance of type std::ifstream, the instance should be opened in binary mode with std::ios::binary for the case that the encoding is actually UTf-16(LE or BE) and input stream contains '\x1a' bytes (ascii EOF), e.g. as part of '\uff1a'. Or the input stream might hit EOF earlier than it should.

void foo(const std::string &path)
{
std::ifstream fin{path, std::ios::binary};
bux::C_UnicodeIn uin(fin);
//... Rest of your code
}

Definition at line 222 of file UnicodeCvt.cpp.

◆ ~C_UnicodeIn()

bux::C_UnicodeIn::~C_UnicodeIn ( )
noexcept

Definition at line 250 of file UnicodeCvt.cpp.

Member Function Documentation

◆ encoding()

T_Encoding bux::C_UnicodeIn::encoding ( ) const
inlinenoexcept

Definition at line 68 of file UnicodeCvt.h.

◆ get() [1/3]

int bux::C_UnicodeIn::get ( T_Utf16 * dst)

Definition at line 277 of file UnicodeCvt.cpp.

References get().

◆ get() [2/3]

int bux::C_UnicodeIn::get ( T_Utf32 & c)

Definition at line 257 of file UnicodeCvt.cpp.

References bux::C_RawQueue< N >::empty(), bux::C_Queue< T >::front(), lastError(), and bux::C_Queue< T >::pop().

Referenced by bux::C_MBCStr::escape(), get(), get(), and bux::C_LexTraits< C_LexUTF32 >::read().

Here is the caller graph for this function:

◆ get() [3/3]

int bux::C_UnicodeIn::get ( T_Utf8 * dst)

Definition at line 298 of file UnicodeCvt.cpp.

References get().

◆ lastError()

int bux::C_UnicodeIn::lastError ( ) const
inlinenoexcept

Definition at line 67 of file UnicodeCvt.h.

References bux::C_RawQueue< N >::empty().

Referenced by get().

Here is the caller graph for this function:

The documentation for this class was generated from the following files: