2 * Include file for unicode support used also for reactos files for libcaptive
3 * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; exactly version 2 of June 1991 is required
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 #ifndef _CAPTIVE_UNICODE_REACTOS_H
21 #define _CAPTIVE_UNICODE_REACTOS_H 1
24 #include <glib/gtypes.h> /* for guint16 */
25 #include <glib/gunicode.h> /* for gunichar */
26 /* captive/?*_reactos.h include files have forbidden any reactos/?* inclusions
27 * as they are being included by reactos/compat.h.
36 * This type is separated from Gnome #gunichar2 as #captive_ucs2 MUST be used for UCS-2
37 * encoded strings in the opposite of #gunichar2 beging used for UTF-16 encoded strings.
39 typedef guint16 captive_ucs2;
42 /* We can be G_GNUC_CONST as we really just map the pointer values.
43 * Initially we create the result content from the input content but it should not harm.
45 const captive_ucs2 *captive_ucs4_to_ucs2_const(const gunichar *string_ucs4) G_GNUC_CONST;
49 * captive_wchar32_to_ucs2_const:
50 * @string_wchar32: #const #wchar_t * type of 32-bit #wchar_t persistent string to convert.
51 * This string MUST remain readable with the same content forever.
52 * This string MUST be convertible to UCS-2 string.
54 * Constant string conversion from 32-bit #wchar_t to 16-bit #wchar_t.
55 * You may not modify the result in any way.
57 * It is guaranteed to get two different string addresses for two different
58 * input addresses even if the input strings content is the same.
59 * Otherwise we would behave as #GCC option %-fmerge-constants which
60 * results in %C non-conforming behaviour.
62 * This function is a pure pass to captive_ucs4_to_ucs2_const()
63 * to implement proper type checking of the passed @string_wchar32.
65 * Returns: #const #captive_ucs2 * converted string @string_ucs4.
67 static inline const captive_ucs2 *captive_wchar32_to_ucs2_const(const wchar_t *string_wchar32) G_GNUC_UNUSED;
68 static inline const captive_ucs2 *captive_wchar32_to_ucs2_const(const wchar_t *string_wchar32)
70 return captive_ucs4_to_ucs2_const((const gunichar *)string_wchar32);
76 #endif /* _CAPTIVE_UNICODE_REACTOS_H */