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 22module core.sys.posix.iconv; 23 24enum 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 33version (Posix): 34extern (C): 35nothrow: 36@nogc: 37@system: 38 39 40alias void* iconv_t; 41 42/// Allocate descriptor for code conversion from codeset FROMCODE to 43/// codeset TOCODE. 44iconv_t iconv_open (const scope char* tocode, const scope char* fromcode); 45 46/// Convert at most *INBYTESLEFT bytes from *INBUF according to the 47/// code conversion algorithm specified by CD and place up to 48/// *OUTBYTESLEFT bytes in buffer at *OUTBUF. 49size_t iconv (iconv_t cd, const scope char** inbuf, 50 size_t* inbytesleft, 51 char** outbuf, 52 size_t* outbytesleft); 53 54/// iconvctl queries or adjusts the behavior of the iconv function, 55/// when invoked with the specified conversion descriptor, 56/// depending on the request value. 57int iconvctl (iconv_t cd, int request, void* argument); 58 59/// Free resources allocated for descriptor CD for code conversion. 60int iconv_close (iconv_t cd); 61