qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jr...@apache.org
Subject [07/26] qpid-site git commit: QPID-7350: Examples that should have gone with the previous commit
Date Wed, 13 Jul 2016 09:54:52 GMT
http://git-wip-us.apache.org/repos/asf/qpid-site/blob/75ca8b14/input/releases/qpid-proton-0.13.0/proton/cpp/examples/options.hpp.html.in
----------------------------------------------------------------------
diff --git a/input/releases/qpid-proton-0.13.0/proton/cpp/examples/options.hpp.html.in b/input/releases/qpid-proton-0.13.0/proton/cpp/examples/options.hpp.html.in
new file mode 100644
index 0000000..bf35557
--- /dev/null
+++ b/input/releases/qpid-proton-0.13.0/proton/cpp/examples/options.hpp.html.in
@@ -0,0 +1,161 @@
+
+<h1>options.hpp</h1>
+<div class="highlight"><pre><span></span><span class="cp">#ifndef OPTIONS_HPP</span>
+<span class="cp">#define OPTIONS_HPP</span>
+
+
+<span class="cp">#include</span> <span class="cpf">&lt;string&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;sstream&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;ostream&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;vector&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;stdexcept&gt;</span><span class="cp"></span>
+
+<span class="k">namespace</span> <span class="n">example</span> <span class="p">{</span>
+
+<span class="k">struct</span> <span class="nl">bad_option</span> <span class="p">:</span> <span class="k">public</span> <span class="n">std</span><span class="o">::</span><span class="n">runtime_error</span> <span class="p">{</span>
+    <span class="n">bad_option</span><span class="p">(</span><span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&amp;</span> <span class="n">s</span><span class="p">)</span> <span class="o">:</span> <span class="n">std</span><span class="o">::</span><span class="n">runtime_error</span><span class="p">(</span><span class="n">s</span><span class="p">)</span> <span class="p">{}</span>
+<span class="p">};</span>
+
+
+<span class="k">class</span> <span class="nc">options</span> <span class="p">{</span>
+  <span class="k">public</span><span class="o">:</span>
+
+    <span class="n">options</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span> <span class="k">const</span> <span class="o">*</span> <span class="k">const</span> <span class="o">*</span> <span class="n">argv</span><span class="p">)</span> <span class="o">:</span> <span class="n">argc_</span><span class="p">(</span><span class="n">argc</span><span class="p">),</span> <span class="n">argv_</span><span class="p">(</span><span class="n">argv</span><span class="p">),</span> <span class="n">prog_</span><span class="p">(</span><span class="n">argv</span><span class="p">[</span><span class="mi">0</span><span class="p">]),</span> <span class="n">help_</span><span class="p">()</span> <span class="p">{</span>
+        <span class="kt">size_t</span> <span class="n">slash</span> <span class="o">=</span> <span class="n">prog_</span><span class="p">.</span><span class="n">find_last_of</span><span class="p">(</span><span class="s">&quot;/</span><span class="se">\\</span><span class="s">&quot;</span><span class="p">);</span>
+        <span class="k">if</span> <span class="p">(</span><span class="n">slash</span> <span class="o">!=</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">::</span><span class="n">npos</span><span class="p">)</span>
+            <span class="n">prog_</span> <span class="o">=</span> <span class="n">prog_</span><span class="p">.</span><span class="n">substr</span><span class="p">(</span><span class="n">slash</span><span class="o">+</span><span class="mi">1</span><span class="p">);</span> <span class="c1">// Extract prog name from path</span>
+        <span class="n">add_flag</span><span class="p">(</span><span class="n">help_</span><span class="p">,</span> <span class="sc">&#39;h&#39;</span><span class="p">,</span> <span class="s">&quot;help&quot;</span><span class="p">,</span> <span class="s">&quot;Print the help message&quot;</span><span class="p">);</span>
+    <span class="p">}</span>
+
+    <span class="o">~</span><span class="n">options</span><span class="p">()</span> <span class="p">{</span>
+        <span class="k">for</span> <span class="p">(</span><span class="n">opts</span><span class="o">::</span><span class="n">iterator</span> <span class="n">i</span> <span class="o">=</span> <span class="n">opts_</span><span class="p">.</span><span class="n">begin</span><span class="p">();</span> <span class="n">i</span> <span class="o">!=</span> <span class="n">opts_</span><span class="p">.</span><span class="n">end</span><span class="p">();</span> <span class="o">++</span><span class="n">i</span><span class="p">)</span>
+            <span class="k">delete</span> <span class="o">*</span><span class="n">i</span><span class="p">;</span>
+    <span class="p">}</span>
+
+    
+    <span class="k">template</span><span class="o">&lt;</span><span class="k">class</span> <span class="nc">T</span><span class="o">&gt;</span>
+    <span class="kt">void</span> <span class="n">add_value</span><span class="p">(</span><span class="n">T</span><span class="o">&amp;</span> <span class="n">value</span><span class="p">,</span> <span class="kt">char</span> <span class="n">short_name</span><span class="p">,</span> <span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&amp;</span> <span class="n">long_name</span><span class="p">,</span> <span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&amp;</span> <span class="n">description</span><span class="p">,</span> <span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">var</span><span class="p">)</span> <span class="p">{</span>
+        <span class="n">opts_</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="k">new</span> <span class="n">option_value</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="n">short_name</span><span class="p">,</span> <span class="n">long_name</span><span class="p">,</span> <span class="n">description</span><span class="p">,</span> <span class="n">var</span><span class="p">));</span>
+    <span class="p">}</span>
+
+    
+    <span class="kt">void</span> <span class="n">add_flag</span><span class="p">(</span><span class="kt">bool</span><span class="o">&amp;</span> <span class="n">flag</span><span class="p">,</span> <span class="kt">char</span> <span class="n">short_name</span><span class="p">,</span> <span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&amp;</span> <span class="n">long_name</span><span class="p">,</span> <span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&amp;</span> <span class="n">description</span><span class="p">)</span> <span class="p">{</span>
+        <span class="n">opts_</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="k">new</span> <span class="n">option_flag</span><span class="p">(</span><span class="n">flag</span><span class="p">,</span> <span class="n">short_name</span><span class="p">,</span> <span class="n">long_name</span><span class="p">,</span> <span class="n">description</span><span class="p">));</span>
+    <span class="p">}</span>
+
+    
+    <span class="kt">int</span> <span class="n">parse</span><span class="p">()</span> <span class="p">{</span>
+        <span class="kt">int</span> <span class="n">arg</span> <span class="o">=</span> <span class="mi">1</span><span class="p">;</span>
+        <span class="k">for</span> <span class="p">(;</span> <span class="n">arg</span> <span class="o">&lt;</span> <span class="n">argc_</span> <span class="o">&amp;&amp;</span> <span class="n">argv_</span><span class="p">[</span><span class="n">arg</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="sc">&#39;-&#39;</span><span class="p">;</span> <span class="o">++</span><span class="n">arg</span><span class="p">)</span> <span class="p">{</span>
+            <span class="n">opts</span><span class="o">::</span><span class="n">iterator</span> <span class="n">i</span> <span class="o">=</span> <span class="n">opts_</span><span class="p">.</span><span class="n">begin</span><span class="p">();</span>
+            <span class="k">while</span> <span class="p">(</span><span class="n">i</span> <span class="o">!=</span> <span class="n">opts_</span><span class="p">.</span><span class="n">end</span><span class="p">()</span> <span class="o">&amp;&amp;</span> <span class="o">!</span><span class="p">(</span><span class="o">*</span><span class="n">i</span><span class="p">)</span><span class="o">-&gt;</span><span class="n">parse</span><span class="p">(</span><span class="n">argc_</span><span class="p">,</span> <span class="n">argv_</span><span class="p">,</span> <span class="n">arg</span><span class="p">))</span>
+                <span class="o">++</span><span class="n">i</span><span class="p">;</span>
+            <span class="k">if</span> <span class="p">(</span><span class="n">i</span> <span class="o">==</span> <span class="n">opts_</span><span class="p">.</span><span class="n">end</span><span class="p">())</span>
+                <span class="k">throw</span> <span class="n">bad_option</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="p">(</span><span class="s">&quot;unknown option &quot;</span><span class="p">)</span> <span class="o">+</span> <span class="n">argv_</span><span class="p">[</span><span class="n">arg</span><span class="p">]);</span>
+        <span class="p">}</span>
+        <span class="k">if</span> <span class="p">(</span><span class="n">help_</span><span class="p">)</span> <span class="k">throw</span> <span class="n">bad_option</span><span class="p">(</span><span class="s">&quot;&quot;</span><span class="p">);</span>
+        <span class="k">return</span> <span class="n">arg</span><span class="p">;</span>
+    <span class="p">}</span>
+
+    
+  <span class="k">friend</span> <span class="n">std</span><span class="o">::</span><span class="n">ostream</span><span class="o">&amp;</span> <span class="k">operator</span><span class="o">&lt;&lt;</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">ostream</span><span class="o">&amp;</span> <span class="n">os</span><span class="p">,</span> <span class="k">const</span> <span class="n">options</span><span class="o">&amp;</span> <span class="n">op</span><span class="p">)</span> <span class="p">{</span>
+      <span class="n">os</span> <span class="o">&lt;&lt;</span> <span class="n">std</span><span class="o">::</span><span class="n">endl</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;usage: &quot;</span> <span class="o">&lt;&lt;</span> <span class="n">op</span><span class="p">.</span><span class="n">prog_</span> <span class="o">&lt;&lt;</span> <span class="s">&quot; [options]&quot;</span> <span class="o">&lt;&lt;</span> <span class="n">std</span><span class="o">::</span><span class="n">endl</span><span class="p">;</span>
+      <span class="n">os</span> <span class="o">&lt;&lt;</span> <span class="n">std</span><span class="o">::</span><span class="n">endl</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;options:&quot;</span> <span class="o">&lt;&lt;</span> <span class="n">std</span><span class="o">::</span><span class="n">endl</span><span class="p">;</span>
+      <span class="k">for</span> <span class="p">(</span><span class="n">opts</span><span class="o">::</span><span class="n">const_iterator</span> <span class="n">i</span> <span class="o">=</span> <span class="n">op</span><span class="p">.</span><span class="n">opts_</span><span class="p">.</span><span class="n">begin</span><span class="p">();</span> <span class="n">i</span> <span class="o">&lt;</span> <span class="n">op</span><span class="p">.</span><span class="n">opts_</span><span class="p">.</span><span class="n">end</span><span class="p">();</span> <span class="o">++</span><span class="n">i</span><span class="p">)</span>
+          <span class="n">os</span> <span class="o">&lt;&lt;</span> <span class="o">**</span><span class="n">i</span> <span class="o">&lt;&lt;</span> <span class="n">std</span><span class="o">::</span><span class="n">endl</span><span class="p">;</span>
+      <span class="k">return</span> <span class="n">os</span><span class="p">;</span>
+  <span class="p">}</span>
+
+ <span class="k">private</span><span class="o">:</span>
+    <span class="k">class</span> <span class="nc">option</span> <span class="p">{</span>
+      <span class="k">public</span><span class="o">:</span>
+        <span class="n">option</span><span class="p">(</span><span class="kt">char</span> <span class="n">s</span><span class="p">,</span> <span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&amp;</span> <span class="n">l</span><span class="p">,</span> <span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&amp;</span> <span class="n">d</span><span class="p">,</span> <span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">v</span><span class="p">)</span> <span class="o">:</span>
+            <span class="n">short_</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="p">(</span><span class="s">&quot;-&quot;</span><span class="p">)</span> <span class="o">+</span> <span class="n">s</span><span class="p">),</span> <span class="n">long_</span><span class="p">(</span><span class="s">&quot;--&quot;</span> <span class="o">+</span> <span class="n">l</span><span class="p">),</span> <span class="n">desc_</span><span class="p">(</span><span class="n">d</span><span class="p">),</span> <span class="n">var_</span><span class="p">(</span><span class="n">v</span><span class="p">)</span> <span class="p">{}</span>
+        <span class="k">virtual</span> <span class="o">~</span><span class="n">option</span><span class="p">()</span> <span class="p">{}</span>
+
+        <span class="k">virtual</span> <span class="kt">bool</span> <span class="n">parse</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span> <span class="k">const</span> <span class="o">*</span> <span class="k">const</span> <span class="o">*</span> <span class="n">argv</span><span class="p">,</span> <span class="kt">int</span> <span class="o">&amp;</span><span class="n">i</span><span class="p">)</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
+        <span class="k">virtual</span> <span class="kt">void</span> <span class="nf">print_default</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">ostream</span><span class="o">&amp;</span><span class="p">)</span> <span class="k">const</span> <span class="p">{}</span>
+
+      <span class="k">friend</span> <span class="n">std</span><span class="o">::</span><span class="n">ostream</span><span class="o">&amp;</span> <span class="k">operator</span><span class="o">&lt;&lt;</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">ostream</span><span class="o">&amp;</span> <span class="n">os</span><span class="p">,</span> <span class="k">const</span> <span class="n">option</span><span class="o">&amp;</span> <span class="n">op</span><span class="p">)</span> <span class="p">{</span>
+          <span class="n">os</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;  &quot;</span> <span class="o">&lt;&lt;</span> <span class="n">op</span><span class="p">.</span><span class="n">short_</span><span class="p">;</span>
+          <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">op</span><span class="p">.</span><span class="n">var_</span><span class="p">.</span><span class="n">empty</span><span class="p">())</span> <span class="n">os</span> <span class="o">&lt;&lt;</span> <span class="s">&quot; &quot;</span> <span class="o">&lt;&lt;</span> <span class="n">op</span><span class="p">.</span><span class="n">var_</span><span class="p">;</span>
+          <span class="n">os</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;, &quot;</span> <span class="o">&lt;&lt;</span> <span class="n">op</span><span class="p">.</span><span class="n">long_</span><span class="p">;</span>
+          <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">op</span><span class="p">.</span><span class="n">var_</span><span class="p">.</span><span class="n">empty</span><span class="p">())</span> <span class="n">os</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;=&quot;</span> <span class="o">&lt;&lt;</span> <span class="n">op</span><span class="p">.</span><span class="n">var_</span><span class="p">;</span>
+          <span class="n">os</span> <span class="o">&lt;&lt;</span> <span class="n">std</span><span class="o">::</span><span class="n">endl</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;        &quot;</span> <span class="o">&lt;&lt;</span> <span class="n">op</span><span class="p">.</span><span class="n">desc_</span><span class="p">;</span>
+          <span class="n">op</span><span class="p">.</span><span class="n">print_default</span><span class="p">(</span><span class="n">os</span><span class="p">);</span>
+          <span class="k">return</span> <span class="n">os</span><span class="p">;</span>
+      <span class="p">}</span>
+
+      <span class="k">protected</span><span class="o">:</span>
+        <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">short_</span><span class="p">,</span> <span class="n">long_</span><span class="p">,</span> <span class="n">desc_</span><span class="p">,</span> <span class="n">var_</span><span class="p">;</span>
+    <span class="p">};</span>
+
+    <span class="k">template</span> <span class="o">&lt;</span><span class="k">class</span> <span class="nc">T</span><span class="o">&gt;</span>
+    <span class="k">class</span> <span class="nc">option_value</span> <span class="o">:</span> <span class="k">public</span> <span class="n">option</span> <span class="p">{</span>
+      <span class="k">public</span><span class="o">:</span>
+        <span class="n">option_value</span><span class="p">(</span><span class="n">T</span><span class="o">&amp;</span> <span class="n">value</span><span class="p">,</span> <span class="kt">char</span> <span class="n">s</span><span class="p">,</span> <span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&amp;</span> <span class="n">l</span><span class="p">,</span> <span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&amp;</span> <span class="n">d</span><span class="p">,</span> <span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&amp;</span> <span class="n">v</span><span class="p">)</span> <span class="o">:</span>
+            <span class="n">option</span><span class="p">(</span><span class="n">s</span><span class="p">,</span> <span class="n">l</span><span class="p">,</span> <span class="n">d</span><span class="p">,</span> <span class="n">v</span><span class="p">),</span> <span class="n">value_</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> <span class="p">{}</span>
+
+        <span class="kt">bool</span> <span class="n">parse</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span> <span class="k">const</span> <span class="o">*</span> <span class="k">const</span> <span class="o">*</span> <span class="n">argv</span><span class="p">,</span> <span class="kt">int</span> <span class="o">&amp;</span><span class="n">i</span><span class="p">)</span> <span class="p">{</span>
+            <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">arg</span><span class="p">(</span><span class="n">argv</span><span class="p">[</span><span class="n">i</span><span class="p">]);</span>
+            <span class="k">if</span> <span class="p">(</span><span class="n">arg</span> <span class="o">==</span> <span class="n">short_</span> <span class="o">||</span> <span class="n">arg</span> <span class="o">==</span> <span class="n">long_</span><span class="p">)</span> <span class="p">{</span>
+                <span class="k">if</span> <span class="p">(</span><span class="n">i</span> <span class="o">&lt;</span> <span class="n">argc</span><span class="o">-</span><span class="mi">1</span><span class="p">)</span> <span class="p">{</span>
+                    <span class="n">set_value</span><span class="p">(</span><span class="n">arg</span><span class="p">,</span> <span class="n">argv</span><span class="p">[</span><span class="o">++</span><span class="n">i</span><span class="p">]);</span>
+                    <span class="k">return</span> <span class="nb">true</span><span class="p">;</span>
+                <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
+                    <span class="k">throw</span> <span class="n">bad_option</span><span class="p">(</span><span class="s">&quot;missing value for &quot;</span> <span class="o">+</span> <span class="n">arg</span><span class="p">);</span>
+                <span class="p">}</span>
+            <span class="p">}</span>
+            <span class="k">if</span> <span class="p">(</span><span class="n">arg</span><span class="p">.</span><span class="n">compare</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">long_</span><span class="p">.</span><span class="n">size</span><span class="p">(),</span> <span class="n">long_</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span> <span class="o">&amp;&amp;</span> <span class="n">arg</span><span class="p">[</span><span class="n">long_</span><span class="p">.</span><span class="n">size</span><span class="p">()]</span> <span class="o">==</span> <span class="sc">&#39;=&#39;</span> <span class="p">)</span> <span class="p">{</span>
+                <span class="n">set_value</span><span class="p">(</span><span class="n">long_</span><span class="p">,</span> <span class="n">arg</span><span class="p">.</span><span class="n">substr</span><span class="p">(</span><span class="n">long_</span><span class="p">.</span><span class="n">size</span><span class="p">()</span><span class="o">+</span><span class="mi">1</span><span class="p">));</span>
+                <span class="k">return</span> <span class="nb">true</span><span class="p">;</span>
+            <span class="p">}</span>
+            <span class="k">return</span> <span class="nb">false</span><span class="p">;</span>
+        <span class="p">}</span>
+
+        <span class="k">virtual</span> <span class="kt">void</span> <span class="n">print_default</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">ostream</span><span class="o">&amp;</span> <span class="n">os</span><span class="p">)</span> <span class="k">const</span> <span class="p">{</span> <span class="n">os</span> <span class="o">&lt;&lt;</span> <span class="s">&quot; (default &quot;</span> <span class="o">&lt;&lt;</span> <span class="n">value_</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;)&quot;</span><span class="p">;</span> <span class="p">}</span>
+
+        <span class="kt">void</span> <span class="n">set_value</span><span class="p">(</span><span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&amp;</span> <span class="n">opt</span><span class="p">,</span> <span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&amp;</span> <span class="n">s</span><span class="p">)</span> <span class="p">{</span>
+            <span class="n">std</span><span class="o">::</span><span class="n">istringstream</span> <span class="n">is</span><span class="p">(</span><span class="n">s</span><span class="p">);</span>
+            <span class="n">is</span> <span class="o">&gt;&gt;</span> <span class="n">value_</span><span class="p">;</span>
+            <span class="k">if</span> <span class="p">(</span><span class="n">is</span><span class="p">.</span><span class="n">fail</span><span class="p">()</span> <span class="o">||</span> <span class="n">is</span><span class="p">.</span><span class="n">bad</span><span class="p">())</span>
+                <span class="k">throw</span> <span class="n">bad_option</span><span class="p">(</span><span class="s">&quot;bad value for &quot;</span> <span class="o">+</span> <span class="n">opt</span> <span class="o">+</span> <span class="s">&quot;: &quot;</span> <span class="o">+</span> <span class="n">s</span><span class="p">);</span>
+        <span class="p">}</span>
+
+      <span class="k">private</span><span class="o">:</span>
+        <span class="n">T</span><span class="o">&amp;</span> <span class="n">value_</span><span class="p">;</span>
+    <span class="p">};</span>
+
+    <span class="k">class</span> <span class="nc">option_flag</span><span class="o">:</span> <span class="k">public</span> <span class="n">option</span> <span class="p">{</span>
+      <span class="k">public</span><span class="o">:</span>
+        <span class="n">option_flag</span><span class="p">(</span><span class="kt">bool</span><span class="o">&amp;</span> <span class="n">flag</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span> <span class="n">s</span><span class="p">,</span> <span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&amp;</span> <span class="n">l</span><span class="p">,</span> <span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&amp;</span> <span class="n">d</span><span class="p">)</span> <span class="o">:</span>
+            <span class="n">option</span><span class="p">(</span><span class="n">s</span><span class="p">,</span> <span class="n">l</span><span class="p">,</span> <span class="n">d</span><span class="p">,</span> <span class="s">&quot;&quot;</span><span class="p">),</span> <span class="n">flag_</span><span class="p">(</span><span class="n">flag</span><span class="p">)</span>
+        <span class="p">{</span> <span class="n">flag_</span> <span class="o">=</span> <span class="nb">false</span><span class="p">;</span> <span class="p">}</span>
+
+        <span class="kt">bool</span> <span class="n">parse</span><span class="p">(</span><span class="kt">int</span> <span class="p">,</span> <span class="kt">char</span> <span class="k">const</span> <span class="o">*</span> <span class="k">const</span> <span class="o">*</span> <span class="n">argv</span><span class="p">,</span> <span class="kt">int</span> <span class="o">&amp;</span><span class="n">i</span><span class="p">)</span> <span class="p">{</span>
+            <span class="k">if</span> <span class="p">(</span><span class="n">argv</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">==</span> <span class="n">short_</span> <span class="o">||</span> <span class="n">argv</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">==</span> <span class="n">long_</span><span class="p">)</span> <span class="p">{</span>
+                <span class="n">flag_</span> <span class="o">=</span> <span class="nb">true</span><span class="p">;</span>
+                <span class="k">return</span> <span class="nb">true</span><span class="p">;</span>
+            <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
+                <span class="k">return</span> <span class="nb">false</span><span class="p">;</span>
+            <span class="p">}</span>
+        <span class="p">}</span>
+
+      <span class="k">private</span><span class="o">:</span>
+        <span class="kt">bool</span> <span class="o">&amp;</span><span class="n">flag_</span><span class="p">;</span>
+    <span class="p">};</span>
+
+    <span class="k">typedef</span> <span class="n">std</span><span class="o">::</span><span class="n">vector</span><span class="o">&lt;</span><span class="n">option</span><span class="o">*&gt;</span> <span class="n">opts</span><span class="p">;</span>
+
+    <span class="kt">int</span> <span class="n">argc_</span><span class="p">;</span>
+    <span class="kt">char</span> <span class="k">const</span> <span class="o">*</span> <span class="k">const</span> <span class="o">*</span> <span class="n">argv_</span><span class="p">;</span>
+    <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">prog_</span><span class="p">;</span>
+    <span class="n">opts</span> <span class="n">opts_</span><span class="p">;</span>
+    <span class="kt">bool</span> <span class="n">help_</span><span class="p">;</span>
+<span class="p">};</span>
+<span class="p">}</span>
+
+<span class="cp">#endif </span><span class="c1">// OPTIONS_HPP</span>
+</pre></div>
+
+<p><a href="options.hpp">Download this file</a></p>

http://git-wip-us.apache.org/repos/asf/qpid-site/blob/75ca8b14/input/releases/qpid-proton-0.13.0/proton/cpp/examples/queue_browser.cpp
----------------------------------------------------------------------
diff --git a/input/releases/qpid-proton-0.13.0/proton/cpp/examples/queue_browser.cpp b/input/releases/qpid-proton-0.13.0/proton/cpp/examples/queue_browser.cpp
new file mode 100644
index 0000000..649716b
--- /dev/null
+++ b/input/releases/qpid-proton-0.13.0/proton/cpp/examples/queue_browser.cpp
@@ -0,0 +1,67 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+#include <proton/connection.hpp>
+#include <proton/default_container.hpp>
+#include <proton/delivery.hpp>
+#include <proton/messaging_handler.hpp>
+#include <proton/receiver_options.hpp>
+#include <proton/source_options.hpp>
+#include <proton/url.hpp>
+
+#include <iostream>
+
+#include "fake_cpp11.hpp"
+
+using proton::source_options;
+
+class browser : public proton::messaging_handler {
+  private:
+    proton::url url;
+
+  public:
+    browser(const std::string& u) : url(u) {}
+
+    void on_container_start(proton::container &c) OVERRIDE {
+        proton::connection conn = c.connect(url);
+        source_options browsing = source_options().distribution_mode(proton::source::COPY);
+        conn.open_receiver(url.path(), proton::receiver_options().source(browsing));
+    }
+
+    void on_message(proton::delivery &, proton::message &m) OVERRIDE {
+        std::cout << m.body() << std::endl;
+    }
+};
+
+int main(int argc, char **argv) {
+    try {
+        std::string url = argc > 1 ? argv[1] : "127.0.0.1:5672/examples";
+
+        browser b(url);
+        proton::default_container(b).run();
+
+        return 0;
+    } catch (const std::exception& e) {
+        std::cerr << e.what() << std::endl;
+    }
+
+    return 1;
+}

http://git-wip-us.apache.org/repos/asf/qpid-site/blob/75ca8b14/input/releases/qpid-proton-0.13.0/proton/cpp/examples/queue_browser.cpp.html.in
----------------------------------------------------------------------
diff --git a/input/releases/qpid-proton-0.13.0/proton/cpp/examples/queue_browser.cpp.html.in b/input/releases/qpid-proton-0.13.0/proton/cpp/examples/queue_browser.cpp.html.in
new file mode 100644
index 0000000..8494ed4
--- /dev/null
+++ b/input/releases/qpid-proton-0.13.0/proton/cpp/examples/queue_browser.cpp.html.in
@@ -0,0 +1,51 @@
+
+<h1>queue_browser.cpp</h1>
+<div class="highlight"><pre><span></span><span class="cp">#include</span> <span class="cpf">&lt;proton/connection.hpp&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;proton/default_container.hpp&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;proton/delivery.hpp&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;proton/messaging_handler.hpp&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;proton/receiver_options.hpp&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;proton/source_options.hpp&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;proton/url.hpp&gt;</span><span class="cp"></span>
+
+<span class="cp">#include</span> <span class="cpf">&lt;iostream&gt;</span><span class="cp"></span>
+
+<span class="cp">#include</span> <span class="cpf">&quot;fake_cpp11.hpp&quot;</span><span class="cp"></span>
+
+<span class="k">using</span> <span class="n">proton</span><span class="o">::</span><span class="n">source_options</span><span class="p">;</span>
+
+<span class="k">class</span> <span class="nc">browser</span> <span class="o">:</span> <span class="k">public</span> <span class="n">proton</span><span class="o">::</span><span class="n">messaging_handler</span> <span class="p">{</span>
+  <span class="k">private</span><span class="o">:</span>
+    <span class="n">proton</span><span class="o">::</span><span class="n">url</span> <span class="n">url</span><span class="p">;</span>
+
+  <span class="k">public</span><span class="o">:</span>
+    <span class="n">browser</span><span class="p">(</span><span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&amp;</span> <span class="n">u</span><span class="p">)</span> <span class="o">:</span> <span class="n">url</span><span class="p">(</span><span class="n">u</span><span class="p">)</span> <span class="p">{}</span>
+
+    <span class="kt">void</span> <span class="n">on_container_start</span><span class="p">(</span><span class="n">proton</span><span class="o">::</span><span class="n">container</span> <span class="o">&amp;</span><span class="n">c</span><span class="p">)</span> <span class="n">OVERRIDE</span> <span class="p">{</span>
+        <span class="n">proton</span><span class="o">::</span><span class="n">connection</span> <span class="n">conn</span> <span class="o">=</span> <span class="n">c</span><span class="p">.</span><span class="n">connect</span><span class="p">(</span><span class="n">url</span><span class="p">);</span>
+        <span class="n">source_options</span> <span class="n">browsing</span> <span class="o">=</span> <span class="n">source_options</span><span class="p">().</span><span class="n">distribution_mode</span><span class="p">(</span><span class="n">proton</span><span class="o">::</span><span class="n">source</span><span class="o">::</span><span class="n">COPY</span><span class="p">);</span>
+        <span class="n">conn</span><span class="p">.</span><span class="n">open_receiver</span><span class="p">(</span><span class="n">url</span><span class="p">.</span><span class="n">path</span><span class="p">(),</span> <span class="n">proton</span><span class="o">::</span><span class="n">receiver_options</span><span class="p">().</span><span class="n">source</span><span class="p">(</span><span class="n">browsing</span><span class="p">));</span>
+    <span class="p">}</span>
+
+    <span class="kt">void</span> <span class="n">on_message</span><span class="p">(</span><span class="n">proton</span><span class="o">::</span><span class="n">delivery</span> <span class="o">&amp;</span><span class="p">,</span> <span class="n">proton</span><span class="o">::</span><span class="n">message</span> <span class="o">&amp;</span><span class="n">m</span><span class="p">)</span> <span class="n">OVERRIDE</span> <span class="p">{</span>
+        <span class="n">std</span><span class="o">::</span><span class="n">cout</span> <span class="o">&lt;&lt;</span> <span class="n">m</span><span class="p">.</span><span class="n">body</span><span class="p">()</span> <span class="o">&lt;&lt;</span> <span class="n">std</span><span class="o">::</span><span class="n">endl</span><span class="p">;</span>
+    <span class="p">}</span>
+<span class="p">};</span>
+
+<span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span> <span class="o">**</span><span class="n">argv</span><span class="p">)</span> <span class="p">{</span>
+    <span class="k">try</span> <span class="p">{</span>
+        <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">url</span> <span class="o">=</span> <span class="n">argc</span> <span class="o">&gt;</span> <span class="mi">1</span> <span class="o">?</span> <span class="n">argv</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">:</span> <span class="s">&quot;127.0.0.1:5672/examples&quot;</span><span class="p">;</span>
+
+        <span class="n">browser</span> <span class="n">b</span><span class="p">(</span><span class="n">url</span><span class="p">);</span>
+        <span class="n">proton</span><span class="o">::</span><span class="n">default_container</span><span class="p">(</span><span class="n">b</span><span class="p">).</span><span class="n">run</span><span class="p">();</span>
+
+        <span class="k">return</span> <span class="mi">0</span><span class="p">;</span>
+    <span class="p">}</span> <span class="k">catch</span> <span class="p">(</span><span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">exception</span><span class="o">&amp;</span> <span class="n">e</span><span class="p">)</span> <span class="p">{</span>
+        <span class="n">std</span><span class="o">::</span><span class="n">cerr</span> <span class="o">&lt;&lt;</span> <span class="n">e</span><span class="p">.</span><span class="n">what</span><span class="p">()</span> <span class="o">&lt;&lt;</span> <span class="n">std</span><span class="o">::</span><span class="n">endl</span><span class="p">;</span>
+    <span class="p">}</span>
+
+    <span class="k">return</span> <span class="mi">1</span><span class="p">;</span>
+<span class="p">}</span>
+</pre></div>
+
+<p><a href="queue_browser.cpp">Download this file</a></p>

http://git-wip-us.apache.org/repos/asf/qpid-site/blob/75ca8b14/input/releases/qpid-proton-0.13.0/proton/cpp/examples/selected_recv.cpp
----------------------------------------------------------------------
diff --git a/input/releases/qpid-proton-0.13.0/proton/cpp/examples/selected_recv.cpp b/input/releases/qpid-proton-0.13.0/proton/cpp/examples/selected_recv.cpp
new file mode 100644
index 0000000..c7a63d9
--- /dev/null
+++ b/input/releases/qpid-proton-0.13.0/proton/cpp/examples/selected_recv.cpp
@@ -0,0 +1,88 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+#include <proton/connection.hpp>
+#include <proton/default_container.hpp>
+#include <proton/messaging_handler.hpp>
+#include <proton/receiver_options.hpp>
+#include <proton/source_options.hpp>
+#include <proton/url.hpp>
+
+#include <iostream>
+
+#include "fake_cpp11.hpp"
+
+namespace {
+
+    // Example custom function to configure an AMQP filter,
+    // specifically an APACHE.ORG:SELECTOR
+    // (http://www.amqp.org/specification/1.0/filters)
+
+    void set_filter(proton::source_options &opts, const std::string& selector_str) {
+        proton::source::filter_map map;
+        proton::symbol filter_key("selector");
+        proton::value filter_value;
+        // The value is a specific AMQP "described type": binary string with symbolic descriptor
+        proton::codec::encoder enc(filter_value);
+        enc << proton::codec::start::described()
+            << proton::symbol("apache.org:selector-filter:string")
+            << proton::binary(selector_str)
+            << proton::codec::finish();
+        // In our case, the map has this one element
+        map[filter_key] = filter_value;
+        opts.filters(map);
+    }
+}
+
+
+class selected_recv : public proton::messaging_handler {
+  private:
+    proton::url url;
+
+  public:
+    selected_recv(const std::string& u) : url(u) {}
+
+    void on_container_start(proton::container &c) OVERRIDE {
+        proton::source_options opts;
+        set_filter(opts, "colour = 'green'");
+        proton::connection conn = c.connect(url);
+        conn.open_receiver(url.path(), proton::receiver_options().source(opts));
+    }
+
+    void on_message(proton::delivery &, proton::message &m) OVERRIDE {
+        std::cout << m.body() << std::endl;
+    }
+};
+
+int main(int argc, char **argv) {
+    try {
+        std::string url = argc > 1 ? argv[1] : "127.0.0.1:5672/examples";
+
+        selected_recv recv(url);
+        proton::default_container(recv).run();
+
+        return 0;
+    } catch (const std::exception& e) {
+        std::cerr << e.what() << std::endl;
+    }
+
+    return 1;
+}

http://git-wip-us.apache.org/repos/asf/qpid-site/blob/75ca8b14/input/releases/qpid-proton-0.13.0/proton/cpp/examples/selected_recv.cpp.html.in
----------------------------------------------------------------------
diff --git a/input/releases/qpid-proton-0.13.0/proton/cpp/examples/selected_recv.cpp.html.in b/input/releases/qpid-proton-0.13.0/proton/cpp/examples/selected_recv.cpp.html.in
new file mode 100644
index 0000000..e4585d0
--- /dev/null
+++ b/input/releases/qpid-proton-0.13.0/proton/cpp/examples/selected_recv.cpp.html.in
@@ -0,0 +1,72 @@
+
+<h1>selected_recv.cpp</h1>
+<div class="highlight"><pre><span></span><span class="cp">#include</span> <span class="cpf">&lt;proton/connection.hpp&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;proton/default_container.hpp&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;proton/messaging_handler.hpp&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;proton/receiver_options.hpp&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;proton/source_options.hpp&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;proton/url.hpp&gt;</span><span class="cp"></span>
+
+<span class="cp">#include</span> <span class="cpf">&lt;iostream&gt;</span><span class="cp"></span>
+
+<span class="cp">#include</span> <span class="cpf">&quot;fake_cpp11.hpp&quot;</span><span class="cp"></span>
+
+<span class="k">namespace</span> <span class="p">{</span>
+
+    <span class="c1">// Example custom function to configure an AMQP filter,</span>
+    <span class="c1">// specifically an APACHE.ORG:SELECTOR</span>
+    <span class="c1">// (http://www.amqp.org/specification/1.0/filters)</span>
+
+    <span class="kt">void</span> <span class="n">set_filter</span><span class="p">(</span><span class="n">proton</span><span class="o">::</span><span class="n">source_options</span> <span class="o">&amp;</span><span class="n">opts</span><span class="p">,</span> <span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&amp;</span> <span class="n">selector_str</span><span class="p">)</span> <span class="p">{</span>
+        <span class="n">proton</span><span class="o">::</span><span class="n">source</span><span class="o">::</span><span class="n">filter_map</span> <span class="n">map</span><span class="p">;</span>
+        <span class="n">proton</span><span class="o">::</span><span class="n">symbol</span> <span class="n">filter_key</span><span class="p">(</span><span class="s">&quot;selector&quot;</span><span class="p">);</span>
+        <span class="n">proton</span><span class="o">::</span><span class="n">value</span> <span class="n">filter_value</span><span class="p">;</span>
+        <span class="c1">// The value is a specific AMQP &quot;described type&quot;: binary string with symbolic descriptor</span>
+        <span class="n">proton</span><span class="o">::</span><span class="n">codec</span><span class="o">::</span><span class="n">encoder</span> <span class="n">enc</span><span class="p">(</span><span class="n">filter_value</span><span class="p">);</span>
+        <span class="n">enc</span> <span class="o">&lt;&lt;</span> <span class="n">proton</span><span class="o">::</span><span class="n">codec</span><span class="o">::</span><span class="n">start</span><span class="o">::</span><span class="n">described</span><span class="p">()</span>
+            <span class="o">&lt;&lt;</span> <span class="n">proton</span><span class="o">::</span><span class="n">symbol</span><span class="p">(</span><span class="s">&quot;apache.org:selector-filter:string&quot;</span><span class="p">)</span>
+            <span class="o">&lt;&lt;</span> <span class="n">proton</span><span class="o">::</span><span class="n">binary</span><span class="p">(</span><span class="n">selector_str</span><span class="p">)</span>
+            <span class="o">&lt;&lt;</span> <span class="n">proton</span><span class="o">::</span><span class="n">codec</span><span class="o">::</span><span class="n">finish</span><span class="p">();</span>
+        <span class="c1">// In our case, the map has this one element</span>
+        <span class="n">map</span><span class="p">[</span><span class="n">filter_key</span><span class="p">]</span> <span class="o">=</span> <span class="n">filter_value</span><span class="p">;</span>
+        <span class="n">opts</span><span class="p">.</span><span class="n">filters</span><span class="p">(</span><span class="n">map</span><span class="p">);</span>
+    <span class="p">}</span>
+<span class="p">}</span>
+
+
+<span class="k">class</span> <span class="nc">selected_recv</span> <span class="o">:</span> <span class="k">public</span> <span class="n">proton</span><span class="o">::</span><span class="n">messaging_handler</span> <span class="p">{</span>
+  <span class="k">private</span><span class="o">:</span>
+    <span class="n">proton</span><span class="o">::</span><span class="n">url</span> <span class="n">url</span><span class="p">;</span>
+
+  <span class="k">public</span><span class="o">:</span>
+    <span class="n">selected_recv</span><span class="p">(</span><span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&amp;</span> <span class="n">u</span><span class="p">)</span> <span class="o">:</span> <span class="n">url</span><span class="p">(</span><span class="n">u</span><span class="p">)</span> <span class="p">{}</span>
+
+    <span class="kt">void</span> <span class="n">on_container_start</span><span class="p">(</span><span class="n">proton</span><span class="o">::</span><span class="n">container</span> <span class="o">&amp;</span><span class="n">c</span><span class="p">)</span> <span class="n">OVERRIDE</span> <span class="p">{</span>
+        <span class="n">proton</span><span class="o">::</span><span class="n">source_options</span> <span class="n">opts</span><span class="p">;</span>
+        <span class="n">set_filter</span><span class="p">(</span><span class="n">opts</span><span class="p">,</span> <span class="s">&quot;colour = &#39;green&#39;&quot;</span><span class="p">);</span>
+        <span class="n">proton</span><span class="o">::</span><span class="n">connection</span> <span class="n">conn</span> <span class="o">=</span> <span class="n">c</span><span class="p">.</span><span class="n">connect</span><span class="p">(</span><span class="n">url</span><span class="p">);</span>
+        <span class="n">conn</span><span class="p">.</span><span class="n">open_receiver</span><span class="p">(</span><span class="n">url</span><span class="p">.</span><span class="n">path</span><span class="p">(),</span> <span class="n">proton</span><span class="o">::</span><span class="n">receiver_options</span><span class="p">().</span><span class="n">source</span><span class="p">(</span><span class="n">opts</span><span class="p">));</span>
+    <span class="p">}</span>
+
+    <span class="kt">void</span> <span class="n">on_message</span><span class="p">(</span><span class="n">proton</span><span class="o">::</span><span class="n">delivery</span> <span class="o">&amp;</span><span class="p">,</span> <span class="n">proton</span><span class="o">::</span><span class="n">message</span> <span class="o">&amp;</span><span class="n">m</span><span class="p">)</span> <span class="n">OVERRIDE</span> <span class="p">{</span>
+        <span class="n">std</span><span class="o">::</span><span class="n">cout</span> <span class="o">&lt;&lt;</span> <span class="n">m</span><span class="p">.</span><span class="n">body</span><span class="p">()</span> <span class="o">&lt;&lt;</span> <span class="n">std</span><span class="o">::</span><span class="n">endl</span><span class="p">;</span>
+    <span class="p">}</span>
+<span class="p">};</span>
+
+<span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span> <span class="o">**</span><span class="n">argv</span><span class="p">)</span> <span class="p">{</span>
+    <span class="k">try</span> <span class="p">{</span>
+        <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">url</span> <span class="o">=</span> <span class="n">argc</span> <span class="o">&gt;</span> <span class="mi">1</span> <span class="o">?</span> <span class="n">argv</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">:</span> <span class="s">&quot;127.0.0.1:5672/examples&quot;</span><span class="p">;</span>
+
+        <span class="n">selected_recv</span> <span class="n">recv</span><span class="p">(</span><span class="n">url</span><span class="p">);</span>
+        <span class="n">proton</span><span class="o">::</span><span class="n">default_container</span><span class="p">(</span><span class="n">recv</span><span class="p">).</span><span class="n">run</span><span class="p">();</span>
+
+        <span class="k">return</span> <span class="mi">0</span><span class="p">;</span>
+    <span class="p">}</span> <span class="k">catch</span> <span class="p">(</span><span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">exception</span><span class="o">&amp;</span> <span class="n">e</span><span class="p">)</span> <span class="p">{</span>
+        <span class="n">std</span><span class="o">::</span><span class="n">cerr</span> <span class="o">&lt;&lt;</span> <span class="n">e</span><span class="p">.</span><span class="n">what</span><span class="p">()</span> <span class="o">&lt;&lt;</span> <span class="n">std</span><span class="o">::</span><span class="n">endl</span><span class="p">;</span>
+    <span class="p">}</span>
+
+    <span class="k">return</span> <span class="mi">1</span><span class="p">;</span>
+<span class="p">}</span>
+</pre></div>
+
+<p><a href="selected_recv.cpp">Download this file</a></p>

http://git-wip-us.apache.org/repos/asf/qpid-site/blob/75ca8b14/input/releases/qpid-proton-0.13.0/proton/cpp/examples/server.cpp
----------------------------------------------------------------------
diff --git a/input/releases/qpid-proton-0.13.0/proton/cpp/examples/server.cpp b/input/releases/qpid-proton-0.13.0/proton/cpp/examples/server.cpp
new file mode 100644
index 0000000..ec24f9f
--- /dev/null
+++ b/input/releases/qpid-proton-0.13.0/proton/cpp/examples/server.cpp
@@ -0,0 +1,100 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+#include "options.hpp"
+
+#include <proton/connection.hpp>
+#include <proton/default_container.hpp>
+#include <proton/messaging_handler.hpp>
+#include <proton/tracker.hpp>
+#include <proton/url.hpp>
+
+#include <iostream>
+#include <map>
+#include <string>
+#include <cctype>
+
+#include "fake_cpp11.hpp"
+
+class server : public proton::messaging_handler {
+  private:
+    typedef std::map<std::string, proton::sender> sender_map;
+    proton::url url;
+    proton::connection connection;
+    sender_map senders;
+
+  public:
+    server(const std::string &u) : url(u) {}
+
+    void on_container_start(proton::container &c) OVERRIDE {
+        connection = c.connect(url);
+        connection.open_receiver(url.path());
+
+        std::cout << "server connected to " << url << std::endl;
+    }
+
+    std::string to_upper(const std::string &s) {
+        std::string uc(s);
+        size_t l = uc.size();
+        for (size_t i=0; i<l; i++)
+            uc[i] = static_cast<char>(std::toupper(uc[i]));
+        return uc;
+    }
+
+    void on_message(proton::delivery &, proton::message &m) OVERRIDE {
+        std::cout << "Received " << m.body() << std::endl;
+
+        std::string reply_to = m.reply_to();
+        proton::message reply;
+
+        reply.to(reply_to);
+        reply.body(to_upper(proton::get<std::string>(m.body())));
+        reply.correlation_id(m.correlation_id());
+
+        if (!senders[reply_to]) {
+            senders[reply_to] = connection.open_sender(reply_to);
+        }
+
+        senders[reply_to].send(reply);
+    }
+};
+
+int main(int argc, char **argv) {
+    std::string address("amqp://0.0.0.0:5672/examples");
+    example::options opts(argc, argv);
+
+    opts.add_value(address, 'a', "address", "listen on URL", "URL");
+
+    try {
+        opts.parse();
+
+        server srv(address);
+        proton::default_container(srv).run();
+
+        return 0;
+    } catch (const example::bad_option& e) {
+        std::cout << opts << std::endl << e.what() << std::endl;
+    } catch (const std::exception& e) {
+        std::cerr << e.what() << std::endl;
+    }
+
+    return 1;
+}

http://git-wip-us.apache.org/repos/asf/qpid-site/blob/75ca8b14/input/releases/qpid-proton-0.13.0/proton/cpp/examples/server.cpp.html.in
----------------------------------------------------------------------
diff --git a/input/releases/qpid-proton-0.13.0/proton/cpp/examples/server.cpp.html.in b/input/releases/qpid-proton-0.13.0/proton/cpp/examples/server.cpp.html.in
new file mode 100644
index 0000000..06f2825
--- /dev/null
+++ b/input/releases/qpid-proton-0.13.0/proton/cpp/examples/server.cpp.html.in
@@ -0,0 +1,84 @@
+
+<h1>server.cpp</h1>
+<div class="highlight"><pre><span></span><span class="cp">#include</span> <span class="cpf">&quot;options.hpp&quot;</span><span class="cp"></span>
+
+<span class="cp">#include</span> <span class="cpf">&lt;proton/connection.hpp&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;proton/default_container.hpp&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;proton/messaging_handler.hpp&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;proton/tracker.hpp&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;proton/url.hpp&gt;</span><span class="cp"></span>
+
+<span class="cp">#include</span> <span class="cpf">&lt;iostream&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;map&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;string&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;cctype&gt;</span><span class="cp"></span>
+
+<span class="cp">#include</span> <span class="cpf">&quot;fake_cpp11.hpp&quot;</span><span class="cp"></span>
+
+<span class="k">class</span> <span class="nc">server</span> <span class="o">:</span> <span class="k">public</span> <span class="n">proton</span><span class="o">::</span><span class="n">messaging_handler</span> <span class="p">{</span>
+  <span class="k">private</span><span class="o">:</span>
+    <span class="k">typedef</span> <span class="n">std</span><span class="o">::</span><span class="n">map</span><span class="o">&lt;</span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="p">,</span> <span class="n">proton</span><span class="o">::</span><span class="n">sender</span><span class="o">&gt;</span> <span class="n">sender_map</span><span class="p">;</span>
+    <span class="n">proton</span><span class="o">::</span><span class="n">url</span> <span class="n">url</span><span class="p">;</span>
+    <span class="n">proton</span><span class="o">::</span><span class="n">connection</span> <span class="n">connection</span><span class="p">;</span>
+    <span class="n">sender_map</span> <span class="n">senders</span><span class="p">;</span>
+
+  <span class="k">public</span><span class="o">:</span>
+    <span class="n">server</span><span class="p">(</span><span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="o">&amp;</span><span class="n">u</span><span class="p">)</span> <span class="o">:</span> <span class="n">url</span><span class="p">(</span><span class="n">u</span><span class="p">)</span> <span class="p">{}</span>
+
+    <span class="kt">void</span> <span class="n">on_container_start</span><span class="p">(</span><span class="n">proton</span><span class="o">::</span><span class="n">container</span> <span class="o">&amp;</span><span class="n">c</span><span class="p">)</span> <span class="n">OVERRIDE</span> <span class="p">{</span>
+        <span class="n">connection</span> <span class="o">=</span> <span class="n">c</span><span class="p">.</span><span class="n">connect</span><span class="p">(</span><span class="n">url</span><span class="p">);</span>
+        <span class="n">connection</span><span class="p">.</span><span class="n">open_receiver</span><span class="p">(</span><span class="n">url</span><span class="p">.</span><span class="n">path</span><span class="p">());</span>
+
+        <span class="n">std</span><span class="o">::</span><span class="n">cout</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;server connected to &quot;</span> <span class="o">&lt;&lt;</span> <span class="n">url</span> <span class="o">&lt;&lt;</span> <span class="n">std</span><span class="o">::</span><span class="n">endl</span><span class="p">;</span>
+    <span class="p">}</span>
+
+    <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">to_upper</span><span class="p">(</span><span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="o">&amp;</span><span class="n">s</span><span class="p">)</span> <span class="p">{</span>
+        <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">uc</span><span class="p">(</span><span class="n">s</span><span class="p">);</span>
+        <span class="kt">size_t</span> <span class="n">l</span> <span class="o">=</span> <span class="n">uc</span><span class="p">.</span><span class="n">size</span><span class="p">();</span>
+        <span class="k">for</span> <span class="p">(</span><span class="kt">size_t</span> <span class="n">i</span><span class="o">=</span><span class="mi">0</span><span class="p">;</span> <span class="n">i</span><span class="o">&lt;</span><span class="n">l</span><span class="p">;</span> <span class="n">i</span><span class="o">++</span><span class="p">)</span>
+            <span class="n">uc</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">=</span> <span class="k">static_cast</span><span class="o">&lt;</span><span class="kt">char</span><span class="o">&gt;</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">toupper</span><span class="p">(</span><span class="n">uc</span><span class="p">[</span><span class="n">i</span><span class="p">]));</span>
+        <span class="k">return</span> <span class="n">uc</span><span class="p">;</span>
+    <span class="p">}</span>
+
+    <span class="kt">void</span> <span class="n">on_message</span><span class="p">(</span><span class="n">proton</span><span class="o">::</span><span class="n">delivery</span> <span class="o">&amp;</span><span class="p">,</span> <span class="n">proton</span><span class="o">::</span><span class="n">message</span> <span class="o">&amp;</span><span class="n">m</span><span class="p">)</span> <span class="n">OVERRIDE</span> <span class="p">{</span>
+        <span class="n">std</span><span class="o">::</span><span class="n">cout</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;Received &quot;</span> <span class="o">&lt;&lt;</span> <span class="n">m</span><span class="p">.</span><span class="n">body</span><span class="p">()</span> <span class="o">&lt;&lt;</span> <span class="n">std</span><span class="o">::</span><span class="n">endl</span><span class="p">;</span>
+
+        <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">reply_to</span> <span class="o">=</span> <span class="n">m</span><span class="p">.</span><span class="n">reply_to</span><span class="p">();</span>
+        <span class="n">proton</span><span class="o">::</span><span class="n">message</span> <span class="n">reply</span><span class="p">;</span>
+
+        <span class="n">reply</span><span class="p">.</span><span class="n">to</span><span class="p">(</span><span class="n">reply_to</span><span class="p">);</span>
+        <span class="n">reply</span><span class="p">.</span><span class="n">body</span><span class="p">(</span><span class="n">to_upper</span><span class="p">(</span><span class="n">proton</span><span class="o">::</span><span class="n">get</span><span class="o">&lt;</span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&gt;</span><span class="p">(</span><span class="n">m</span><span class="p">.</span><span class="n">body</span><span class="p">())));</span>
+        <span class="n">reply</span><span class="p">.</span><span class="n">correlation_id</span><span class="p">(</span><span class="n">m</span><span class="p">.</span><span class="n">correlation_id</span><span class="p">());</span>
+
+        <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">senders</span><span class="p">[</span><span class="n">reply_to</span><span class="p">])</span> <span class="p">{</span>
+            <span class="n">senders</span><span class="p">[</span><span class="n">reply_to</span><span class="p">]</span> <span class="o">=</span> <span class="n">connection</span><span class="p">.</span><span class="n">open_sender</span><span class="p">(</span><span class="n">reply_to</span><span class="p">);</span>
+        <span class="p">}</span>
+
+        <span class="n">senders</span><span class="p">[</span><span class="n">reply_to</span><span class="p">].</span><span class="n">send</span><span class="p">(</span><span class="n">reply</span><span class="p">);</span>
+    <span class="p">}</span>
+<span class="p">};</span>
+
+<span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span> <span class="o">**</span><span class="n">argv</span><span class="p">)</span> <span class="p">{</span>
+    <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">address</span><span class="p">(</span><span class="s">&quot;amqp://0.0.0.0:5672/examples&quot;</span><span class="p">);</span>
+    <span class="n">example</span><span class="o">::</span><span class="n">options</span> <span class="n">opts</span><span class="p">(</span><span class="n">argc</span><span class="p">,</span> <span class="n">argv</span><span class="p">);</span>
+
+    <span class="n">opts</span><span class="p">.</span><span class="n">add_value</span><span class="p">(</span><span class="n">address</span><span class="p">,</span> <span class="sc">&#39;a&#39;</span><span class="p">,</span> <span class="s">&quot;address&quot;</span><span class="p">,</span> <span class="s">&quot;listen on URL&quot;</span><span class="p">,</span> <span class="s">&quot;URL&quot;</span><span class="p">);</span>
+
+    <span class="k">try</span> <span class="p">{</span>
+        <span class="n">opts</span><span class="p">.</span><span class="n">parse</span><span class="p">();</span>
+
+        <span class="n">server</span> <span class="n">srv</span><span class="p">(</span><span class="n">address</span><span class="p">);</span>
+        <span class="n">proton</span><span class="o">::</span><span class="n">default_container</span><span class="p">(</span><span class="n">srv</span><span class="p">).</span><span class="n">run</span><span class="p">();</span>
+
+        <span class="k">return</span> <span class="mi">0</span><span class="p">;</span>
+    <span class="p">}</span> <span class="k">catch</span> <span class="p">(</span><span class="k">const</span> <span class="n">example</span><span class="o">::</span><span class="n">bad_option</span><span class="o">&amp;</span> <span class="n">e</span><span class="p">)</span> <span class="p">{</span>
+        <span class="n">std</span><span class="o">::</span><span class="n">cout</span> <span class="o">&lt;&lt;</span> <span class="n">opts</span> <span class="o">&lt;&lt;</span> <span class="n">std</span><span class="o">::</span><span class="n">endl</span> <span class="o">&lt;&lt;</span> <span class="n">e</span><span class="p">.</span><span class="n">what</span><span class="p">()</span> <span class="o">&lt;&lt;</span> <span class="n">std</span><span class="o">::</span><span class="n">endl</span><span class="p">;</span>
+    <span class="p">}</span> <span class="k">catch</span> <span class="p">(</span><span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">exception</span><span class="o">&amp;</span> <span class="n">e</span><span class="p">)</span> <span class="p">{</span>
+        <span class="n">std</span><span class="o">::</span><span class="n">cerr</span> <span class="o">&lt;&lt;</span> <span class="n">e</span><span class="p">.</span><span class="n">what</span><span class="p">()</span> <span class="o">&lt;&lt;</span> <span class="n">std</span><span class="o">::</span><span class="n">endl</span><span class="p">;</span>
+    <span class="p">}</span>
+
+    <span class="k">return</span> <span class="mi">1</span><span class="p">;</span>
+<span class="p">}</span>
+</pre></div>
+
+<p><a href="server.cpp">Download this file</a></p>

http://git-wip-us.apache.org/repos/asf/qpid-site/blob/75ca8b14/input/releases/qpid-proton-0.13.0/proton/cpp/examples/server_direct.cpp
----------------------------------------------------------------------
diff --git a/input/releases/qpid-proton-0.13.0/proton/cpp/examples/server_direct.cpp b/input/releases/qpid-proton-0.13.0/proton/cpp/examples/server_direct.cpp
new file mode 100644
index 0000000..220934f
--- /dev/null
+++ b/input/releases/qpid-proton-0.13.0/proton/cpp/examples/server_direct.cpp
@@ -0,0 +1,119 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+#include "options.hpp"
+
+#include <proton/default_container.hpp>
+#include <proton/messaging_handler.hpp>
+#include <proton/sender.hpp>
+#include <proton/source_options.hpp>
+#include <proton/tracker.hpp>
+
+#include <iostream>
+#include <map>
+#include <string>
+#include <sstream>
+#include <cctype>
+
+#include "fake_cpp11.hpp"
+
+class server : public proton::messaging_handler {
+  private:
+    typedef std::map<std::string, proton::sender> sender_map;
+    std::string url;
+    sender_map senders;
+    int address_counter;
+
+  public:
+    server(const std::string &u) : url(u), address_counter(0) {}
+
+    void on_container_start(proton::container &c) OVERRIDE {
+        c.listen(url);
+        std::cout << "server listening on " << url << std::endl;
+    }
+
+    std::string to_upper(const std::string &s) {
+        std::string uc(s);
+        size_t l = uc.size();
+
+        for (size_t i=0; i<l; i++)
+            uc[i] = static_cast<char>(std::toupper(uc[i]));
+
+        return uc;
+    }
+
+    std::string generate_address() {
+        std::ostringstream addr;
+        addr << "server" << address_counter++;
+
+        return addr.str();
+    }
+
+    void on_sender_open(proton::sender &sender) OVERRIDE {
+        if (sender.source().dynamic()) {
+            std::string addr = generate_address();
+            sender.open(proton::sender_options().source(proton::source_options().address(addr)));
+            senders[addr] = sender;
+        }
+    }
+
+    void on_message(proton::delivery &, proton::message &m) OVERRIDE {
+        std::cout << "Received " << m.body() << std::endl;
+
+        std::string reply_to = m.reply_to();
+        sender_map::iterator it = senders.find(reply_to);
+
+        if (it == senders.end()) {
+            std::cout << "No link for reply_to: " << reply_to << std::endl;
+        } else {
+            proton::sender sender = it->second;
+            proton::message reply;
+
+            reply.to(reply_to);
+            reply.body(to_upper(proton::get<std::string>(m.body())));
+            reply.correlation_id(m.correlation_id());
+
+            sender.send(reply);
+        }
+    }
+};
+
+int main(int argc, char **argv) {
+    std::string address("amqp://127.0.0.1:5672/examples");
+    example::options opts(argc, argv);
+
+    opts.add_value(address, 'a', "address", "listen on URL", "URL");
+
+    try {
+        opts.parse();
+
+        server srv(address);
+        proton::default_container(srv).run();
+
+        return 0;
+    } catch (const example::bad_option& e) {
+        std::cout << opts << std::endl << e.what() << std::endl;
+    } catch (const std::exception& e) {
+        std::cerr << e.what() << std::endl;
+    }
+
+    return 1;
+}

http://git-wip-us.apache.org/repos/asf/qpid-site/blob/75ca8b14/input/releases/qpid-proton-0.13.0/proton/cpp/examples/server_direct.cpp.html.in
----------------------------------------------------------------------
diff --git a/input/releases/qpid-proton-0.13.0/proton/cpp/examples/server_direct.cpp.html.in b/input/releases/qpid-proton-0.13.0/proton/cpp/examples/server_direct.cpp.html.in
new file mode 100644
index 0000000..3a6203f
--- /dev/null
+++ b/input/releases/qpid-proton-0.13.0/proton/cpp/examples/server_direct.cpp.html.in
@@ -0,0 +1,103 @@
+
+<h1>server_direct.cpp</h1>
+<div class="highlight"><pre><span></span><span class="cp">#include</span> <span class="cpf">&quot;options.hpp&quot;</span><span class="cp"></span>
+
+<span class="cp">#include</span> <span class="cpf">&lt;proton/default_container.hpp&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;proton/messaging_handler.hpp&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;proton/sender.hpp&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;proton/source_options.hpp&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;proton/tracker.hpp&gt;</span><span class="cp"></span>
+
+<span class="cp">#include</span> <span class="cpf">&lt;iostream&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;map&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;string&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;sstream&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;cctype&gt;</span><span class="cp"></span>
+
+<span class="cp">#include</span> <span class="cpf">&quot;fake_cpp11.hpp&quot;</span><span class="cp"></span>
+
+<span class="k">class</span> <span class="nc">server</span> <span class="o">:</span> <span class="k">public</span> <span class="n">proton</span><span class="o">::</span><span class="n">messaging_handler</span> <span class="p">{</span>
+  <span class="k">private</span><span class="o">:</span>
+    <span class="k">typedef</span> <span class="n">std</span><span class="o">::</span><span class="n">map</span><span class="o">&lt;</span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="p">,</span> <span class="n">proton</span><span class="o">::</span><span class="n">sender</span><span class="o">&gt;</span> <span class="n">sender_map</span><span class="p">;</span>
+    <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">url</span><span class="p">;</span>
+    <span class="n">sender_map</span> <span class="n">senders</span><span class="p">;</span>
+    <span class="kt">int</span> <span class="n">address_counter</span><span class="p">;</span>
+
+  <span class="k">public</span><span class="o">:</span>
+    <span class="n">server</span><span class="p">(</span><span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="o">&amp;</span><span class="n">u</span><span class="p">)</span> <span class="o">:</span> <span class="n">url</span><span class="p">(</span><span class="n">u</span><span class="p">),</span> <span class="n">address_counter</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span> <span class="p">{}</span>
+
+    <span class="kt">void</span> <span class="n">on_container_start</span><span class="p">(</span><span class="n">proton</span><span class="o">::</span><span class="n">container</span> <span class="o">&amp;</span><span class="n">c</span><span class="p">)</span> <span class="n">OVERRIDE</span> <span class="p">{</span>
+        <span class="n">c</span><span class="p">.</span><span class="n">listen</span><span class="p">(</span><span class="n">url</span><span class="p">);</span>
+        <span class="n">std</span><span class="o">::</span><span class="n">cout</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;server listening on &quot;</span> <span class="o">&lt;&lt;</span> <span class="n">url</span> <span class="o">&lt;&lt;</span> <span class="n">std</span><span class="o">::</span><span class="n">endl</span><span class="p">;</span>
+    <span class="p">}</span>
+
+    <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">to_upper</span><span class="p">(</span><span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="o">&amp;</span><span class="n">s</span><span class="p">)</span> <span class="p">{</span>
+        <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">uc</span><span class="p">(</span><span class="n">s</span><span class="p">);</span>
+        <span class="kt">size_t</span> <span class="n">l</span> <span class="o">=</span> <span class="n">uc</span><span class="p">.</span><span class="n">size</span><span class="p">();</span>
+
+        <span class="k">for</span> <span class="p">(</span><span class="kt">size_t</span> <span class="n">i</span><span class="o">=</span><span class="mi">0</span><span class="p">;</span> <span class="n">i</span><span class="o">&lt;</span><span class="n">l</span><span class="p">;</span> <span class="n">i</span><span class="o">++</span><span class="p">)</span>
+            <span class="n">uc</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">=</span> <span class="k">static_cast</span><span class="o">&lt;</span><span class="kt">char</span><span class="o">&gt;</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">toupper</span><span class="p">(</span><span class="n">uc</span><span class="p">[</span><span class="n">i</span><span class="p">]));</span>
+
+        <span class="k">return</span> <span class="n">uc</span><span class="p">;</span>
+    <span class="p">}</span>
+
+    <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">generate_address</span><span class="p">()</span> <span class="p">{</span>
+        <span class="n">std</span><span class="o">::</span><span class="n">ostringstream</span> <span class="n">addr</span><span class="p">;</span>
+        <span class="n">addr</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;server&quot;</span> <span class="o">&lt;&lt;</span> <span class="n">address_counter</span><span class="o">++</span><span class="p">;</span>
+
+        <span class="k">return</span> <span class="n">addr</span><span class="p">.</span><span class="n">str</span><span class="p">();</span>
+    <span class="p">}</span>
+
+    <span class="kt">void</span> <span class="n">on_sender_open</span><span class="p">(</span><span class="n">proton</span><span class="o">::</span><span class="n">sender</span> <span class="o">&amp;</span><span class="n">sender</span><span class="p">)</span> <span class="n">OVERRIDE</span> <span class="p">{</span>
+        <span class="k">if</span> <span class="p">(</span><span class="n">sender</span><span class="p">.</span><span class="n">source</span><span class="p">().</span><span class="n">dynamic</span><span class="p">())</span> <span class="p">{</span>
+            <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">addr</span> <span class="o">=</span> <span class="n">generate_address</span><span class="p">();</span>
+            <span class="n">sender</span><span class="p">.</span><span class="n">open</span><span class="p">(</span><span class="n">proton</span><span class="o">::</span><span class="n">sender_options</span><span class="p">().</span><span class="n">source</span><span class="p">(</span><span class="n">proton</span><span class="o">::</span><span class="n">source_options</span><span class="p">().</span><span class="n">address</span><span class="p">(</span><span class="n">addr</span><span class="p">)));</span>
+            <span class="n">senders</span><span class="p">[</span><span class="n">addr</span><span class="p">]</span> <span class="o">=</span> <span class="n">sender</span><span class="p">;</span>
+        <span class="p">}</span>
+    <span class="p">}</span>
+
+    <span class="kt">void</span> <span class="n">on_message</span><span class="p">(</span><span class="n">proton</span><span class="o">::</span><span class="n">delivery</span> <span class="o">&amp;</span><span class="p">,</span> <span class="n">proton</span><span class="o">::</span><span class="n">message</span> <span class="o">&amp;</span><span class="n">m</span><span class="p">)</span> <span class="n">OVERRIDE</span> <span class="p">{</span>
+        <span class="n">std</span><span class="o">::</span><span class="n">cout</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;Received &quot;</span> <span class="o">&lt;&lt;</span> <span class="n">m</span><span class="p">.</span><span class="n">body</span><span class="p">()</span> <span class="o">&lt;&lt;</span> <span class="n">std</span><span class="o">::</span><span class="n">endl</span><span class="p">;</span>
+
+        <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">reply_to</span> <span class="o">=</span> <span class="n">m</span><span class="p">.</span><span class="n">reply_to</span><span class="p">();</span>
+        <span class="n">sender_map</span><span class="o">::</span><span class="n">iterator</span> <span class="n">it</span> <span class="o">=</span> <span class="n">senders</span><span class="p">.</span><span class="n">find</span><span class="p">(</span><span class="n">reply_to</span><span class="p">);</span>
+
+        <span class="k">if</span> <span class="p">(</span><span class="n">it</span> <span class="o">==</span> <span class="n">senders</span><span class="p">.</span><span class="n">end</span><span class="p">())</span> <span class="p">{</span>
+            <span class="n">std</span><span class="o">::</span><span class="n">cout</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;No link for reply_to: &quot;</span> <span class="o">&lt;&lt;</span> <span class="n">reply_to</span> <span class="o">&lt;&lt;</span> <span class="n">std</span><span class="o">::</span><span class="n">endl</span><span class="p">;</span>
+        <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
+            <span class="n">proton</span><span class="o">::</span><span class="n">sender</span> <span class="n">sender</span> <span class="o">=</span> <span class="n">it</span><span class="o">-&gt;</span><span class="n">second</span><span class="p">;</span>
+            <span class="n">proton</span><span class="o">::</span><span class="n">message</span> <span class="n">reply</span><span class="p">;</span>
+
+            <span class="n">reply</span><span class="p">.</span><span class="n">to</span><span class="p">(</span><span class="n">reply_to</span><span class="p">);</span>
+            <span class="n">reply</span><span class="p">.</span><span class="n">body</span><span class="p">(</span><span class="n">to_upper</span><span class="p">(</span><span class="n">proton</span><span class="o">::</span><span class="n">get</span><span class="o">&lt;</span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&gt;</span><span class="p">(</span><span class="n">m</span><span class="p">.</span><span class="n">body</span><span class="p">())));</span>
+            <span class="n">reply</span><span class="p">.</span><span class="n">correlation_id</span><span class="p">(</span><span class="n">m</span><span class="p">.</span><span class="n">correlation_id</span><span class="p">());</span>
+
+            <span class="n">sender</span><span class="p">.</span><span class="n">send</span><span class="p">(</span><span class="n">reply</span><span class="p">);</span>
+        <span class="p">}</span>
+    <span class="p">}</span>
+<span class="p">};</span>
+
+<span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span> <span class="o">**</span><span class="n">argv</span><span class="p">)</span> <span class="p">{</span>
+    <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">address</span><span class="p">(</span><span class="s">&quot;amqp://127.0.0.1:5672/examples&quot;</span><span class="p">);</span>
+    <span class="n">example</span><span class="o">::</span><span class="n">options</span> <span class="n">opts</span><span class="p">(</span><span class="n">argc</span><span class="p">,</span> <span class="n">argv</span><span class="p">);</span>
+
+    <span class="n">opts</span><span class="p">.</span><span class="n">add_value</span><span class="p">(</span><span class="n">address</span><span class="p">,</span> <span class="sc">&#39;a&#39;</span><span class="p">,</span> <span class="s">&quot;address&quot;</span><span class="p">,</span> <span class="s">&quot;listen on URL&quot;</span><span class="p">,</span> <span class="s">&quot;URL&quot;</span><span class="p">);</span>
+
+    <span class="k">try</span> <span class="p">{</span>
+        <span class="n">opts</span><span class="p">.</span><span class="n">parse</span><span class="p">();</span>
+
+        <span class="n">server</span> <span class="n">srv</span><span class="p">(</span><span class="n">address</span><span class="p">);</span>
+        <span class="n">proton</span><span class="o">::</span><span class="n">default_container</span><span class="p">(</span><span class="n">srv</span><span class="p">).</span><span class="n">run</span><span class="p">();</span>
+
+        <span class="k">return</span> <span class="mi">0</span><span class="p">;</span>
+    <span class="p">}</span> <span class="k">catch</span> <span class="p">(</span><span class="k">const</span> <span class="n">example</span><span class="o">::</span><span class="n">bad_option</span><span class="o">&amp;</span> <span class="n">e</span><span class="p">)</span> <span class="p">{</span>
+        <span class="n">std</span><span class="o">::</span><span class="n">cout</span> <span class="o">&lt;&lt;</span> <span class="n">opts</span> <span class="o">&lt;&lt;</span> <span class="n">std</span><span class="o">::</span><span class="n">endl</span> <span class="o">&lt;&lt;</span> <span class="n">e</span><span class="p">.</span><span class="n">what</span><span class="p">()</span> <span class="o">&lt;&lt;</span> <span class="n">std</span><span class="o">::</span><span class="n">endl</span><span class="p">;</span>
+    <span class="p">}</span> <span class="k">catch</span> <span class="p">(</span><span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">exception</span><span class="o">&amp;</span> <span class="n">e</span><span class="p">)</span> <span class="p">{</span>
+        <span class="n">std</span><span class="o">::</span><span class="n">cerr</span> <span class="o">&lt;&lt;</span> <span class="n">e</span><span class="p">.</span><span class="n">what</span><span class="p">()</span> <span class="o">&lt;&lt;</span> <span class="n">std</span><span class="o">::</span><span class="n">endl</span><span class="p">;</span>
+    <span class="p">}</span>
+
+    <span class="k">return</span> <span class="mi">1</span><span class="p">;</span>
+<span class="p">}</span>
+</pre></div>
+
+<p><a href="server_direct.cpp">Download this file</a></p>


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message