libUEMF
A portable library for reading and writing WMF, EMF and EMF+ files
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
uemf_utf.h
Go to the documentation of this file.
1 
8 /*
9 File: uemf_utf.h
10 Version: 0.0.1
11 Date: 04-DEC-2012
12 Author: David Mathog, Biology Division, Caltech
13 email: mathog@caltech.edu
14 Copyright: 2012 David Mathog and California Institute of Technology (Caltech)
15 */
16 
17 #ifndef _UEMF_UTF_
18 #define _UEMF_UTF_
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 #include <stdint.h>
25 #include <stdbool.h>
26 #include "uemf_endian.h"
27 
28 void wchar8show(const char *src);
29 void wchar16show(const uint16_t *src);
30 void wchar32show(const uint32_t *src);
31 void wchartshow(const wchar_t *src);
32 
33 size_t wchar16len(const uint16_t *src);
34 size_t wchar32len(const uint32_t *src);
35 void wchar16strncpy(uint16_t *dst, const uint16_t *src, size_t nchars);
36 void wchar16strncpypad(uint16_t *dst, const uint16_t *src, size_t nchars);
37 uint16_t *U_Utf8ToUtf16le( const char *src, size_t max, size_t *len );
38 uint32_t *U_Utf8ToUtf32le( const char *src, size_t max, size_t *len );
39 uint32_t *U_Latin1ToUtf32le( const char *src, size_t max, size_t *len );
40 uint16_t *U_Utf32leToUtf16le( const uint32_t *src, size_t max, size_t *len );
41 char *U_Utf32leToUtf8( const uint32_t *src, size_t max, size_t *len );
42 uint32_t *U_Utf16leToUtf32le( const uint16_t *src, size_t max, size_t *len );
43 char *U_Utf16leToUtf8( const uint16_t *src, size_t max, size_t *len );
44 char *U_Utf16leToLatin1( const uint16_t *src, size_t max, size_t *len );
45 char *U_Utf8ToLatin1( const char *src, size_t max, size_t *len );
46 char *U_Latin1ToUtf8( const char *src, size_t max, size_t *len );
47 uint16_t U_Utf16le(const uint16_t src);
48 int U_Utf16leEdit( uint16_t *src, uint16_t find, uint16_t replace );
49 char *U_strdup(const char *s);
50 
51 #ifdef __cplusplus
52 }
53 #endif
54 
55 #endif /* _UEMF_UTF_ */
char * U_Utf8ToLatin1(const char *src, size_t max, size_t *len)
Convert a UTF8 string to a Latin1 string.
Definition: uemf_utf.c:455
int U_Utf16leEdit(uint16_t *src, uint16_t find, uint16_t replace)
Single character replacement in a UTF-16LE string.
Definition: uemf_utf.c:520
char * U_strdup(const char *s)
strdup for when strict C99 compliance is enforced
Definition: uemf_utf.c:539
void wchar32show(const uint32_t *src)
Dump a UTF32 string. Not for use in production code.
Definition: uemf_utf.c:91
void wchar16show(const uint16_t *src)
Dump a UTF16 string. Not for use in production code.
Definition: uemf_utf.c:80
void wchar8show(const char *src)
Dump a UTF8 string. Not for use in production code.
Definition: uemf_utf.c:68
uint16_t U_Utf16le(const uint16_t src)
Put a single 16 bit character into UTF-16LE form.
Definition: uemf_utf.c:436
char * U_Utf32leToUtf8(const uint32_t *src, size_t max, size_t *len)
Convert a UTF32LE string to a UTF8 string.
Definition: uemf_utf.c:314
void wchartshow(const wchar_t *src)
Dump a wchar_t string. Not for use in production code.
Definition: uemf_utf.c:103
char * U_Latin1ToUtf8(const char *src, size_t max, size_t *len)
Convert a Latin1 string to a UTF8 string.
Definition: uemf_utf.c:487
uint32_t * U_Utf8ToUtf32le(const char *src, size_t max, size_t *len)
Convert a UTF8 string to a UTF32LE string.
Definition: uemf_utf.c:285
uint16_t * U_Utf32leToUtf16le(const uint32_t *src, size_t max, size_t *len)
Convert a UTF32LE string to a UTF16LE string.
Definition: uemf_utf.c:192
size_t wchar16len(const uint16_t *src)
Find the number of (storage) characters in a 16 bit character string, not including terminator...
Definition: uemf_utf.c:126
Defintions and prototype for function for converting EMF records between Big Endian and Little Endian...
void wchar16strncpy(uint16_t *dst, const uint16_t *src, size_t nchars)
Strncpy for wchar16 (UTF16).
Definition: uemf_utf.c:152
size_t wchar32len(const uint32_t *src)
Find the number of (storage) characters in a 32 bit character string, not including terminator...
Definition: uemf_utf.c:138
void wchar16strncpypad(uint16_t *dst, const uint16_t *src, size_t nchars)
Fill the output string with N characters, if the input string is shorter than N, pad with nulls...
Definition: uemf_utf.c:170
char * U_Utf16leToLatin1(const uint16_t *src, size_t max, size_t *len)
Convert a UTF16LE string to a LATIN1 string.
Definition: uemf_utf.c:405
uint32_t * U_Utf16leToUtf32le(const uint16_t *src, size_t max, size_t *len)
Convert a UTF16LE string to a UTF32LE string.
Definition: uemf_utf.c:221
char * U_Utf16leToUtf8(const uint16_t *src, size_t max, size_t *len)
Convert a UTF16LE string to a UTF8 string.
Definition: uemf_utf.c:373
uint32_t * U_Latin1ToUtf32le(const char *src, size_t max, size_t *len)
Convert a Latin1 string to a UTF32LE string.
Definition: uemf_utf.c:256
uint16_t * U_Utf8ToUtf16le(const char *src, size_t max, size_t *len)
Convert a UTF-8 string to a UTF16-LE string.
Definition: uemf_utf.c:343