<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Listing built-in functionality</title> <meta name="generator" content="DocBook XSL Stylesheets V1.73.2"> <link rel="start" href="index.html" title="Raptor RDF Syntax Parsing and Serializing Library Manual"> <link rel="up" href="tutorial.html" title="Part I. Raptor Tutorial"> <link rel="prev" href="tutorial-initialising-finishing.html" title="Initialising and Finishing using the Library"> <link rel="next" href="tutorial-parsing.html" title="Parsing syntaxes to RDF Triples"> <meta name="generator" content="GTK-Doc V1.10 (XML mode)"> <link rel="stylesheet" href="style.css" type="text/css"> <link rel="chapter" href="introduction.html" title="Raptor Overview"> <link rel="part" href="tutorial.html" title="Part I. Raptor Tutorial"> <link rel="chapter" href="tutorial-initialising-finishing.html" title="Initialising and Finishing using the Library"> <link rel="chapter" href="tutorial-querying-functionality.html" title="Listing built-in functionality"> <link rel="chapter" href="tutorial-parsing.html" title="Parsing syntaxes to RDF Triples"> <link rel="chapter" href="tutorial-serializing.html" title="Serializing RDF triples to a syntax"> <link rel="part" href="reference-manual.html" title="Part II. Raptor Reference Manual"> <link rel="chapter" href="raptor-parsers.html" title="Parsers in Raptor (syntax to triples)"> <link rel="chapter" href="raptor-serializers.html" title="Serializers in Raptor (triples to syntax)"> <link rel="index" href="ix01.html" title="Index"> </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="2"><tr valign="middle"> <td><a accesskey="p" href="tutorial-initialising-finishing.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td> <td><a accesskey="u" href="tutorial.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td> <td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td> <th width="100%" align="center">Raptor RDF Syntax Parsing and Serializing Library Manual</th> <td><a accesskey="n" href="tutorial-parsing.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td> </tr></table> <div class="chapter" lang="en"> <div class="titlepage"><div><div><h2 class="title"> <a name="tutorial-querying-functionality"></a>Listing built-in functionality</h2></div></div></div> <p> Raptor can be configured and compiled with support for different parsers and serializers. Lists of the functionality built into the library can be interrogated by means of <span class="emphasis"><em>enumerate</em></span> functions. These take as input an <code class="literal">int</code> counter and return descriptions of the feature at that offset in the list. The descriptions are returned stored in the variables pointed to by the reference arguments of the <code class="literal">**</code><span class="emphasis"><em>var</em></span> form. The return value of the function is non-zero when the counter has gone too far. </p> <div class="variablelist"> <p class="title"><b>Listing Functionality with Enumeration</b></p> <table border="0"> <col align="left" valign="top"> <tbody> <tr> <td><p><span class="term">List the parse syntaxes (parser names)</span></p></td> <td><pre class="programlisting"> int raptor_parsers_enumerate(const unsigned int counter, const char **name, const char **label); </pre></td> </tr> <tr> <td><p><span class="term">List the parse syntaxes (same as above but with more information)</span></p></td> <td><pre class="programlisting"> int raptor_syntaxes_enumerate(const unsigned int counter, const char **name, const char **label, const char **mime_type, const unsigned char **uri_string); </pre></td> </tr> <tr> <td><p><span class="term">List the serializer syntaxes (serializer names)</span></p></td> <td><pre class="programlisting"> int raptor_serializers_enumerate(const unsigned int counter, const char **name, const char **label, const char **mime_type, const unsigned char **uri_string); </pre></td> </tr> <tr> <td><p><span class="term">List the Parser features</span></p></td> <td><pre class="programlisting"> int raptor_features_enumerate(const raptor_feature feature, const char **name, raptor_uri **uri, const char **label); </pre></td> </tr> <tr> <td><p><span class="term">List the Serializer features</span></p></td> <td><pre class="programlisting"> int raptor_serializer_features_enumerate(const raptor_feature feature, const char **name, raptor_uri **uri, const char **label); </pre></td> </tr> <tr> <td><p><span class="term">List the XML Writer features</span></p></td> <td><pre class="programlisting"> int raptor_xml_writer_features_enumerate(const raptor_feature feature, const char **name, raptor_uri **uri, const char **label); </pre></td> </tr> </tbody> </table> </div> <p>These functions can be called directly after <a class="link" href="raptor-section-general.html#raptor-init" title="raptor_init ()"><code class="function">raptor_init()</code></a> has been called so can be used to find name parameters for creating parser and serializer instances. This is one way to find a parser (name) by it's MIME Type, the other is to use the mime_type parameter of the <a class="link" href="raptor-section-parser.html#raptor-new-parser-for-content" title="raptor_new_parser_for_content ()"><code class="function">raptor_new_parser_for_content()</code></a>.</p> <div class="example"> <a name="raptor-example-list-all-parser-features"></a><p class="title"><b>Example 1. List all features of parsers with an enumerate function</b></p> <div class="example-contents"> <pre class="programlisting"> int i; for(i=0; i < RAPTOR_FEATURE_LAST; i++) { const char *name; raptor_uri *uri; const char *label; if(raptor_features_enumerate((raptor_feature)i, &name, &uri, &label)) continue; /* do something with name, uri and label */ } </pre> <p>There are more examples of this usage in the source for the <code class="literal">rapper</code> utility in <code class="filename">util/rapper.c</code>. </p> </div> </div> <br class="example-break"> </div> <div class="footer"> <hr> Generated by GTK-Doc V1.10</div> </body> </html>