xref: /freebsd/contrib/libcbor/src/cbor/internal/unicode.h (revision abd872540f24cfc7dbd1ea29b6918c7082a22108)
110ff414cSEd Maste /*
210ff414cSEd Maste  * Copyright (c) 2014-2020 Pavel Kalvoda <me@pavelkalvoda.com>
310ff414cSEd Maste  *
410ff414cSEd Maste  * libcbor is free software; you can redistribute it and/or modify
510ff414cSEd Maste  * it under the terms of the MIT license. See LICENSE for details.
610ff414cSEd Maste  */
710ff414cSEd Maste 
810ff414cSEd Maste #ifndef LIBCBOR_UNICODE_H
910ff414cSEd Maste #define LIBCBOR_UNICODE_H
1010ff414cSEd Maste 
1110ff414cSEd Maste #include "cbor/common.h"
1210ff414cSEd Maste 
1310ff414cSEd Maste #ifdef __cplusplus
1410ff414cSEd Maste extern "C" {
1510ff414cSEd Maste #endif
1610ff414cSEd Maste 
1710ff414cSEd Maste enum _cbor_unicode_status_error { _CBOR_UNICODE_OK, _CBOR_UNICODE_BADCP };
1810ff414cSEd Maste 
1910ff414cSEd Maste /** Signals unicode validation error and possibly its location */
2010ff414cSEd Maste struct _cbor_unicode_status {
2110ff414cSEd Maste   enum _cbor_unicode_status_error status;
22*abd87254SEd Maste   size_t location;
2310ff414cSEd Maste };
2410ff414cSEd Maste 
255d3e7166SEd Maste _CBOR_NODISCARD
26*abd87254SEd Maste size_t _cbor_unicode_codepoint_count(cbor_data source, size_t source_length,
2710ff414cSEd Maste                                      struct _cbor_unicode_status* status);
2810ff414cSEd Maste 
2910ff414cSEd Maste #ifdef __cplusplus
3010ff414cSEd Maste }
3110ff414cSEd Maste #endif
3210ff414cSEd Maste 
3310ff414cSEd Maste #endif  // LIBCBOR_UNICODE_H
34