]> git.ipfire.org Git - thirdparty/gcc.git/blob - libphobos/libdruntime/core/sys/posix/iconv.d
Add D front-end, libphobos library, and D2 testsuite.
[thirdparty/gcc.git] / libphobos / libdruntime / core / sys / posix / iconv.d
1 /*******************************************************************************
2
3 D binding for the POSIX iconv library.
4
5 Defines external functions required to use iconv codeset conversion
6 function.
7
8 iconv_open(3) Allocates the descriptor for code conversion
9 iconv(3) Performs the conversion
10 iconvctl(3) Control iconv behavior
11 iconv_close(3) Deallocates allocated resources
12
13 Copyright: Copyright (c) 2016 Sociomantic Labs. All rights reserved.
14 License: $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0).
15 Authors: Nemanja Boric
16 Standards: POSIX.1-2001, POSIX.1-2008
17 See_Also:
18 http://pubs.opengroup.org/onlinepubs/009695399/functions/iconv_open.html
19
20 *******************************************************************************/
21
22 module core.sys.posix.iconv;
23
24 enum
25 {
26 ICONV_TRIVIALP = 0, /* int *argument */
27 ICONV_GET_TRANSLITERATE = 1, /* int *argument */
28 ICONV_SET_TRANSLITERATE = 2, /* const int *argument */
29 ICONV_GET_DISCARD_ILSEQ = 3, /* int *argument */
30 ICONV_SET_DISCARD_ILSEQ = 4, /* const int *argument */
31 }
32
33 version (Posix):
34 extern (C):
35 nothrow:
36 @nogc:
37
38
39 alias void* iconv_t;
40
41 /// Allocate descriptor for code conversion from codeset FROMCODE to
42 /// codeset TOCODE.
43 iconv_t iconv_open (in char* tocode, in char* fromcode);
44
45 /// Convert at most *INBYTESLEFT bytes from *INBUF according to the
46 /// code conversion algorithm specified by CD and place up to
47 /// *OUTBYTESLEFT bytes in buffer at *OUTBUF.
48 size_t iconv (iconv_t cd, in char** inbuf,
49 size_t* inbytesleft,
50 char** outbuf,
51 size_t* outbytesleft);
52
53 /// iconvctl queries or adjusts the behavior of the iconv function,
54 /// when invoked with the specified conversion descriptor,
55 /// depending on the request value.
56 int iconvctl (iconv_t cd, int request, void* argument);
57
58 /// Free resources allocated for descriptor CD for code conversion.
59 int iconv_close (iconv_t cd);