<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>as-utils: AppStream Library Reference Manual</title> <meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> <link rel="home" href="index.html" title="AppStream Library Reference Manual"> <link rel="up" href="ch01.html" title="AppStream API Reference"> <link rel="prev" href="appstream-as-spdx.html" title="as-spdx"> <link rel="next" href="appstream-AsDistroDetails.html" title="AsDistroDetails"> <meta name="generator" content="GTK-Doc V1.25 (XML mode)"> <link rel="stylesheet" href="style.css" type="text/css"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle"> <td width="100%" align="left" class="shortcuts"> <a href="#" class="shortcut">Top</a><span id="nav_description"> <span class="dim">|</span> <a href="#appstream-as-utils.description" class="shortcut">Description</a></span> </td> <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td> <td><a accesskey="u" href="ch01.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td> <td><a accesskey="p" href="appstream-as-spdx.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td> <td><a accesskey="n" href="appstream-AsDistroDetails.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td> </tr></table> <div class="refentry"> <a name="appstream-as-utils"></a><div class="titlepage"></div> <div class="refnamediv"><table width="100%"><tr> <td valign="top"> <h2><span class="refentrytitle"><a name="appstream-as-utils.top_of_page"></a>as-utils</span></h2> <p>as-utils — Helper functions that are used inside libappstream</p> </td> <td class="gallery_image" valign="top" align="right"></td> </tr></table></div> <div class="refsect1"> <a name="appstream-as-utils.functions"></a><h2>Functions</h2> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="functions_return"> <col class="functions_name"> </colgroup> <tbody> <tr> <td class="function_type"> <a href="../glib/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> * </td> <td class="function_name"> <a class="link" href="appstream-as-utils.html#as-markup-convert-simple" title="as_markup_convert_simple ()">as_markup_convert_simple</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> </td> <td class="function_name"> <a class="link" href="appstream-as-utils.html#as-utils-locale-is-compatible" title="as_utils_locale_is_compatible ()">as_utils_locale_is_compatible</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> </td> <td class="function_name"> <a class="link" href="appstream-as-utils.html#as-utils-is-category-name" title="as_utils_is_category_name ()">as_utils_is_category_name</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> </td> <td class="function_name"> <a class="link" href="appstream-as-utils.html#as-utils-is-tld" title="as_utils_is_tld ()">as_utils_is_tld</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> </td> <td class="function_name"> <a class="link" href="appstream-as-utils.html#as-utils-is-desktop-environment" title="as_utils_is_desktop_environment ()">as_utils_is_desktop_environment</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">void</span> </td> <td class="function_name"> <a class="link" href="appstream-as-utils.html#as-utils-sort-components-into-categories" title="as_utils_sort_components_into_categories ()">as_utils_sort_components_into_categories</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a href="../glib/glib-Basic-Types.html#gint"><span class="returnvalue">gint</span></a> </td> <td class="function_name"> <a class="link" href="appstream-as-utils.html#as-utils-compare-versions" title="as_utils_compare_versions ()">as_utils_compare_versions</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type">const <a href="../glib/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> * </td> <td class="function_name"> <a class="link" href="appstream-as-utils.html#as-get-appstream-version" title="as_get_appstream_version ()">as_get_appstream_version</a> <span class="c_punctuation">()</span> </td> </tr> </tbody> </table></div> </div> <div class="refsect1"> <a name="appstream-as-utils.includes"></a><h2>Includes</h2> <pre class="synopsis">#include <appstream.h> </pre> </div> <div class="refsect1"> <a name="appstream-as-utils.description"></a><h2>Description</h2> <p>Functions which are used in libappstream and might be useful for others as well.</p> </div> <div class="refsect1"> <a name="appstream-as-utils.functions_details"></a><h2>Functions</h2> <div class="refsect2"> <a name="as-markup-convert-simple"></a><h3>as_markup_convert_simple ()</h3> <pre class="programlisting"><a href="../glib/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> * as_markup_convert_simple (<em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *markup</code></em>, <em class="parameter"><code><a href="../glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre> </div> <hr> <div class="refsect2"> <a name="as-utils-locale-is-compatible"></a><h3>as_utils_locale_is_compatible ()</h3> <pre class="programlisting"><a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> as_utils_locale_is_compatible (<em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *locale1</code></em>, <em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *locale2</code></em>);</pre> <p>Calculates if one locale is compatible with another. When doing the calculation the locale and language code is taken into account if possible.</p> <div class="refsect3"> <a name="as-utils-locale-is-compatible.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>locale1</p></td> <td class="parameter_description"><p>a locale string, or <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>locale2</p></td> <td class="parameter_description"><p>a locale string, or <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="as-utils-locale-is-compatible.returns"></a><h4>Returns</h4> <p> <a href="../glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the locale is compatible.</p> </div> <p class="since">Since: 0.9.5</p> </div> <hr> <div class="refsect2"> <a name="as-utils-is-category-name"></a><h3>as_utils_is_category_name ()</h3> <pre class="programlisting"><a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> as_utils_is_category_name (<em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *category_name</code></em>);</pre> </div> <hr> <div class="refsect2"> <a name="as-utils-is-tld"></a><h3>as_utils_is_tld ()</h3> <pre class="programlisting"><a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> as_utils_is_tld (<em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *tld</code></em>);</pre> <p>Searches the known list of TLDs we allow for AppStream IDs. This excludes internationalized names.</p> <div class="refsect3"> <a name="as-utils-is-tld.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>tld</p></td> <td class="parameter_description"><p>a top-level domain without dot, e.g. "de", "org", "name"</p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="as-utils-is-tld.returns"></a><h4>Returns</h4> <p> <a href="../glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the TLD is valid</p> </div> <p class="since">Since: 0.9.8</p> </div> <hr> <div class="refsect2"> <a name="as-utils-is-desktop-environment"></a><h3>as_utils_is_desktop_environment ()</h3> <pre class="programlisting"><a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> as_utils_is_desktop_environment (<em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *desktop</code></em>);</pre> <p>Searches the known list of desktop environments AppStream knows about.</p> <div class="refsect3"> <a name="as-utils-is-desktop-environment.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>desktop</p></td> <td class="parameter_description"><p>a desktop environment id.</p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="as-utils-is-desktop-environment.returns"></a><h4>Returns</h4> <p> <a href="../glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the desktop-id is valid</p> </div> <p class="since">Since: 0.10.0</p> </div> <hr> <div class="refsect2"> <a name="as-utils-sort-components-into-categories"></a><h3>as_utils_sort_components_into_categories ()</h3> <pre class="programlisting"><span class="returnvalue">void</span> as_utils_sort_components_into_categories (<em class="parameter"><code><a href="../glib/glib-Pointer-Arrays.html#GPtrArray"><span class="type">GPtrArray</span></a> *cpts</code></em>, <em class="parameter"><code><a href="../glib/glib-Pointer-Arrays.html#GPtrArray"><span class="type">GPtrArray</span></a> *categories</code></em>, <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> check_duplicates</code></em>);</pre> <p>Sorts all components in <em class="parameter"><code>cpts</code></em> into the <a class="link" href="appstream-AsCategory.html#AsCategory" title="AsCategory"><span class="type">AsCategory</span></a> categories listed in <em class="parameter"><code>categories</code></em> .</p> <div class="refsect3"> <a name="as-utils-sort-components-into-categories.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>cpts</p></td> <td class="parameter_description"><p> List of components. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> AsComponent]</span></td> </tr> <tr> <td class="parameter_name"><p>categories</p></td> <td class="parameter_description"><p> List of categories to sort components into. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> AsCategory]</span></td> </tr> <tr> <td class="parameter_name"><p>check_duplicates</p></td> <td class="parameter_description"><p>Whether to check for duplicates.</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> </div> <hr> <div class="refsect2"> <a name="as-utils-compare-versions"></a><h3>as_utils_compare_versions ()</h3> <pre class="programlisting"><a href="../glib/glib-Basic-Types.html#gint"><span class="returnvalue">gint</span></a> as_utils_compare_versions (<em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *a</code></em>, <em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *b</code></em>);</pre> <p>Compare alpha and numeric segments of two versions. The version compare algorithm is also used by RPM.</p> <div class="refsect3"> <a name="as-utils-compare-versions.returns"></a><h4>Returns</h4> <p> 1: a is newer than b 0: a and b are the same version -1: b is newer than a</p> </div> </div> <hr> <div class="refsect2"> <a name="as-get-appstream-version"></a><h3>as_get_appstream_version ()</h3> <pre class="programlisting">const <a href="../glib/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> * as_get_appstream_version (<em class="parameter"><code><span class="type">void</span></code></em>);</pre> <p>Get the version of the AppStream library that is currently used as a string.</p> <div class="refsect3"> <a name="as-get-appstream-version.returns"></a><h4>Returns</h4> <p> The AppStream version.</p> </div> </div> </div> <div class="refsect1"> <a name="appstream-as-utils.other_details"></a><h2>Types and Values</h2> </div> </div> <div class="footer"> <hr>Generated by GTK-Doc V1.25</div> </body> </html>