xref: /freebsd/contrib/libcbor/src/cbor/internal/unicode.h (revision 3332f1b444d4a73238e9f59cca27bfc95fe936bd)
1 /*
2  * Copyright (c) 2014-2020 Pavel Kalvoda <me@pavelkalvoda.com>
3  *
4  * libcbor is free software; you can redistribute it and/or modify
5  * it under the terms of the MIT license. See LICENSE for details.
6  */
7 
8 #ifndef LIBCBOR_UNICODE_H
9 #define LIBCBOR_UNICODE_H
10 
11 #include "cbor/common.h"
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 
17 enum _cbor_unicode_status_error { _CBOR_UNICODE_OK, _CBOR_UNICODE_BADCP };
18 
19 /** Signals unicode validation error and possibly its location */
20 struct _cbor_unicode_status {
21   enum _cbor_unicode_status_error status;
22   size_t location;
23 };
24 
25 size_t _cbor_unicode_codepoint_count(cbor_data source, size_t source_length,
26                                      struct _cbor_unicode_status* status);
27 
28 #ifdef __cplusplus
29 }
30 #endif
31 
32 #endif  // LIBCBOR_UNICODE_H
33