bom.hpp
Go to the documentation of this file.
1 // Copyright (C) 2020-2024 Jonathan Müller and lexy contributors
2 // SPDX-License-Identifier: BSL-1.0
3 
4 #ifndef LEXY_DSL_BOM_HPP_INCLUDED
5 #define LEXY_DSL_BOM_HPP_INCLUDED
6 
7 #include <lexy/dsl/base.hpp>
8 #include <lexy/dsl/literal.hpp>
9 #include <lexy/dsl/token.hpp>
10 
11 namespace lexyd
12 {
13 template <typename Encoding, lexy::encoding_endianness Endianness>
14 struct _bom : _lit<unsigned char>
15 {};
16 template <lexy::encoding_endianness DontCare>
17 struct _bom<lexy::utf8_encoding, DontCare> //
18 : _lit<unsigned char, 0xEF, 0xBB, 0xBF>
19 {};
20 template <lexy::encoding_endianness DontCare>
21 struct _bom<lexy::utf8_char_encoding, DontCare> //
22 : _lit<unsigned char, 0xEF, 0xBB, 0xBF>
23 {};
24 template <>
26 : _lit<unsigned char, 0xFF, 0xFE>
27 {};
28 template <>
29 struct _bom<lexy::utf16_encoding, lexy::encoding_endianness::big> //
30 : _lit<unsigned char, 0xFE, 0xFF>
31 {};
32 template <>
34 : _lit<unsigned char, 0xFF, 0xFE, 0x00, 0x00>
35 {};
36 template <>
37 struct _bom<lexy::utf32_encoding, lexy::encoding_endianness::big>
38 : _lit<unsigned char, 0x00, 0x00, 0xFE, 0xFF>
39 {};
40 
42 template <typename Encoding, lexy::encoding_endianness Endianness>
43 inline constexpr auto bom = _bom<Encoding, Endianness>{};
44 } // namespace lexyd
45 
46 #endif // LEXY_DSL_BOM_HPP_INCLUDED
47 
lexy::encoding_endianness::little
@ little
Little endian.
token.hpp
literal.hpp
lexy
Definition: any_ref.hpp:12
lexy::encoding_endianness::big
@ big
Big endian.
lexyd::_bom
Definition: bom.hpp:14
lexyd::bom
constexpr auto bom
The BOM for that particular encoding.
Definition: bom.hpp:43
base.hpp
lexyd::_lit
Definition: char_class.hpp:300
lexyd
Definition: trace.hpp:22


behaviortree_cpp_v4
Author(s): Davide Faconti
autogenerated on Fri Dec 13 2024 03:19:16