A lot of checks and a major workaround are for ICU 4.8 or earlier which
can be removed.
An annoying bug (Parsing of timezones like "GMT" in "full" format followed by unrelated text)
fixed in 4.8.1 is worth avoiding by requiring this version over 4.8.0.
The class derived from `std::collate` which is always present in `std::locale`.
So checks for the `boost::locale::collator` facet may return wrongly true.
As a fix make this an independent facet with its own ID.
Use an adapter such that a std::collate derived class can use its abilities.
Instead of explicit instantiation for each supported char type and an extra copy for documentation generation reduce to only a single template and instantiate the whole class explicitly.
To ensure a reasonable error is generated introduce an `is_supported_char`-trait and `static_assert` on it.
To further reduce the repetition when instantiating the templates create a macro to loop over the supported char types.
May save some overhead creating implementation classes and allows to
write shorter code for doing the same conversions repeatatly.
Also allows a hook for testing each backend individually.
Iconv is also available on Windows so not specific to the POSIX backend.
Instead of a shared_ptr to a vector we can simply use a `std::array`.
Finally the `iconv_t` can be put into an RAII class.
This deduplicates e.g. `convert_encoding_name`/`normalize_encoding`
and makes the structure more logical by not mixing those util functions
with the char converter code.
Define `_SCL_SECURE_NO_WARNINGS` for building the library to avoid "Call to 'std::copy' with parameters that may be unsafe" in `src\boost\locale\std\converter.cpp`
This also allows to remove the multiple suppressions of C4996
FreeBSD has a builtin iconv and an external one in /usr/local.
When linking against ICU (in /usr/local) the (incompatible) headers
of the external libiconv are found failing with missing symbols such
as `libiconv_open`.
Account for that in the CMake build.
Signed-off-by: Alexander Grund <Flamefire@users.noreply.github.com>
To support e.g. recent Cygwins where relative paths to the current file are not automatically resolved
move the sources into a `boost/locale` subfolder and add `src` to the private include paths.
This then allows to include those files as `"boost/locale/foo/bar.hpp"`.