summaryrefslogtreecommitdiff
path: root/src/include/common/unicode_case.h
diff options
context:
space:
mode:
authorJeff Davis2024-03-07 19:15:06 +0000
committerJeff Davis2024-03-07 19:15:06 +0000
commit5c40364dd6d9c6a260c8965dffe2e066642d6f79 (patch)
tree229ba6adf17935fe7f54f6cca3c3856267302d15 /src/include/common/unicode_case.h
parent6d470211e54f7a617783b99b27c9d8056a890a57 (diff)
Unicode case mapping tables and functions.
Implements Unicode simple case mapping, in which all code points map to exactly one other code point unconditionally. These tables are generated from UnicodeData.txt, which is already being used by other infrastructure in src/common/unicode. The tables are checked into the source tree, so they only need to be regenerated when we update the Unicode version. In preparation for the builtin collation provider, and possibly useful for other callers. Discussion: https://postgr.es/m/ff4c2f2f9c8fc7ca27c1c24ae37ecaeaeaff6b53.camel%40j-davis.com Reviewed-by: Peter Eisentraut, Daniel Verite, Jeremy Schneider
Diffstat (limited to 'src/include/common/unicode_case.h')
-rw-r--r--src/include/common/unicode_case.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/include/common/unicode_case.h b/src/include/common/unicode_case.h
new file mode 100644
index 00000000000..ad6f62cc41d
--- /dev/null
+++ b/src/include/common/unicode_case.h
@@ -0,0 +1,27 @@
+/*-------------------------------------------------------------------------
+ *
+ * unicode_case.h
+ * Routines for converting character case.
+ *
+ * These definitions can be used by both frontend and backend code.
+ *
+ * Copyright (c) 2017-2023, PostgreSQL Global Development Group
+ *
+ * src/include/common/unicode_case.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef UNICODE_CASE_H
+#define UNICODE_CASE_H
+
+#include "mb/pg_wchar.h"
+
+pg_wchar unicode_lowercase_simple(pg_wchar ucs);
+pg_wchar unicode_titlecase_simple(pg_wchar ucs);
+pg_wchar unicode_uppercase_simple(pg_wchar ucs);
+size_t unicode_strlower(char *dst, size_t dstsize, const char *src,
+ size_t srclen);
+size_t unicode_strupper(char *dst, size_t dstsize, const char *src,
+ size_t srclen);
+
+#endif /* UNICODE_CASE_H */