2004-06-03 03:38:44 +00:00
|
|
|
/*-
|
|
|
|
* Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
|
|
|
|
* Redistribution and modifications are permitted subject to BSD license.
|
|
|
|
*/
|
|
|
|
#ifndef _UTF8String_H_
|
|
|
|
#define _UTF8String_H_
|
|
|
|
|
|
|
|
#include <OCTET_STRING.h>
|
|
|
|
|
2005-07-24 09:03:44 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2004-09-24 21:00:50 +00:00
|
|
|
typedef OCTET_STRING_t UTF8String_t; /* Implemented via OCTET STRING */
|
2004-06-03 03:38:44 +00:00
|
|
|
|
2004-09-29 13:26:15 +00:00
|
|
|
extern asn_TYPE_descriptor_t asn_DEF_UTF8String;
|
2004-06-03 03:38:44 +00:00
|
|
|
|
|
|
|
asn_struct_print_f UTF8String_print;
|
2004-09-22 16:06:28 +00:00
|
|
|
asn_constr_check_f UTF8String_constraint;
|
2004-06-03 03:38:44 +00:00
|
|
|
|
2004-10-02 15:55:07 +00:00
|
|
|
/*
|
|
|
|
* Returns length of the given UTF-8 string in characters,
|
|
|
|
* or a negative error code:
|
|
|
|
* -1: UTF-8 sequence truncated
|
|
|
|
* -2: Illegal UTF-8 sequence start
|
|
|
|
* -3: Continuation expectation failed
|
|
|
|
* -4: Not minimal length encoding
|
|
|
|
* -5: Invalid arguments
|
|
|
|
*/
|
|
|
|
ssize_t UTF8String_length(const UTF8String_t *st);
|
2004-06-03 03:38:44 +00:00
|
|
|
|
2004-10-23 11:20:06 +00:00
|
|
|
/*
|
|
|
|
* Convert the UTF-8 string into a sequence of wide characters.
|
|
|
|
* Returns the number of characters necessary.
|
|
|
|
* Returned value might be greater than dstlen.
|
|
|
|
* In case of conversion error, 0 is returned.
|
|
|
|
*
|
|
|
|
* If st points to a valid UTF-8 string, calling
|
|
|
|
* UTF8String_to_wcs(st, 0, 0);
|
|
|
|
* is equivalent to
|
|
|
|
* UTF8String_length(const UTF8String_t *st);
|
|
|
|
*/
|
|
|
|
size_t UTF8String_to_wcs(const UTF8String_t *st, uint32_t *dst, size_t dstlen);
|
|
|
|
|
2005-07-24 09:03:44 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2004-06-03 03:38:44 +00:00
|
|
|
#endif /* _UTF8String_H_ */
|