1 /** Enum type for supporting encodings in libpqxx
2  *
3  * Copyright (c) 2000-2020, Jeroen T. Vermeulen.
4  *
5  * See COPYING for copyright license.  If you did not receive a file called
6  * COPYING with this source code, please notify the distributor of this
7  * mistake, or contact the author.
8  */
9 #ifndef PQXX_H_ENCODING_GROUP
10 #define PQXX_H_ENCODING_GROUP
11 
12 #include <cstddef>
13 
14 namespace pqxx::internal
15 {
16 // Types of encodings supported by PostgreSQL, see
17 // https://www.postgresql.org/docs/current/static/multibyte.html#CHARSET-TABLE
18 enum class encoding_group
19 {
20   // Handles all single-byte fixed-width encodings
21   MONOBYTE,
22 
23   // Multibyte encodings
24   BIG5,
25   EUC_CN,
26   EUC_JP,
27   EUC_JIS_2004,
28   EUC_KR,
29   EUC_TW,
30   GB18030,
31   GBK,
32   JOHAB,
33   MULE_INTERNAL,
34   SJIS,
35   SHIFT_JIS_2004,
36   UHC,
37   UTF8,
38 };
39 
40 
41 /// Function type: "find the end of the current glyph."
42 /** This type of function takes a text buffer, and a location in that buffer,
43  * and returns the location one byte past the end of the current glyph.
44  *
45  * The start offset marks the beginning of the current glyph.  It must fall
46  * within the buffer.
47  *
48  * There are multiple different glyph scnaner implementations, for different
49  * kinds of encodings.
50  */
51 using glyph_scanner_func =
52   std::size_t(char const buffer[], std::size_t buffer_len, std::size_t start);
53 } // namespace pqxx::internal
54 
55 #endif
56