Browse Source

Fix some missing headers

master
Jessica James 1 year ago
parent
commit
644a4e2e27
  1. 1
      src/include/jessilib/unicode_sequence.hpp
  2. 1
      src/include/jessilib/unicode_syntax.hpp
  3. 8
      src/include/jessilib/util.hpp
  4. 1
      src/include/jessilib/word_split.hpp
  5. 3
      src/test/unicode.cpp
  6. 8
      src/test/unicode_sequence.cpp

1
src/include/jessilib/unicode_sequence.hpp

@ -26,6 +26,7 @@
#pragma once
#include "unicode_base.hpp"
#include <algorithm>
namespace jessilib {

1
src/include/jessilib/unicode_syntax.hpp

@ -26,6 +26,7 @@
#pragma once
#include <limits>
#include <algorithm>
#include "unicode.hpp"
namespace jessilib {

8
src/include/jessilib/util.hpp

@ -21,6 +21,8 @@
#include <cstddef>
#include <charconv>
#include <string>
#include <algorithm>
#include <bit>
/** Macros */
@ -140,6 +142,10 @@ constexpr T square(T in_value) {
return in_value * in_value;
}
#ifdef __cpp_lib_byteswap
using std::byteswap;
#else
template<typename IntegerT>
constexpr IntegerT byteswap(IntegerT in_integer) { // TODO: Remove w/ C++23
static_assert(sizeof(IntegerT) > 1, "byteswap on single byte does nothing");
@ -171,6 +177,8 @@ constexpr IntegerT byteswap(IntegerT in_integer) { // TODO: Remove w/ C++23
}
}
#endif // __cpp_lib_byteswap
template<typename CharT>
void array_byteswap(CharT* begin, CharT* end) {
while (begin != end) {

1
src/include/jessilib/word_split.hpp

@ -28,6 +28,7 @@
#include <string_view>
#include <vector>
#include <tuple>
#include <algorithm>
namespace jessilib {

3
src/test/unicode.cpp

@ -19,6 +19,7 @@
#include "jessilib/unicode.hpp"
#include <fstream>
#include <charconv>
#include <algorithm>
#include "jessilib/split.hpp"
#include "test.hpp"
@ -466,7 +467,7 @@ std::vector<folding_set> folding_sets_from_folding_info(const std::vector<foldin
std::vector<folding_set> result;
folding_set current{};
uint32_t last_match;
uint32_t last_match{};
for (auto& info : in_info) {
int64_t diff = static_cast<int64_t>(info.out_codepoint) - static_cast<int64_t>(info.in_codepoint);

8
src/test/unicode_sequence.cpp

@ -25,13 +25,13 @@ using namespace std::literals;
// Compile-time tests for constexpr on compilers which support C++20 constexpr std::string
#if defined(__cpp_lib_constexpr_string) && (__GNUC__ >= 12 || _MSC_VER >= 1929)
constexpr std::string cpp_constexpr(std::string_view in_expression) {
std::string result{ static_cast<std::string>(in_expression) };
constexpr std::u8string cpp_constexpr(std::u8string_view in_expression) {
std::u8string result{ static_cast<std::u8string>(in_expression) };
jessilib::apply_cpp_escape_sequences(result);
return result;
}
ASSERT_COMPILES_CONSTEXPR(return cpp_constexpr("test"s) == "test"s);
ASSERT_COMPILES_CONSTEXPR(return cpp_constexpr("\\r\\n"s) == "\r\n"s);
ASSERT_COMPILES_CONSTEXPR(return cpp_constexpr(u8"test"s) == u8"test"s);
ASSERT_COMPILES_CONSTEXPR(return cpp_constexpr(u8"\\r\\n"s) == u8"\r\n"s);
#endif // __cpp_lib_constexpr_string
#ifdef JESSILIB_CHAR_AS_UTF8

Loading…
Cancel
Save