Skip to content

Commit

Permalink
✨ Add kamenicky and windows_437 encodings
Browse files Browse the repository at this point in the history
  • Loading branch information
ThePhD committed May 16, 2023
1 parent 0b78eda commit 61362bf
Show file tree
Hide file tree
Showing 4 changed files with 150 additions and 4 deletions.
15 changes: 15 additions & 0 deletions documentation/source/api/encodings/single_byte_encoding.rst
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ Known Encodings

.. doxygenvariable:: ztd::text::iso_8859_16

.. doxygenvariable:: ztd::text::kamenicky

.. doxygenvariable:: ztd::text::kazakh_strk1048

.. doxygenvariable:: ztd::text::koi8_r
Expand All @@ -90,6 +92,10 @@ Known Encodings

.. doxygenvariable:: ztd::text::tatar_ascii

.. doxygenvariable:: ztd::text::windows_437_dos_latin_us

.. doxygenvariable:: ztd::text::windows_874

.. doxygenvariable:: ztd::text::windows_1251

.. doxygenvariable:: ztd::text::windows_1252
Expand Down Expand Up @@ -171,6 +177,9 @@ Base Templates
.. doxygenclass:: ztd::text::basic_iso_8859_16
:members:

.. doxygenclass:: ztd::text::basic_kamenicky
:members:

.. doxygenclass:: ztd::text::basic_kazakh_strk1048
:members:

Expand All @@ -192,6 +201,12 @@ Base Templates
.. doxygenclass:: ztd::text::basic_tatar_ascii
:members:

.. doxygenclass:: ztd::text::basic_windows_437_dos_latin_us
:members:

.. doxygenclass:: ztd::text::basic_windows_874
:members:

.. doxygenclass:: ztd::text::basic_windows_1251
:members:

Expand Down
12 changes: 8 additions & 4 deletions documentation/source/encodings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,14 @@ As a general point, we hope to support almost all of the encodings here in one f
- No
- Yes
- :doc:`Yes ✅ </api/encodings/single_byte_encoding>`
* - Kamenicky
- No
- Yes
- :doc:`Yes ✅ </api/encodings/single_byte_encoding>`
* - Windows-437 / DOS Latin-US
- No
- Yes
- :doc:`Yes ✅ </api/encodings/single_byte_encoding>`
* - Windows-874
- No
- Yes
Expand Down Expand Up @@ -263,10 +271,6 @@ As a general point, we hope to support almost all of the encodings here in one f
- ❓ Unresearched
- ❓ Unconfirmed
- No ❌
* - CP437
- ❓ Unresearched
- ❓ Unconfirmed
- No ❌
* - CP737
- ❓ Unresearched
- ❓ Unconfirmed
Expand Down
63 changes: 63 additions & 0 deletions include/ztd/text/kamenicky.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// =============================================================================
//
// ztd.text
// Copyright © 2022-2023 JeanHeyd "ThePhD" Meneide and Shepherd's Oasis, LLC
// Contact: opensource@soasis.org
//
// Commercial License Usage
// Licensees holding valid commercial ztd.text licenses may use this file in
// accordance with the commercial license agreement provided with the
// Software or, alternatively, in accordance with the terms contained in
// a written agreement between you and Shepherd's Oasis, LLC.
// For licensing terms and conditions see your agreement. For
// further information contact opensource@soasis.org.
//
// Apache License Version 2 Usage
// Alternatively, this file may be used under the terms of Apache License
// Version 2.0 (the "License") for non-commercial use; you may not use this
// file except in compliance with the License. You may obtain a copy of the
// License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// ============================================================================ //

#pragma once

#ifndef ZTD_TEXT_KAMENICKY_HPP
#define ZTD_TEXT_KAMENICKY_HPP

#include <ztd/text/version.hpp>

#include <ztd/text/unicode_code_point.hpp>
#include <ztd/text/impl/single_byte_lookup_encoding.hpp>

#include <ztd/encoding_tables/kamenicky.tables.hpp>

#include <ztd/prologue.hpp>

namespace ztd { namespace text {
ZTD_TEXT_INLINE_ABI_NAMESPACE_OPEN_I_

template <typename _CodeUnit = char, typename _CodePoint = unicode_code_point>
class basic_kamenicky : public __txt_impl::__single_byte_lookup_encoding<basic_kamenicky<_CodeUnit, _CodePoint>,
&::ztd::et::kamenicky_index_to_code_point, &::ztd::et::kamenicky_code_point_to_index,
_CodeUnit, _CodePoint> { };

//////
/// @brief An instance of skip_handler_t for ease of use.
inline constexpr basic_kamenicky<char> kamenicky = {};

ZTD_TEXT_INLINE_ABI_NAMESPACE_CLOSE_I_
}} // namespace ztd::text


#include <ztd/epilogue.hpp>

#endif
64 changes: 64 additions & 0 deletions include/ztd/text/windows_437_dos_latin_us.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// =============================================================================
//
// ztd.text
// Copyright © 2022-2023 JeanHeyd "ThePhD" Meneide and Shepherd's Oasis, LLC
// Contact: opensource@soasis.org
//
// Commercial License Usage
// Licensees holding valid commercial ztd.text licenses may use this file in
// accordance with the commercial license agreement provided with the
// Software or, alternatively, in accordance with the terms contained in
// a written agreement between you and Shepherd's Oasis, LLC.
// For licensing terms and conditions see your agreement. For
// further information contact opensource@soasis.org.
//
// Apache License Version 2 Usage
// Alternatively, this file may be used under the terms of Apache License
// Version 2.0 (the "License") for non-commercial use; you may not use this
// file except in compliance with the License. You may obtain a copy of the
// License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// ============================================================================ //

#pragma once

#ifndef ZTD_TEXT_WINDOWS_437_DOS_LATIN_US_HPP
#define ZTD_TEXT_WINDOWS_437_DOS_LATIN_US_HPP

#include <ztd/text/version.hpp>

#include <ztd/text/unicode_code_point.hpp>
#include <ztd/text/impl/single_byte_lookup_encoding.hpp>

#include <ztd/encoding_tables/windows_437_dos_latin_us.tables.hpp>

#include <ztd/prologue.hpp>

namespace ztd { namespace text {
ZTD_TEXT_INLINE_ABI_NAMESPACE_OPEN_I_

template <typename _CodeUnit = char, typename _CodePoint = unicode_code_point>
class basic_windows_437_dos_latin_us
: public __txt_impl::__single_byte_lookup_encoding<basic_windows_437_dos_latin_us<_CodeUnit, _CodePoint>,
&::ztd::et::windows_437_dos_latin_us_index_to_code_point,
&::ztd::et::windows_437_dos_latin_us_code_point_to_index, _CodeUnit, _CodePoint> { };

//////
/// @brief An instance of skip_handler_t for ease of use.
inline constexpr basic_windows_437_dos_latin_us<char> windows_437_dos_latin_us = {};

ZTD_TEXT_INLINE_ABI_NAMESPACE_CLOSE_I_
}} // namespace ztd::text


#include <ztd/epilogue.hpp>

#endif

0 comments on commit 61362bf

Please sign in to comment.