Skip to content

Commit

Permalink
Add Latin2 text encoding.
Browse files Browse the repository at this point in the history
  • Loading branch information
HaxyM authored Sep 25, 2024
1 parent 819d35d commit fab5437
Showing 1 changed file with 55 additions and 2 deletions.
57 changes: 55 additions & 2 deletions include/crap/text_encoding.d/textencodingtype.h
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,9 @@ namespace crap
using text_encoding_id_ISOLatin1_t =
std :: integral_constant<textEncodingType <void> :: id, textEncodingType <void> :: id :: ISOLatin1>;

using text_encoding_id_ISOLatin2_t =
std :: integral_constant<textEncodingType <void> :: id, textEncodingType <void> :: id :: ISOLatin2>;

template <>
struct textEncodingType<text_encoding_id_ASCII_t> : textEncodingType<void>
{
Expand Down Expand Up @@ -337,6 +340,20 @@ namespace crap
string<char 'c', 's', 'I', 'S', 'O', 'L', 'a', 't', 'i', 'n', '1'> >;
};

template <>
struct textEncodingType<text_encoding_id_ISOLatin2_t> : textEncodingType<void>
{
using mib = text_encoding_id_ISOLatin2_t;
using name = string<char, 'I', 'S', 'O', '-', '8', '8', '5', '9', '-', '2'>; //Libstdc++ uses name ISO-8859-2:1987
using aliases = typeList<
string<char 'i', 's', 'o', '-', 'i', 'r', '-', '1', '0', '1'>,
string<char, 'I', 'S', 'O', '_', '8', '8', '5', '9', '-', '2'>,
string<char, 'I', 'S', 'O', '-', '8', '8', '5', '9', '-', '2'>,
string<char, 'l', 'a', 't', 'i', 'n', '2'>,
string<char, 'l', '2'>,
string<char 'c', 's', 'I', 'S', 'O', 'L', 'a', 't', 'i', 'n', '2'> >;
};

template <>
struct textEncodingType<string<char 'A', 'N', 'S', 'I', '_', 'X', '3', '.', '4', '-', '1', '9', '6', '8'> >
: textEncodingType<text_encoding_id_ASCII_t>
Expand Down Expand Up @@ -373,6 +390,12 @@ namespace crap
{
};

template <>
struct textEncodingType<string<char 'c', 's', 'I', 'S', 'O', 'L', 'a', 't', 'i', 'n', '2'> >
: textEncodingType<text_encoding_id_ISOLatin2_t>
{
};

template <>
struct textEncodingType<string<char 'I', 'B', 'M', '3', '6', '7'> >
: textEncodingType<text_encoding_id_ASCII_t>
Expand Down Expand Up @@ -403,18 +426,36 @@ namespace crap
{
};

template <>
struct textEncodingType<string<char 'I', 'S', 'O', '_', '8', '8', '5', '9', '-', '2'> >
: textEncodingType<text_encoding_id_ISOLatin2_t>
{
};

template <>
struct textEncodingType<string<char 'I', 'S', 'O', '-', '8', '8', '5', '9', '-', '1'> >
: textEncodingType<text_encoding_id_ISOLatin1_t>
{
};

template <>
struct textEncodingType<string<char 'I', 'S', 'O', '-', '8', '8', '5', '9', '-', '2'> >
: textEncodingType<text_encoding_id_ISOLatin2_t>
{
};

template <>
struct textEncodingType<string<char 'i', 's', 'o', '-', 'i', 'r', '-', '1', '0', '0'> >
: textEncodingType<text_encoding_id_ISOLatin1_t>
{
};

template <>
struct textEncodingType<string<char 'i', 's', 'o', '-', 'i', 'r', '-', '1', '0', '1'> >
: textEncodingType<text_encoding_id_ISOLatin2_t>
{
};

template <>
struct textEncodingType<string<char 'i', 's', 'o', '-', 'i', 'r', '-', '6'> >
: textEncodingType<text_encoding_id_ASCII_t>
Expand All @@ -423,13 +464,25 @@ namespace crap

template <>
struct textEncodingType<string<char 'l', '1'> >
: textEncodingType<text_encoding_id_ASCII_t>
: textEncodingType<text_encoding_id_ISOLatin1_t>
{
};

template <>
struct textEncodingType<string<char 'l', '2'> >
: textEncodingType<text_encoding_id_ISOLatin2_t>
{
};

template <>
struct textEncodingType<string<char 'l', 'a', 't', 'i', 'n', '1'> >
: textEncodingType<text_encoding_id_ASCII_t>
: textEncodingType<text_encoding_id_ISOLatin1_t>
{
};

template <>
struct textEncodingType<string<char 'l', 'a', 't', 'i', 'n', '2'> >
: textEncodingType<text_encoding_id_ISOLatin2_t>
{
};

Expand Down

0 comments on commit fab5437

Please sign in to comment.