Files
postgresql/src/include/common/unicode_case.h
Jeff Davis 46e5441fa5 Add unicode_strtitle() for Unicode Default Case Conversion.
This brings the titlecasing implementation for the builtin provider
out of formatting.c and into unicode_case.c, along with
unicode_strlower() and unicode_strupper(). Accepts an arbitrary word
boundary callback.

Simple for now, but can be extended to support the Unicode Default
Case Conversion algorithm with full case mapping.

Discussion: https://postgr.es/m/3bc653b5d562ae9e2838b11cb696816c328a489a.camel@j-davis.com
Reviewed-by: Peter Eisentraut
2024-03-29 17:35:07 -07:00

33 lines
1.0 KiB
C

/*-------------------------------------------------------------------------
*
* 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"
typedef size_t (*WordBoundaryNext) (void *wbstate);
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,
ssize_t srclen);
size_t unicode_strtitle(char *dst, size_t dstsize, const char *src,
ssize_t srclen, WordBoundaryNext wbnext,
void *wbstate);
size_t unicode_strupper(char *dst, size_t dstsize, const char *src,
ssize_t srclen);
#endif /* UNICODE_CASE_H */