<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
                   "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<!-- lifted from troff+man by doclifter -->
<refentry id='xtlttpropman'>
<!-- '\" t -->
<!--  Copyright \(co 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1994, 1996 X Consortium -->
<!--  Copyright \(co 2000  The XFree86 Project, Inc. -->

<!--  Permission is hereby granted, free of charge, to any person obtaining -->
<!--  a copy of this software and associated documentation files (the -->
<!--  "Software"), to deal in the Software without restriction, including -->
<!--  without limitation the rights to use, copy, modify, merge, publish, -->
<!--  distribute, sublicense, and/or sell copies of the Software, and to -->
<!--  permit persons to whom the Software is furnished to do so, subject to -->
<!--  the following conditions: -->

<!--  The above copyright notice and this permission notice shall be included -->
<!--  in all copies or substantial portions of the Software. -->

<!--  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -->
<!--  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -->
<!--  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -->
<!--  IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR -->
<!--  OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -->
<!--  ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -->
<!--  OTHER DEALINGS IN THE SOFTWARE. -->

<!--  Except as contained in this notice, the name of the X Consortium shall -->
<!--  not be used in advertising or otherwise to promote the sale, use or -->
<!--  other dealings in this Software without prior written authorization -->
<!--  from the X Consortium. -->

<!--  Copyright \(co 1985, 1986, 1987, 1988, 1989, 1990, 1991 by -->
<!--  Digital Equipment Corporation -->

<!--  Portions Copyright \(co 1990, 1991 by -->
<!--  Tektronix, Inc. -->

<!--  Permission to use, copy, modify and distribute this documentation for -->
<!--  any purpose and without fee is hereby granted, provided that the above -->
<!--  copyright notice appears in all copies and that both that copyright notice -->
<!--  and this permission notice appear in all copies, and that the names of -->
<!--  Digital and Tektronix not be used in in advertising or publicity pertaining -->
<!--  to this documentation without specific, written prior permission. -->
<!--  Digital and Tektronix makes no representations about the suitability -->
<!--  of this documentation for any purpose. -->
<!--  It is provided ``as is'' without express or implied warranty. -->

<!--  $XFree86: xc/doc/man/X11/XTLTTProp.man,v 1.7 2003/11/23 05:40:33 dawes Exp $ -->

<!-- .na -->
<!-- FD listing suppressed (not used) -->
<!-- FN listing suppressed (not used) -->
<!-- IN listing suppressed (not used) -->
<!-- C{ listing suppressed (not used) -->
<!-- C} listing suppressed (not used) -->
<!-- Pn listing suppressed (not used) -->
<!-- hN listing suppressed (not used) -->
<!-- NT listing suppressed (not used) -->
<!-- .		\" Note End \-\- doug kraft 3/85 -->
<!-- NE listing suppressed (not used) -->
<!-- .ny0 -->
<!-- '\" t -->
<refmeta>
<refentrytitle>XmbTextListToTextProperty</refentrytitle>
<manvolnum>3X11</manvolnum>
<refmiscinfo class='date'>__xorgversion__</refmiscinfo>
<refmiscinfo class='source'>XLIB FUNCTIONS</refmiscinfo>
</refmeta>
<refnamediv id='name'>
<refname>XmbTextListToTextProperty</refname>
<refname>XwcTextListToTextProperty</refname>
<refname>Xutf8TextListToTextProperty</refname>
<refname>XmbTextPropertyToTextList</refname>
<refname>XwcTextPropertyToTextList</refname>
<refname>Xutf8TextPropertyToTextList</refname>
<refname>XwcFreeStringList</refname>
<refname>XDefaultString</refname>
<refpurpose>convert text lists and text property structures</refpurpose>
</refnamediv>
<!-- body begins here -->

<refsect1 id='syntax'><title>SYNTAX</title>

<para>int XmbTextListToTextProperty&hairsp;(&hairsp;Display *<emphasis remap='I'>display</emphasis>&hairsp;, char
**<emphasis remap='I'>list</emphasis>&hairsp;, int <emphasis remap='I'>count</emphasis>&hairsp;, XICCEncodingStyle <emphasis remap='I'>style</emphasis>&hairsp;,
XTextProperty *<emphasis remap='I'>text_prop_return</emphasis>&hairsp;);</para> 

<para>int XwcTextListToTextProperty&hairsp;(&hairsp;Display *<emphasis remap='I'>display</emphasis>&hairsp;, wchar_t
**<emphasis remap='I'>list</emphasis>&hairsp;, int <emphasis remap='I'>count</emphasis>&hairsp;, XICCEncodingStyle <emphasis remap='I'>style</emphasis>&hairsp;,
XTextProperty *<emphasis remap='I'>text_prop_return</emphasis>&hairsp;);</para> 

<para>int Xutf8TextListToTextProperty&hairsp;(&hairsp;Display *<emphasis remap='I'>display</emphasis>&hairsp;, char
**<emphasis remap='I'>list</emphasis>&hairsp;, int <emphasis remap='I'>count</emphasis>&hairsp;, XICCEncodingStyle <emphasis remap='I'>style</emphasis>&hairsp;,
XTextProperty *<emphasis remap='I'>text_prop_return</emphasis>&hairsp;);</para> 

<para>int XmbTextPropertyToTextList&hairsp;(&hairsp;Display *<emphasis remap='I'>display</emphasis>&hairsp;, XTextProperty
*<emphasis remap='I'>text_prop</emphasis>&hairsp;, char ***<emphasis remap='I'>list_return</emphasis>&hairsp;, int *<emphasis remap='I'>count_return</emphasis>&hairsp;);</para> 

<para>int XwcTextPropertyToTextList&hairsp;(&hairsp;Display *<emphasis remap='I'>display</emphasis>&hairsp;, XTextProperty
*<emphasis remap='I'>text_prop</emphasis>&hairsp;, wchar_t ***<emphasis remap='I'>list_return</emphasis>&hairsp;, int
*<emphasis remap='I'>count_return</emphasis>&hairsp;);</para> 

<para>int Xutf8TextPropertyToTextList&hairsp;(&hairsp;Display *<emphasis remap='I'>display</emphasis>&hairsp;, XTextProperty
*<emphasis remap='I'>text_prop</emphasis>&hairsp;, char ***<emphasis remap='I'>list_return</emphasis>&hairsp;, int *<emphasis remap='I'>count_return</emphasis>&hairsp;);</para> 

<para>void XwcFreeStringList&hairsp;(&hairsp;wchar_t **<emphasis remap='I'>list</emphasis>&hairsp;);</para> 

<para>char *XDefaultString&hairsp;(void)</para>
</refsect1>

<refsect1 id='arguments'><title>ARGUMENTS</title>
<variablelist remap='IP'>
  <varlistentry>
  <term><emphasis remap='I'>display</emphasis></term>
  <listitem>
<para>Specifies the connection to the X server.</para>
  </listitem>
  </varlistentry>
  <varlistentry>
  <term><emphasis remap='I'>list</emphasis></term>
  <listitem>
<para>Specifies a list of null-terminated character strings.</para>
  </listitem>
  </varlistentry>
  <varlistentry>
  <term><emphasis remap='I'>count</emphasis></term>
  <listitem>
<para>Specifies the number of strings specified.</para>
  </listitem>
  </varlistentry>
  <varlistentry>
  <term><emphasis remap='I'>style</emphasis></term>
  <listitem>
<para>Specifies the manner in which the property is encoded.</para>
  </listitem>
  </varlistentry>
  <varlistentry>
  <term><emphasis remap='I'>text_prop_return</emphasis></term>
  <listitem>
<para>Returns the
<emphasis remap='I'>&hairsp;XTextProperty&hairsp;</emphasis>
structure.</para>
  </listitem>
  </varlistentry>
  <varlistentry>
  <term><emphasis remap='I'>text_prop</emphasis></term>
  <listitem>
<para>Specifies the
<emphasis remap='I'>&hairsp;XTextProperty&hairsp;</emphasis>
structure to be used.</para>
  </listitem>
  </varlistentry>
  <varlistentry>
  <term><emphasis remap='I'>list_return</emphasis></term>
  <listitem>
<para>Returns a list of null-terminated character strings.</para>
  </listitem>
  </varlistentry>
  <varlistentry>
  <term><emphasis remap='I'>count_return</emphasis></term>
  <listitem>
<para>Returns the number of strings.</para>
  </listitem>
  </varlistentry>
  <varlistentry>
  <term><emphasis remap='I'>list</emphasis></term>
  <listitem>
<para>Specifies the list of strings to be freed.</para>
  </listitem>
  </varlistentry>
</variablelist>
</refsect1>

<refsect1 id='description'><title>DESCRIPTION</title>
<para>The
<emphasis remap='I'>&hairsp;XmbTextListToTextProperty&hairsp;</emphasis>,
<emphasis remap='I'>&hairsp;XwcTextListToTextProperty&hairsp;</emphasis>
and
<emphasis remap='I'>&hairsp;Xutf8TextListToTextProperty&hairsp;</emphasis>
functions set the specified 
<emphasis remap='I'>&hairsp;XTextProperty&hairsp;</emphasis>
value to a set of null-separated elements representing the concatenation
of the specified list of null-terminated text strings. The input text
strings must be given in the current locale encoding (for
<emphasis remap='I'>&hairsp;XmbTextListToTextProperty&hairsp;</emphasis>
and
<emphasis remap='I'>&hairsp;XwcTextListToTextProperty&hairsp;</emphasis>),
or in UTF-8 encoding (for
<emphasis remap='I'>&hairsp;Xutf8TextListToTextProperty&hairsp;</emphasis>).</para>

<para>The functions set the encoding field of text_prop_return to an
<emphasis remap='I'>&hairsp;Atom&hairsp;</emphasis>
for the specified display 
naming the encoding determined by the specified style
and convert the specified text list to this encoding for storage in
the text_prop_return value field.
If the style 
<emphasis remap='I'>&hairsp;XStringStyle&hairsp;</emphasis>
or 
<emphasis remap='I'>&hairsp;XCompoundTextStyle&hairsp;</emphasis>
is specified,
this encoding is &ldquo;STRING&rdquo; or &ldquo;COMPOUND_TEXT&rdquo;, respectively.
If the style
<emphasis remap='I'>&hairsp;XUTF8StringStyle&hairsp;</emphasis>
is specified,
this encoding is &ldquo;UTF8_STRING&rdquo;. (This is an XFree86 extension introduced in
XFree86 4.0.2. Its presence is indicated by the macro
<emphasis remap='I'>&hairsp;X_HAVE_UTF8_STRING&hairsp;</emphasis>.)
If the style 
<emphasis remap='I'>&hairsp;XTextStyle&hairsp;</emphasis>
is specified,
this encoding is the encoding of the current locale.
If the style 
<emphasis remap='I'>&hairsp;XStdICCTextStyle&hairsp;</emphasis>
is specified,
this encoding is &ldquo;STRING&rdquo; if the text is fully convertible to STRING,
else &ldquo;COMPOUND_TEXT&rdquo;.
A final terminating null byte is stored at the end of the value field 
of text_prop_return but is not included in the nitems member.</para>

<para>If insufficient memory is available for the new value string,
the functions return 
<emphasis remap='I'>&hairsp;XNoMemory&hairsp;</emphasis>.
If the current locale is not supported,
the functions return 
<emphasis remap='I'>&hairsp;XLocaleNotSupported&hairsp;</emphasis>.
In both of these error cases,
the functions do not set text_prop_return.</para>

<para>To determine if the functions are guaranteed not to return
<emphasis remap='I'>&hairsp;XLocaleNotSupported&hairsp;</emphasis>,
use
<emphasis remap='I'>&hairsp;XSupportsLocale&hairsp;</emphasis>.</para>

<para>If the supplied text is not fully convertible to the specified encoding,
the functions return the number of unconvertible characters.
Each unconvertible character is converted to an implementation-defined and
encoding-specific default string.
Otherwise, the functions return 
<emphasis remap='I'>&hairsp;Success&hairsp;</emphasis>.
Note that full convertibility to all styles except 
<emphasis remap='I'>&hairsp;XStringStyle&hairsp;</emphasis>
is guaranteed.</para>

<para>To free the storage for the value field, use
<emphasis remap='I'>&hairsp;XFree&hairsp;</emphasis>.</para>

<para>The 
<emphasis remap='I'>&hairsp;XmbTextPropertyToTextList&hairsp;</emphasis>,
<emphasis remap='I'>&hairsp;XwcTextPropertyToTextList&hairsp;</emphasis>
and 
<emphasis remap='I'>&hairsp;Xutf8TextPropertyToTextList&hairsp;</emphasis>
functions return a list of text strings representing the
null-separated elements of the specified
<emphasis remap='I'>&hairsp;XTextProperty&hairsp;</emphasis>
structure. The returned strings are encoded using the current locale encoding
(for
<emphasis remap='I'>&hairsp;XmbTextPropertyToTextList&hairsp;</emphasis>
and
<emphasis remap='I'>&hairsp;XwcTextPropertyToTextList&hairsp;</emphasis>)
or in UTF-8 (for
<emphasis remap='I'>&hairsp;Xutf8TextPropertyToTextList&hairsp;</emphasis>).
The data in text_prop must be format 8.</para>

<para>Multiple elements of the property (for example, the strings in a disjoint
text selection) are separated by a null byte.
The contents of the property are not required to be null-terminated;
any terminating null should not be included in text_prop.nitems.</para>

<para>If insufficient memory is available for the list and its elements,
<emphasis remap='I'>&hairsp;XmbTextPropertyToTextList&hairsp;</emphasis>,
<emphasis remap='I'>&hairsp;XwcTextPropertyToTextList&hairsp;</emphasis>
and
<emphasis remap='I'>&hairsp;Xutf8TextPropertyToTextList&hairsp;</emphasis>
return 
<emphasis remap='I'>&hairsp;XNoMemory&hairsp;</emphasis>.
If the current locale is not supported,
the functions return
<emphasis remap='I'>&hairsp;XLocaleNotSupported&hairsp;</emphasis>.
Otherwise, if the encoding field of text_prop is not convertible 
to the encoding of the current locale,
the functions return
<emphasis remap='I'>&hairsp;XConverterNotFound&hairsp;</emphasis>.
For supported locales,
existence of a converter from COMPOUND_TEXT, STRING, UTF8_STRING
or the encoding of the current locale is guaranteed if
<emphasis remap='I'>&hairsp;XSupportsLocale&hairsp;</emphasis>
returns 
<emphasis remap='I'>&hairsp;True&hairsp;</emphasis>
for the current locale (but the actual text
may contain unconvertible characters).
Conversion of other encodings is implementation-dependent.
In all of these error cases,
the functions do not set any return values.</para>

<para>Otherwise, 
<emphasis remap='I'>&hairsp;XmbTextPropertyToTextList&hairsp;</emphasis>,
<emphasis remap='I'>&hairsp;XwcTextPropertyToTextList&hairsp;</emphasis>
and
<emphasis remap='I'>&hairsp;Xutf8TextPropertyToTextList&hairsp;</emphasis>
return the list of null-terminated text strings to list_return
and the number of text strings to count_return.</para>

<para>If the value field of text_prop is not fully convertible to the
encoding of the current locale,
the functions return the number of unconvertible characters.
Each unconvertible character is converted to a string in the
current locale that is specific to the current locale.
To obtain the value of this string, 
use
<emphasis remap='I'>&hairsp;XDefaultString&hairsp;</emphasis>.
Otherwise,
<emphasis remap='I'>&hairsp;XmbTextPropertyToTextList&hairsp;</emphasis>,
<emphasis remap='I'>&hairsp;XwcTextPropertyToTextList&hairsp;</emphasis>
and
<emphasis remap='I'>&hairsp;Xutf8TextPropertyToTextList&hairsp;</emphasis>
return 
<emphasis remap='I'>&hairsp;Success&hairsp;</emphasis>.</para>

<para>To free the storage for the list and its contents returned by
<emphasis remap='I'>&hairsp;XmbTextPropertyToTextList&hairsp;</emphasis>
or
<emphasis remap='I'>&hairsp;Xutf8TextPropertyToTextList&hairsp;</emphasis>,
use
<emphasis remap='I'>&hairsp;XFreeStringList&hairsp;</emphasis>.
To free the storage for the list and its contents returned by
<emphasis remap='I'>&hairsp;XwcTextPropertyToTextList&hairsp;</emphasis>,
use
<emphasis remap='I'>&hairsp;XwcFreeStringList&hairsp;</emphasis>.</para>

<para>The
<emphasis remap='I'>&hairsp;XwcFreeStringList&hairsp;</emphasis>
function frees memory allocated by
<emphasis remap='I'>&hairsp;XwcTextPropertyToTextList&hairsp;</emphasis>.</para>

<para>The
<emphasis remap='I'>&hairsp;XDefaultString&hairsp;</emphasis>
function returns the default string used by Xlib for text conversion
(for example, in 
<emphasis remap='I'>&hairsp;XmbTextPropertyToTextList&hairsp;</emphasis>).
The default string is the string in the current locale that is output 
when an unconvertible character is found during text conversion.
If the string returned by
<emphasis remap='I'>&hairsp;XDefaultString&hairsp;</emphasis>
is the empty string ("&hairsp;"),
no character is output in the converted text.
<emphasis remap='I'>&hairsp;XDefaultString&hairsp;</emphasis>
does not return NULL.</para>

<para>The string returned by 
<emphasis remap='I'>&hairsp;XDefaultString&hairsp;</emphasis>
is independent of the default string for text drawing;
see 
<emphasis remap='I'>&hairsp;XCreateFontSet&hairsp;</emphasis>
to obtain the default string for an
<emphasis remap='I'>&hairsp;XFontSet&hairsp;</emphasis>.</para>

<para>The behavior when an invalid codepoint is supplied to any Xlib function is
undefined.</para>

<para>The returned string is null-terminated.
It is owned by Xlib and should not be modified or freed by the client.
It may be freed after the current locale is changed.
Until freed, it will not be modified by Xlib.</para>

<para>The functions
<emphasis remap='I'>&hairsp;Xutf8TextListToTextProperty&hairsp;</emphasis>
and
<emphasis remap='I'>&hairsp;Xutf8TextPropertyToTextList&hairsp;</emphasis>
are an XFree86 extension introduced in XFree86 4.0.2. Their presence is
indicated by the macro
<emphasis remap='I'>&hairsp;X_HAVE_UTF8_STRING&hairsp;</emphasis>.</para>
</refsect1>

<refsect1 id='structures'><title>STRUCTURES</title>
<para>The
<emphasis remap='I'>&hairsp;XTextProperty&hairsp;</emphasis>
structure contains:</para>

<literallayout remap='.nf'>
<!-- .0D  0 -->

<!-- .ps \n(PS -->
<!-- .if \n(VS&gt;=40 .vs \n(VSu -->
<!-- .if \n(VS&lt;=39 .vs \n(VSp -->
<!-- .TA .5i 2.5i -->
<!-- .ta .5i 2.5i -->
typedef struct {
	unsigned char *value;	/&lowast; property data */
	Atom encoding;	/&lowast; type of property */
	int format;	/&lowast; 8, 16, or 32 */
	unsigned long nitems;	/&lowast; number of items in value */
} XTextProperty;
<!-- .ce 0  IGNORED -->
<!-- .in \n(OIu  IGNORED -->

</literallayout> <!-- .fi -->

<para>The
<emphasis remap='I'>&hairsp;XICCEncodingStyle&hairsp;</emphasis>
structure contains:</para>



<informaltable pgwide='0' frame='none'>
  <tgroup cols='3' align='center'>
    <colspec colname='c1'/>
    <colspec colname='c2'/>
    <colspec colname='c3'/>
    <tbody>
      <row>
        <entry align='left'>T{
#define</entry>
        <entry align='left'>.ZN XNoMemory</entry>
        <entry align='left'>-1</entry>
      </row>
      <row>
        <entry align='left'>T{
#define</entry>
        <entry align='left'>.ZN XLocaleNotSupported</entry>
        <entry align='left'>-2</entry>
      </row>
      <row>
        <entry align='left'>T{
#define</entry>
        <entry align='left'>.ZN XConverterNotFound</entry>
        <entry align='left'>-3</entry>
      </row>
    </tbody>
  </tgroup>
</informaltable>


<literallayout remap='.nf'>
<!-- .0D  0 -->

<!-- .ps \n(PS -->
<!-- .if \n(VS&gt;=40 .vs \n(VSu -->
<!-- .if \n(VS&lt;=39 .vs \n(VSp -->
<!-- .TA .5i 2.5i -->
<!-- .ta .5i 2.5i -->
typedef enum {
	XStringStyle,		/&lowast; STRING */
	XCompoundTextStyle,	/&lowast; COMPOUND_TEXT */
	XTextStyle,		/&lowast; text in owner's encoding (current locale) */
	XStdICCTextStyle,	/&lowast; STRING, else COMPOUND_TEXT */
	XUTF8StringStyle	/&lowast; UTF8_STRING */
} XICCEncodingStyle;
<!-- .ce 0  IGNORED -->
<!-- .in \n(OIu  IGNORED -->

</literallayout> <!-- .fi -->
</refsect1>

<refsect1 id='see_also'><title>SEE ALSO</title>
<para>XSetTextProperty(3X11),
XStringListToTextProperty(3X11)
<!-- .br -->
<userinput>Xlib - C Language X Interface</userinput></para>
</refsect1>
</refentry>

