Skip to content

Commit

Permalink
馃摑 Fix up the docs a tiny bit!
Browse files Browse the repository at this point in the history
  • Loading branch information
ThePhD committed Jul 1, 2021
1 parent 3217fc2 commit eb0f895
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
default_handler
===============

The default handler for all operations. A class type that simply wraps :doc:`ztd::text::replacement_handler </api/error handlers/replacement_handler>` unless configured otherwise.
The default handler for all operations. A class type that simply wraps :doc:`ztd::text::replacement_handler </api/error handlers/replacement_handler>` unless configured otherwise. You can change it to throw by default (NOT recommended) by using :ref:`ZTD_TEXT_DEFAULT_HANDLER_THROWS <config-ZTD_TEXT_DEFAULT_HANDLER_THROWS>`.

.. doxygenclass:: ztd::text::default_handler
:members:
8 changes: 8 additions & 0 deletions documentation/source/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@ There are various configuration macros and CMake/build-time switches that will c
- Default: off.
- Not turned on by-default under any conditions.

.. _config-ZTD_TEXT_DEFAULT_HANDLER_THROWS:

- ``ZTD_TEXT_DEFAULT_HANDLER_THROWS``
- Makes the ``ztd::text::default_handler`` into a throwing handler rather than a replacement character handler.
- This is not at all recommended since malformed text (or text assumed to be the wrong encoding) is common, and not properly handling a thrown exception can result in what is, effectively, a denial-of-service attack for things which need to continually handle untrusted input.
- Default: off.
- Not turned on by-default under any conditions.

.. _config-ZTD_TEXT_UNICODE_SCALAR_VALUE_DISTINCT_TYPE:

- ``ZTD_TEXT_UNICODE_SCALAR_VALUE_DISTINCT_TYPE``
Expand Down
14 changes: 7 additions & 7 deletions documentation/source/design/lucky 7 extensions/speed.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,37 +55,37 @@ Extension Points: Forms & Return Types
Overriding any one of these extension points allows you to hook that behavior. It is very much required that you either use concrete types to provide these ADL extension points, or heavily constrain them using `SFINAE (preferred for C++17 and below) <https://en.cppreference.com/w/cpp/language/sfinae>`_ or `Concepts (only C++20 and above) <https://en.cppreference.com/w/cpp/concepts>`_.


``text_decode_into``
``text_decode``
++++++++++++++++++++

Form: ``text_decode_into(tag, input, encoding, output, handler, state)``.
Form: ``text_decode(tag, input, encoding, output, handler, state)``.

An extension point to speed up decoding operations for a given encoding, its input and outpuut ranges, and the associated error handler and state. This can be helpful for encodings which :doc:`may need to hide certain parts of their state </design/lucky 7 extensions/dependent states>`.

Must return a :doc:`ztd::text::decode_result </api/decode_result>`.


``text_encode_into``
``text_encode``
++++++++++++++++++++

Form: ``text_encode_into(input, encoding, output, handler, state)``.
Form: ``text_encode(input, encoding, output, handler, state)``.

An extension point to speed up encoding operations for a given encoding, its input and outpuut ranges, and the associated error handler and state. This can be helpful for encodings which :doc:`may need to hide certain parts of their state </design/lucky 7 extensions/dependent states>`.

Must return a :doc:`ztd::text::encode_result </api/encode_result>`.


``text_transcode_into``
``text_transcode``
+++++++++++++++++++++++

Form: ``text_transcode_into(input, from_encoding, output, to_encoding, from_handler, to_handler,`` ``from_state, to_state)``
Form: ``text_transcode(input, from_encoding, output, to_encoding, from_handler, to_handler,`` ``from_state, to_state)``

An extension point to speed up transcoding in bulk, for a given encoding pair, its input and output ranges, and its error handlers and states. Useful for known encoding pairs that have faster conversion paths between them.

Must return a :doc:`ztd::text::transcode_result </api/transcode_result>`.


``text_transcode_code``
``text_transcode_one``
+++++++++++++++++++++++

Form: ``text_transcode_one(input, from_encoding, output, to_encoding, from_handler, to_handler,`` ``from_state, to_state)``
Expand Down

0 comments on commit eb0f895

Please sign in to comment.