1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 2<html><meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 3<title>The HTMLTidy library - Boost.Outcome documentation</title> 4<link rel="stylesheet" href="../../../css/boost.css" type="text/css"> 5<meta name="generator" content="Hugo 0.52 with Boostdoc theme"> 6<meta name="viewport" content="width=device-width,initial-scale=1.0"/> 7 8<link rel="icon" href="../../../images/favicon.ico" type="image/ico"/> 9<body><div class="spirit-nav"> 10<a accesskey="p" href="../../../tutorial/advanced/interop/httplib.html"><img src="../../../images/prev.png" alt="Prev"></a> 11 <a accesskey="u" href="../../../tutorial/advanced/interop.html"><img src="../../../images/up.png" alt="Up"></a> 12 <a accesskey="h" href="../../../index.html"><img src="../../../images/home.png" alt="Home"></a><a accesskey="n" href="../../../tutorial/advanced/interop/filelib.html"><img src="../../../images/next.png" alt="Next"></a></div><div id="content"> 13 <div class="titlepage"><div><div><h1 style="clear: both">The HTMLTidy library</h1></div></div></div> 14 <div class="code-snippet"><div class="highlight"><pre class="chroma"><code class="language-c++" data-lang="c++"><span class="c1">// There actually is a library for tidying HTML into XHTML called HTMLTidy 15</span><span class="c1">// See http://www.html-tidy.org/ 16</span><span class="c1">// HTMLTidy is actually a great tool for dealing with 1990s-era tag soup 17</span><span class="c1">// HTML, I highly recommend it. 18</span><span class="c1"></span> 19<span class="c1">// This isn't the API for Tidy, but let's assume it's a C library returning 20</span><span class="c1">// errno domained error codes. out must be freed with free() after use. 21</span><span class="c1"></span><span class="k">extern</span> <span class="s">"C"</span> <span class="kt">int</span> <span class="n">tidy_html</span><span class="p">(</span><span class="kt">char</span> <span class="o">**</span><span class="n">out</span><span class="p">,</span> <span class="n">size_t</span> <span class="o">*</span><span class="n">outlen</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">in</span><span class="p">,</span> <span class="n">size_t</span> <span class="n">inlen</span><span class="p">);</span> 22</code></pre></div><a href="https://github.com/boostorg/outcome/tree/master/doc/src/snippets/finale.cpp#L154" class="code-snippet-url" target="_blank">View this code on Github</a></div> 23 24 25<p>A C API may not initially appear to be a <code>T|E</code> based API, but if failure 26returns some domained error code and causes no other effects, and success 27returns some value, then it is effectively a “split” <code>T|E</code> API. The above 28is an example of exactly that form of “split” <code>T|E</code> API.</p> 29 30 31 </div><p><small>Last revised: February 08, 2019 at 22:18:08 UTC</small></p> 32<hr> 33<div class="spirit-nav"> 34<a accesskey="p" href="../../../tutorial/advanced/interop/httplib.html"><img src="../../../images/prev.png" alt="Prev"></a> 35 <a accesskey="u" href="../../../tutorial/advanced/interop.html"><img src="../../../images/up.png" alt="Up"></a> 36 <a accesskey="h" href="../../../index.html"><img src="../../../images/home.png" alt="Home"></a><a accesskey="n" href="../../../tutorial/advanced/interop/filelib.html"><img src="../../../images/next.png" alt="Next"></a></div></body> 37</html> 38