Add codepoint utility functions that test whether a codepoint belongs
to a set of codepoints (e.g., the valid codepoints for a URL scheme).
Most of these functions are implemented using a compact lookup table
so should be reasonably fast.
The functions are based on similar functions from the css-parser branch
that were introduced in commit 1698324920. We'll want to merge these
sets of functions together once the branches are merged.
tstring_view is a string reference type that provides a view into a
string that is owned elsewhere (e.g., by a std::string object).
tstring_view implements the same interface as std::base_string_view in
the standard library. When litehtml moves to C++17 consider replacing
the tstring_view implementation with the standard library
implementations (e.g., via a using statement).
Add a CMake option (USE_ICU) to enable the use of ICU to locate word
boundaries in strings. If USE_ICU is enabled then split_text_node()
uses ICU's BreakIterator to split up a text node. If USE_ICU is
disabled then split_text_node() uses the existing implementation to
split up a text node.
USE_ICU is disabled by default so this does not introduce a dependency
on ICU for existing litehtml users.
This should make it easier to provide alternate implementations of
split_text_node() in the future (e.g., one based on the break
iteration found in ICU4C).
FetchContent_MakeAvailable() was introduced in CMake 3.14. Use
FetchContent_GetProperties() and FetchContent_Populate() instead as
per the CMake FetchContent documentation:
https://cmake.org/cmake/help/latest/module/FetchContent.html
This change also bumps the required version of CMake from 3.5 to 3.11.
GoogleTest provides a number of nice features (such as autodiscovery)
that make writing and running tests easier and less tedious. This
patch converts the litehtml tests over to use GoogleTest. Note that
the conversion is mostly mechanical -- no attempt has been made to
make the tests "idiomatic" GoogleTests.
Most of the CMake changes are based on code from the GoogleTest
documentation, specifically the "Quickstart: Building with CMake"
guide:
https://google.github.io/googletest/quickstart-cmake.html
Fix warnings like
warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data
warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data
with Microsoft (R) C/C++ Optimizing Compiler Version 19.29.30037 for x64
CMake 3.19 starts warning:
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
Compatibility with CMake < 2.8.12 will be removed from a future version of
CMake.
CMake 3.5 is already a very low minimum requirement.