ITS
UTF8String.h
Go to the documentation of this file.
1 /*-
2  * Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
3  * Redistribution and modifications are permitted subject to BSD license.
4  */
5 #ifndef _UTF8String_H_
6 #define _UTF8String_H_
7 
8 #include <OCTET_STRING.h>
9 
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13 
14 typedef OCTET_STRING_t UTF8String_t; /* Implemented via OCTET STRING */
15 
17 
20 
21 /*
22  * Returns length of the given UTF-8 string in characters,
23  * or a negative error code:
24  * -1: UTF-8 sequence truncated
25  * -2: Illegal UTF-8 sequence start
26  * -3: Continuation expectation failed
27  * -4: Not minimal length encoding
28  * -5: Invalid arguments
29  */
30 ssize_t UTF8String_length(const UTF8String_t *st);
31 
32 /*
33  * Convert the UTF-8 string into a sequence of wide characters.
34  * Returns the number of characters necessary.
35  * Returned value might be greater than dstlen.
36  * In case of conversion error, 0 is returned.
37  *
38  * If st points to a valid UTF-8 string, calling
39  * UTF8String_to_wcs(st, 0, 0);
40  * is equivalent to
41  * UTF8String_length(const UTF8String_t *st);
42  */
43 size_t UTF8String_to_wcs(const UTF8String_t *st, uint32_t *dst, size_t dstlen);
44 
45 #ifdef __cplusplus
46 }
47 #endif
48 
49 #endif /* _UTF8String_H_ */
OCTET_STRING_t UTF8String_t
Definition: UTF8String.h:14
asn_TYPE_descriptor_t asn_DEF_UTF8String
Definition: UTF8String.c:16
ssize_t UTF8String_length(const UTF8String_t *st)
Definition: UTF8String.c:153
size_t UTF8String_to_wcs(const UTF8String_t *st, uint32_t *dst, size_t dstlen)
Definition: UTF8String.c:162
int() asn_constr_check_f(struct asn_TYPE_descriptor_s *type_descriptor, const void *struct_ptr, asn_app_constraint_failed_f *optional_callback, void *optional_app_key)
Definition: constraints.h:40
int() asn_struct_print_f(struct asn_TYPE_descriptor_s *type_descriptor, const void *struct_ptr, int level, asn_app_consume_bytes_f *callback, void *app_key)
Definition: constr_TYPE.h:63
asn_constr_check_f UTF8String_constraint
Definition: UTF8String.h:19
asn_struct_print_f UTF8String_print
Definition: UTF8String.h:18