qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jr...@apache.org
Subject [18/51] [partial] qpid-site git commit: QPID-7553: Doc snapshots and various other updates
Date Sun, 04 Dec 2016 17:39:34 GMT
http://git-wip-us.apache.org/repos/asf/qpid-site/blob/34159cc7/content/releases/qpid-cpp-master/messaging-api/cpp/examples/OptionParser.cpp
----------------------------------------------------------------------
diff --git a/content/releases/qpid-cpp-master/messaging-api/cpp/examples/OptionParser.cpp b/content/releases/qpid-cpp-master/messaging-api/cpp/examples/OptionParser.cpp
new file mode 100755
index 0000000..661d0a9
--- /dev/null
+++ b/content/releases/qpid-cpp-master/messaging-api/cpp/examples/OptionParser.cpp
@@ -0,0 +1,257 @@
+/*
+ *
+ * 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 "OptionParser.h"
+#include <qpid/types/Exception.h>
+#include <algorithm>
+#include <iostream>
+#include <iomanip>
+#include <sstream>
+#include <cstdlib>
+
+class Option
+{
+  public:
+    Option(const std::string& name, const std::string& description);
+    virtual ~Option() {}
+    virtual void setValue(const std::string&) = 0;
+    virtual bool isValueExpected() = 0;
+    bool match(const std::string&);
+    std::ostream& print(std::ostream& out);
+  private:
+    std::string longName;
+    std::string shortName;
+    std::string description;
+    std::ostream& printNames(std::ostream& out);
+  friend class OptionParser;
+};
+
+class StringOption : public Option
+{
+  public:
+    StringOption(const std::string& name, const std::string& description, std::string& v) : Option(name, description), value(v) {}
+    void setValue(const std::string& v) { value = v; }
+    bool isValueExpected() { return true; }
+  private:
+    std::string& value;
+};
+
+class IntegerOption : public Option
+{
+  public:
+    IntegerOption(const std::string& name, const std::string& description, int& v) : Option(name, description), value(v) {}
+    void setValue(const std::string& v) { value = atoi(v.c_str()); }
+    bool isValueExpected() { return true; }
+  private:
+    int& value;
+};
+
+class BooleanOption : public Option
+{
+  public:
+    BooleanOption(const std::string& name, const std::string& description, bool& v) : Option(name, description), value(v) {}
+    void setValue(const std::string&) { value = true; }
+    bool isValueExpected() { return false; }
+  private:
+    bool& value;
+};
+
+class MultiStringOption : public Option
+{
+  public:
+    MultiStringOption(const std::string& name, const std::string& description, std::vector<std::string>& v) : Option(name, description), value(v) {}
+    void setValue(const std::string& v) { value.push_back(v); }
+    bool isValueExpected() { return true; }
+  private:
+    std::vector<std::string>& value;
+};
+
+class OptionMatch
+{
+  public:
+    OptionMatch(const std::string& argument);
+    bool operator()(Option* option);
+    bool isOption();
+  private:
+    std::string name;
+};
+
+class OptionsError : public qpid::types::Exception
+{
+  public:
+    OptionsError(const std::string& message) : qpid::types::Exception(message) {}
+};
+
+Option::Option(const std::string& name, const std::string& desc) : description(desc)
+{
+    std::string::size_type i = name.find(",");
+    if (i != std::string::npos) {
+        longName = name.substr(0, i);
+        if (i + 1 < name.size())
+            shortName = name.substr(i+1);
+    } else {
+        longName = name;
+    }
+}
+
+bool Option::match(const std::string& name)
+{
+    return name == longName || name == shortName;
+}
+
+std::ostream& Option::printNames(std::ostream& out)
+{
+    if (shortName.size()) {
+        out << "-" << shortName;
+        if (isValueExpected()) out << " VALUE";
+        out << ", --" << longName;
+        if (isValueExpected()) out << " VALUE";
+    } else {
+        out << "--" << longName;
+        if (isValueExpected()) out << " VALUE";
+    }
+    return out;
+}
+
+std::ostream& Option::print(std::ostream& out)
+{
+    std::stringstream names;
+    printNames(names);
+    out << std::setw(30) << std::left << names.str() << description << std::endl;
+    return out;
+}
+
+std::vector<std::string>& OptionParser::getArguments() { return arguments; }
+
+void OptionParser::add(Option* option)
+{
+    options.push_back(option);
+}
+
+void OptionParser::add(const std::string& name, std::string& value, const std::string& description)
+{
+    add(new StringOption(name, description, value));
+}
+void OptionParser::add(const std::string& name, int& value, const std::string& description)
+{
+    add(new IntegerOption(name, description, value));
+}
+void OptionParser::add(const std::string& name, bool& value, const std::string& description)
+{
+    add(new BooleanOption(name, description, value));
+}
+void OptionParser::add(const std::string& name, std::vector<std::string>& value, const std::string& description)
+{
+    add(new MultiStringOption(name, description, value));
+}
+
+OptionMatch::OptionMatch(const std::string& argument)
+{
+    if (argument.find("--") == 0) {
+        name = argument.substr(2);
+    } else if (argument.find("-") == 0) {
+        name = argument.substr(1);
+    }
+}
+
+bool OptionMatch::operator()(Option* option)
+{
+    return option->match(name);
+}
+
+bool OptionMatch::isOption()
+{
+    return name.size() > 0;
+}
+
+OptionParser::OptionParser(const std::string& s, const std::string& d) : summary(s), description(d), help(false)
+{
+    add("help,h", help, "show this message");
+}
+
+Option* OptionParser::getOption(const std::string& argument)
+{
+    OptionMatch match(argument);
+    if (match.isOption()) {
+        Options::iterator i = std::find_if(options.begin(), options.end(), match);
+        if (i == options.end()) {
+            std::stringstream error;
+            error << "Unrecognised option: " << argument;
+            throw OptionsError(error.str());
+        } else {
+            return *i;
+        }        
+    } else {
+        return 0;
+    }
+}
+
+void OptionParser::error(const std::string& message)
+{
+    std::cout << summary << std::endl << std::endl;
+    std::cerr << "Error: " << message << "; try --help for more information" << std::endl;
+}
+
+bool OptionParser::parse(int argc, char** argv)
+{
+    try {
+        for (int i = 1; i < argc; ++i) {
+            std::string argument = argv[i];
+            Option* o = getOption(argument);
+            if (o) {
+                if (o->isValueExpected()) {
+                    if (i + 1 < argc) {
+                        o->setValue(argv[++i]);
+                    } else {
+                        std::stringstream error;
+                        error << "Value expected for option " << o->longName;
+                        throw OptionsError(error.str());
+                    }
+                } else {
+                    o->setValue("");
+                }
+            } else {
+                arguments.push_back(argument);
+            }
+        }
+        if (help) {
+            std::cout << summary << std::endl << std::endl;
+            std::cout << description << std::endl << std::endl;
+            std::cout << "Options: " << std::endl;
+            for (Options::iterator i = options.begin(); i != options.end(); ++i) {
+                (*i)->print(std::cout);
+            }
+            return false;
+        } else {
+            return true;
+        }
+    } catch (const std::exception& e) {
+        error(e.what());
+        return false;
+    }
+}
+
+
+OptionParser::~OptionParser()
+{
+    for (Options::iterator i = options.begin(); i != options.end(); ++i) {        
+        delete *i;
+    }
+}

http://git-wip-us.apache.org/repos/asf/qpid-site/blob/34159cc7/content/releases/qpid-cpp-master/messaging-api/cpp/examples/OptionParser.cpp.html
----------------------------------------------------------------------
diff --git a/content/releases/qpid-cpp-master/messaging-api/cpp/examples/OptionParser.cpp.html b/content/releases/qpid-cpp-master/messaging-api/cpp/examples/OptionParser.cpp.html
new file mode 100644
index 0000000..6577d2c
--- /dev/null
+++ b/content/releases/qpid-cpp-master/messaging-api/cpp/examples/OptionParser.cpp.html
@@ -0,0 +1,386 @@
+<!DOCTYPE html>
+<!--
+ -
+ - 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.
+ -
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+  <head>
+    <title>OptionParser.cpp - Apache Qpid&#8482;</title>
+    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
+    <link rel="stylesheet" href="/site.css" type="text/css" async="async"/>
+    <link rel="stylesheet" href="/deferred.css" type="text/css" defer="defer"/>
+    <script type="text/javascript">var _deferredFunctions = [];</script>
+    <script type="text/javascript" src="/deferred.js" defer="defer"></script>
+    <!--[if lte IE 8]>
+      <link rel="stylesheet" href="/ie.css" type="text/css"/>
+      <script type="text/javascript" src="/html5shiv.js"></script>
+    <![endif]-->
+
+    <!-- Redirects for `go get` and godoc.org -->
+    <meta name="go-import"
+          content="qpid.apache.org git https://git-wip-us.apache.org/repos/asf/qpid-proton.git"/>
+    <meta name="go-source"
+          content="qpid.apache.org
+https://github.com/apache/qpid-proton/blob/go1/README.md
+https://github.com/apache/qpid-proton/tree/go1{/dir}
+https://github.com/apache/qpid-proton/blob/go1{/dir}/{file}#L{line}"/>
+  </head>
+  <body>
+    <div id="-content">
+      <div id="-top" class="panel">
+        <a id="-menu-link"><img width="16" height="16" src="" alt="Menu"/></a>
+
+        <a id="-search-link"><img width="22" height="16" src="" alt="Search"/></a>
+
+        <ul id="-global-navigation">
+          <li><a id="-logotype" href="/index.html">Apache Qpid<sup>&#8482;</sup></a></li>
+          <li><a href="/documentation.html">Documentation</a></li>
+          <li><a href="/download.html">Download</a></li>
+          <li><a href="/discussion.html">Discussion</a></li>
+        </ul>
+      </div>
+
+      <div id="-menu" class="panel" style="display: none;">
+        <div class="flex">
+          <section>
+            <h3>Project</h3>
+
+            <ul>
+              <li><a href="/overview.html">Overview</a></li>
+              <li><a href="/components/index.html">Components</a></li>
+              <li><a href="/releases/index.html">Releases</a></li>
+            </ul>
+          </section>
+
+          <section>
+            <h3>Messaging APIs</h3>
+
+            <ul>
+              <li><a href="/proton/index.html">Qpid Proton</a></li>
+              <li><a href="/components/jms/index.html">Qpid JMS</a></li>
+              <li><a href="/components/messaging-api/index.html">Qpid Messaging API</a></li>
+            </ul>
+          </section>
+
+          <section>
+            <h3>Servers and tools</h3>
+
+            <ul>
+              <li><a href="/components/java-broker/index.html">Broker for Java</a></li>
+              <li><a href="/components/cpp-broker/index.html">C++ broker</a></li>
+              <li><a href="/components/dispatch-router/index.html">Dispatch router</a></li>
+            </ul>
+          </section>
+
+          <section>
+            <h3>Resources</h3>
+
+            <ul>
+              <li><a href="/dashboard.html">Dashboard</a></li>
+              <li><a href="https://cwiki.apache.org/confluence/display/qpid/Index">Wiki</a></li>
+              <li><a href="/resources.html">More resources</a></li>
+            </ul>
+          </section>
+        </div>
+      </div>
+
+      <div id="-search" class="panel" style="display: none;">
+        <form action="http://www.google.com/search" method="get">
+          <input type="hidden" name="sitesearch" value="qpid.apache.org"/>
+          <input type="text" name="q" maxlength="255" autofocus="autofocus" tabindex="1"/>
+          <button type="submit">Search</button>
+          <a href="/search.html">More ways to search</a>
+        </form>
+      </div>
+
+      <div id="-middle" class="panel">
+        <ul id="-path-navigation"><li><a href="/index.html">Home</a></li><li><a href="/releases/index.html">Releases</a></li><li><a href="/releases/qpid-cpp-master/index.html">Qpid C++ documentation snapshot</a></li><li><a href="/releases/qpid-cpp-master/messaging-api/cpp/examples/index.html">C++ Messaging API Examples</a></li><li>OptionParser.cpp</li></ul>
+
+        <div id="-middle-content">
+          
+<h1>OptionParser.cpp</h1>
+<div class="highlight"><pre><span></span><span class="cp">#include</span> <span class="cpf">&quot;OptionParser.h&quot;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;qpid/types/Exception.h&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;algorithm&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;iomanip&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;cstdlib&gt;</span><span class="cp"></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="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">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">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">void</span> <span class="n">setValue</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="p">)</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
+    <span class="k">virtual</span> <span class="kt">bool</span> <span class="nf">isValueExpected</span><span class="p">()</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
+    <span class="kt">bool</span> <span class="nf">match</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="p">);</span>
+    <span class="n">std</span><span class="o">::</span><span class="n">ostream</span><span class="o">&amp;</span> <span class="n">print</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">out</span><span class="p">);</span>
+  <span class="k">private</span><span class="o">:</span>
+    <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">longName</span><span class="p">;</span>
+    <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">shortName</span><span class="p">;</span>
+    <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">description</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">printNames</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">out</span><span class="p">);</span>
+  <span class="k">friend</span> <span class="k">class</span> <span class="nc">OptionParser</span><span class="p">;</span>
+<span class="p">};</span>
+
+<span class="k">class</span> <span class="nc">StringOption</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">StringOption</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">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="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">name</span><span class="p">,</span> <span class="n">description</span><span class="p">),</span> <span class="n">value</span><span class="p">(</span><span class="n">v</span><span class="p">)</span> <span class="p">{}</span>
+    <span class="kt">void</span> <span class="n">setValue</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="p">{</span> <span class="n">value</span> <span class="o">=</span> <span class="n">v</span><span class="p">;</span> <span class="p">}</span>
+    <span class="kt">bool</span> <span class="n">isValueExpected</span><span class="p">()</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">private</span><span class="o">:</span>
+    <span class="n">std</span><span class="o">::</span><span class="n">string</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">IntegerOption</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">IntegerOption</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">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="kt">int</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">name</span><span class="p">,</span> <span class="n">description</span><span class="p">),</span> <span class="n">value</span><span class="p">(</span><span class="n">v</span><span class="p">)</span> <span class="p">{}</span>
+    <span class="kt">void</span> <span class="n">setValue</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="p">{</span> <span class="n">value</span> <span class="o">=</span> <span class="n">atoi</span><span class="p">(</span><span class="n">v</span><span class="p">.</span><span class="n">c_str</span><span class="p">());</span> <span class="p">}</span>
+    <span class="kt">bool</span> <span class="n">isValueExpected</span><span class="p">()</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">private</span><span class="o">:</span>
+    <span class="kt">int</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">BooleanOption</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">BooleanOption</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">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="kt">bool</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">name</span><span class="p">,</span> <span class="n">description</span><span class="p">),</span> <span class="n">value</span><span class="p">(</span><span class="n">v</span><span class="p">)</span> <span class="p">{}</span>
+    <span class="kt">void</span> <span class="n">setValue</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="p">)</span> <span class="p">{</span> <span class="n">value</span> <span class="o">=</span> <span class="nb">true</span><span class="p">;</span> <span class="p">}</span>
+    <span class="kt">bool</span> <span class="n">isValueExpected</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">private</span><span class="o">:</span>
+    <span class="kt">bool</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">MultiStringOption</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">MultiStringOption</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">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="n">std</span><span class="o">::</span><span class="n">vector</span><span class="o">&lt;</span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&gt;&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">name</span><span class="p">,</span> <span class="n">description</span><span class="p">),</span> <span class="n">value</span><span class="p">(</span><span class="n">v</span><span c
 lass="p">)</span> <span class="p">{}</span>
+    <span class="kt">void</span> <span class="n">setValue</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="p">{</span> <span class="n">value</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">v</span><span class="p">);</span> <span class="p">}</span>
+    <span class="kt">bool</span> <span class="n">isValueExpected</span><span class="p">()</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">private</span><span class="o">:</span>
+    <span class="n">std</span><span class="o">::</span><span class="n">vector</span><span class="o">&lt;</span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&gt;&amp;</span> <span class="n">value</span><span class="p">;</span>
+<span class="p">};</span>
+
+<span class="k">class</span> <span class="nc">OptionMatch</span>
+<span class="p">{</span>
+  <span class="k">public</span><span class="o">:</span>
+    <span class="n">OptionMatch</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">argument</span><span class="p">);</span>
+    <span class="kt">bool</span> <span class="nf">operator</span><span class="p">()(</span><span class="n">Option</span><span class="o">*</span> <span class="n">option</span><span class="p">);</span>
+    <span class="kt">bool</span> <span class="nf">isOption</span><span class="p">();</span>
+  <span class="k">private</span><span class="o">:</span>
+    <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">name</span><span class="p">;</span>
+<span class="p">};</span>
+
+<span class="k">class</span> <span class="nc">OptionsError</span> <span class="o">:</span> <span class="k">public</span> <span class="n">qpid</span><span class="o">::</span><span class="n">types</span><span class="o">::</span><span class="n">Exception</span>
+<span class="p">{</span>
+  <span class="k">public</span><span class="o">:</span>
+    <span class="n">OptionsError</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">message</span><span class="p">)</span> <span class="o">:</span> <span class="n">qpid</span><span class="o">::</span><span class="n">types</span><span class="o">::</span><span class="n">Exception</span><span class="p">(</span><span class="n">message</span><span class="p">)</span> <span class="p">{}</span>
+<span class="p">};</span>
+
+<span class="n">Option</span><span class="o">::</span><span class="n">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">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">desc</span><span class="p">)</span> <span class="o">:</span> <span class="n">description</span><span class="p">(</span><span class="n">desc</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="o">::</span><span class="n">size_type</span> <span class="n">i</span> <span class="o">=</span> <span class="n">name</span><span class="p">.</span><span class="n">find</span><span class="p">(</span><span class="s">&quot;,&quot;</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">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="p">{</span>
+        <span class="n">longName</span> <span class="o">=</span> <span class="n">name</span><span class="p">.</span><span class="n">substr</span><span class="p">(</span><span class="mi">0</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">i</span> <span class="o">+</span> <span class="mi">1</span> <span class="o">&lt;</span> <span class="n">name</span><span class="p">.</span><span class="n">size</span><span class="p">())</span>
+            <span class="n">shortName</span> <span class="o">=</span> <span class="n">name</span><span class="p">.</span><span class="n">substr</span><span class="p">(</span><span class="n">i</span><span class="o">+</span><span class="mi">1</span><span class="p">);</span>
+    <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
+        <span class="n">longName</span> <span class="o">=</span> <span class="n">name</span><span class="p">;</span>
+    <span class="p">}</span>
+<span class="p">}</span>
+
+<span class="kt">bool</span> <span class="n">Option</span><span class="o">::</span><span class="n">match</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">name</span><span class="p">)</span>
+<span class="p">{</span>
+    <span class="k">return</span> <span class="n">name</span> <span class="o">==</span> <span class="n">longName</span> <span class="o">||</span> <span class="n">name</span> <span class="o">==</span> <span class="n">shortName</span><span class="p">;</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">Option</span><span class="o">::</span><span class="n">printNames</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">out</span><span class="p">)</span>
+<span class="p">{</span>
+    <span class="k">if</span> <span class="p">(</span><span class="n">shortName</span><span class="p">.</span><span class="n">size</span><span class="p">())</span> <span class="p">{</span>
+        <span class="n">out</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;-&quot;</span> <span class="o">&lt;&lt;</span> <span class="n">shortName</span><span class="p">;</span>
+        <span class="k">if</span> <span class="p">(</span><span class="n">isValueExpected</span><span class="p">())</span> <span class="n">out</span> <span class="o">&lt;&lt;</span> <span class="s">&quot; VALUE&quot;</span><span class="p">;</span>
+        <span class="n">out</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;, --&quot;</span> <span class="o">&lt;&lt;</span> <span class="n">longName</span><span class="p">;</span>
+        <span class="k">if</span> <span class="p">(</span><span class="n">isValueExpected</span><span class="p">())</span> <span class="n">out</span> <span class="o">&lt;&lt;</span> <span class="s">&quot; VALUE&quot;</span><span class="p">;</span>
+    <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
+        <span class="n">out</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;--&quot;</span> <span class="o">&lt;&lt;</span> <span class="n">longName</span><span class="p">;</span>
+        <span class="k">if</span> <span class="p">(</span><span class="n">isValueExpected</span><span class="p">())</span> <span class="n">out</span> <span class="o">&lt;&lt;</span> <span class="s">&quot; VALUE&quot;</span><span class="p">;</span>
+    <span class="p">}</span>
+    <span class="k">return</span> <span class="n">out</span><span class="p">;</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">Option</span><span class="o">::</span><span class="n">print</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">out</span><span class="p">)</span>
+<span class="p">{</span>
+    <span class="n">std</span><span class="o">::</span><span class="n">stringstream</span> <span class="n">names</span><span class="p">;</span>
+    <span class="n">printNames</span><span class="p">(</span><span class="n">names</span><span class="p">);</span>
+    <span class="n">out</span> <span class="o">&lt;&lt;</span> <span class="n">std</span><span class="o">::</span><span class="n">setw</span><span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="o">&lt;&lt;</span> <span class="n">std</span><span class="o">::</span><span class="n">left</span> <span class="o">&lt;&lt;</span> <span class="n">names</span><span class="p">.</span><span class="n">str</span><span class="p">()</span> <span class="o">&lt;&lt;</span> <span class="n">description</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">out</span><span class="p">;</span>
+<span class="p">}</span>
+
+<span class="n">std</span><span class="o">::</span><span class="n">vector</span><span class="o">&lt;</span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&gt;&amp;</span> <span class="n">OptionParser</span><span class="o">::</span><span class="n">getArguments</span><span class="p">()</span> <span class="p">{</span> <span class="k">return</span> <span class="n">arguments</span><span class="p">;</span> <span class="p">}</span>
+
+<span class="kt">void</span> <span class="n">OptionParser</span><span class="o">::</span><span class="n">add</span><span class="p">(</span><span class="n">Option</span><span class="o">*</span> <span class="n">option</span><span class="p">)</span>
+<span class="p">{</span>
+    <span class="n">options</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">option</span><span class="p">);</span>
+<span class="p">}</span>
+
+<span class="kt">void</span> <span class="n">OptionParser</span><span class="o">::</span><span class="n">add</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">name</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&amp;</span> <span class="n">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">description</span><span class="p">)</span>
+<span class="p">{</span>
+    <span class="n">add</span><span class="p">(</span><span class="k">new</span> <span class="n">StringOption</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">description</span><span class="p">,</span> <span class="n">value</span><span class="p">));</span>
+<span class="p">}</span>
+<span class="kt">void</span> <span class="n">OptionParser</span><span class="o">::</span><span class="n">add</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">name</span><span class="p">,</span> <span class="kt">int</span><span class="o">&amp;</span> <span class="n">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">description</span><span class="p">)</span>
+<span class="p">{</span>
+    <span class="n">add</span><span class="p">(</span><span class="k">new</span> <span class="n">IntegerOption</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">description</span><span class="p">,</span> <span class="n">value</span><span class="p">));</span>
+<span class="p">}</span>
+<span class="kt">void</span> <span class="n">OptionParser</span><span class="o">::</span><span class="n">add</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">name</span><span class="p">,</span> <span class="kt">bool</span><span class="o">&amp;</span> <span class="n">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">description</span><span class="p">)</span>
+<span class="p">{</span>
+    <span class="n">add</span><span class="p">(</span><span class="k">new</span> <span class="n">BooleanOption</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">description</span><span class="p">,</span> <span class="n">value</span><span class="p">));</span>
+<span class="p">}</span>
+<span class="kt">void</span> <span class="n">OptionParser</span><span class="o">::</span><span class="n">add</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">name</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="n">vector</span><span class="o">&lt;</span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&gt;&amp;</span> <span class="n">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">description</span><span class="p">)</span>
+<span class="p">{</span>
+    <span class="n">add</span><span class="p">(</span><span class="k">new</span> <span class="n">MultiStringOption</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">description</span><span class="p">,</span> <span class="n">value</span><span class="p">));</span>
+<span class="p">}</span>
+
+<span class="n">OptionMatch</span><span class="o">::</span><span class="n">OptionMatch</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">argument</span><span class="p">)</span>
+<span class="p">{</span>
+    <span class="k">if</span> <span class="p">(</span><span class="n">argument</span><span class="p">.</span><span class="n">find</span><span class="p">(</span><span class="s">&quot;--&quot;</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
+        <span class="n">name</span> <span class="o">=</span> <span class="n">argument</span><span class="p">.</span><span class="n">substr</span><span class="p">(</span><span class="mi">2</span><span class="p">);</span>
+    <span class="p">}</span> <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="n">argument</span><span class="p">.</span><span class="n">find</span><span class="p">(</span><span class="s">&quot;-&quot;</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
+        <span class="n">name</span> <span class="o">=</span> <span class="n">argument</span><span class="p">.</span><span class="n">substr</span><span class="p">(</span><span class="mi">1</span><span class="p">);</span>
+    <span class="p">}</span>
+<span class="p">}</span>
+
+<span class="kt">bool</span> <span class="n">OptionMatch</span><span class="o">::</span><span class="k">operator</span><span class="p">()(</span><span class="n">Option</span><span class="o">*</span> <span class="n">option</span><span class="p">)</span>
+<span class="p">{</span>
+    <span class="k">return</span> <span class="n">option</span><span class="o">-&gt;</span><span class="n">match</span><span class="p">(</span><span class="n">name</span><span class="p">);</span>
+<span class="p">}</span>
+
+<span class="kt">bool</span> <span class="n">OptionMatch</span><span class="o">::</span><span class="n">isOption</span><span class="p">()</span>
+<span class="p">{</span>
+    <span class="k">return</span> <span class="n">name</span><span class="p">.</span><span class="n">size</span><span class="p">()</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">;</span>
+<span class="p">}</span>
+
+<span class="n">OptionParser</span><span class="o">::</span><span class="n">OptionParser</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="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">summary</span><span class="p">(</span><span class="n">s</span><span class="p">),</span> <span class="n">description</span><span class="p">(</span><span class="n">d</span><span class="p">),</span> <span class="n">help</span><span class="p">(</span><span class="nb">false</span><span class="p">)</span>
+<span class="p">{</span>
+    <span class="n">add</span><span class="p">(</span><span class="s">&quot;help,h&quot;</span><span class="p">,</span> <span class="n">help</span><span class="p">,</span> <span class="s">&quot;show this message&quot;</span><span class="p">);</span>
+<span class="p">}</span>
+
+<span class="n">Option</span><span class="o">*</span> <span class="n">OptionParser</span><span class="o">::</span><span class="n">getOption</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">argument</span><span class="p">)</span>
+<span class="p">{</span>
+    <span class="n">OptionMatch</span> <span class="n">match</span><span class="p">(</span><span class="n">argument</span><span class="p">);</span>
+    <span class="k">if</span> <span class="p">(</span><span class="n">match</span><span class="p">.</span><span class="n">isOption</span><span class="p">())</span> <span class="p">{</span>
+        <span class="n">Options</span><span class="o">::</span><span class="n">iterator</span> <span class="n">i</span> <span class="o">=</span> <span class="n">std</span><span class="o">::</span><span class="n">find_if</span><span class="p">(</span><span class="n">options</span><span class="p">.</span><span class="n">begin</span><span class="p">(),</span> <span class="n">options</span><span class="p">.</span><span class="n">end</span><span class="p">(),</span> <span class="n">match</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">options</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">stringstream</span> <span class="n">error</span><span class="p">;</span>
+            <span class="n">error</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;Unrecognised option: &quot;</span> <span class="o">&lt;&lt;</span> <span class="n">argument</span><span class="p">;</span>
+            <span class="k">throw</span> <span class="nf">OptionsError</span><span class="p">(</span><span class="n">error</span><span class="p">.</span><span class="n">str</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="o">*</span><span class="n">i</span><span class="p">;</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="mi">0</span><span class="p">;</span>
+    <span class="p">}</span>
+<span class="p">}</span>
+
+<span class="kt">void</span> <span class="n">OptionParser</span><span class="o">::</span><span class="n">error</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">message</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">summary</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">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">cerr</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;Error: &quot;</span> <span class="o">&lt;&lt;</span> <span class="n">message</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;; try --help for more information&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="p">}</span>
+
+<span class="kt">bool</span> <span class="n">OptionParser</span><span class="o">::</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="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="k">for</span> <span class="p">(</span><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">1</span><span class="p">;</span> <span class="n">i</span> <span class="o">&lt;</span> <span class="n">argc</span><span class="p">;</span> <span class="o">++</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">argument</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="n">Option</span><span class="o">*</span> <span class="n">o</span> <span class="o">=</span> <span class="n">getOption</span><span class="p">(</span><span class="n">argument</span><span class="p">);</span>
+            <span class="k">if</span> <span class="p">(</span><span class="n">o</span><span class="p">)</span> <span class="p">{</span>
+                <span class="k">if</span> <span class="p">(</span><span class="n">o</span><span class="o">-&gt;</span><span class="n">isValueExpected</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">+</span> <span class="mi">1</span> <span class="o">&lt;</span> <span class="n">argc</span><span class="p">)</span> <span class="p">{</span>
+                        <span class="n">o</span><span class="o">-&gt;</span><span class="n">setValue</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="p">}</span> <span class="k">else</span> <span class="p">{</span>
+                        <span class="n">std</span><span class="o">::</span><span class="n">stringstream</span> <span class="n">error</span><span class="p">;</span>
+                        <span class="n">error</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;Value expected for option &quot;</span> <span class="o">&lt;&lt;</span> <span class="n">o</span><span class="o">-&gt;</span><span class="n">longName</span><span class="p">;</span>
+                        <span class="k">throw</span> <span class="nf">OptionsError</span><span class="p">(</span><span class="n">error</span><span class="p">.</span><span class="n">str</span><span class="p">());</span>
+                    <span class="p">}</span>
+                <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
+                    <span class="n">o</span><span class="o">-&gt;</span><span class="n">setValue</span><span class="p">(</span><span class="s">&quot;&quot;</span><span class="p">);</span>
+                <span class="p">}</span>
+            <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
+                <span class="n">arguments</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">argument</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">help</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">summary</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">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">cout</span> <span class="o">&lt;&lt;</span> <span class="n">description</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">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">cout</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">Options</span><span class="o">::</span><span class="n">iterator</span> <span class="n">i</span> <span class="o">=</span> <span class="n">options</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">options</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="p">{</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">print</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">cout</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">else</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="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">error</span><span class="p">(</span><span class="n">e</span><span class="p">.</span><span class="n">what</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="n">OptionParser</span><span class="o">::~</span><span class="n">OptionParser</span><span class="p">()</span>
+<span class="p">{</span>
+    <span class="k">for</span> <span class="p">(</span><span class="n">Options</span><span class="o">::</span><span class="n">iterator</span> <span class="n">i</span> <span class="o">=</span> <span class="n">options</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">options</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="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="p">}</span>
+</pre></div>
+
+<p><a href="OptionParser.cpp">Download this file</a></p>
+
+
+          <hr/>
+
+          <ul id="-apache-navigation">
+            <li><a href="http://www.apache.org/">Apache</a></li>
+            <li><a href="http://www.apache.org/licenses/">License</a></li>
+            <li><a href="http://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li>
+            <li><a href="http://www.apache.org/foundation/thanks.html">Thanks!</a></li>
+            <li><a href="/security.html">Security</a></li>
+            <li><a href="http://www.apache.org/"><img id="-apache-feather" width="48" height="14" src="" alt="Apache"/></a></li>
+          </ul>
+
+          <p id="-legal">
+            Apache Qpid, Messaging built on AMQP; Copyright &#169; 2015
+            The Apache Software Foundation; Licensed under
+            the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache
+            License, Version 2.0</a>; Apache Qpid, Qpid, Qpid Proton,
+            Proton, Apache, the Apache feather logo, and the Apache Qpid
+            project logo are trademarks of The Apache Software
+            Foundation; All other marks mentioned may be trademarks or
+            registered trademarks of their respective owners
+          </p>
+        </div>
+      </div>
+    </div>
+  </body>
+</html>

http://git-wip-us.apache.org/repos/asf/qpid-site/blob/34159cc7/content/releases/qpid-cpp-master/messaging-api/cpp/examples/OptionParser.h
----------------------------------------------------------------------
diff --git a/content/releases/qpid-cpp-master/messaging-api/cpp/examples/OptionParser.h b/content/releases/qpid-cpp-master/messaging-api/cpp/examples/OptionParser.h
new file mode 100755
index 0000000..4cda53f
--- /dev/null
+++ b/content/releases/qpid-cpp-master/messaging-api/cpp/examples/OptionParser.h
@@ -0,0 +1,56 @@
+#ifndef OPTIONPARSER_H
+#define OPTIONPARSER_H
+
+/*
+ *
+ * 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 <map>
+#include <string>
+#include <vector>
+
+class Option;
+
+class OptionParser
+{
+  public:
+    OptionParser(const std::string& usage, const std::string& description);
+    ~OptionParser();
+    void add(const std::string& name, std::string& value, const std::string& description = std::string());
+    void add(const std::string& name, int& value, const std::string& description = std::string());
+    void add(const std::string& name, bool& value, const std::string& description = std::string());
+    void add(const std::string& name, std::vector<std::string>& value, const std::string& description = std::string());
+    bool parse(int argc, char** argv);
+    void error(const std::string& message);
+    std::vector<std::string>& getArguments();
+  private:
+    typedef std::vector<Option*> Options;
+
+    const std::string summary;
+    const std::string description;
+    bool help;
+    Options options;
+    std::vector<std::string> arguments;
+
+    void add(Option*);
+    Option* getOption(const std::string& argument);
+};
+
+#endif  /*!OPTIONPARSER_H*/

http://git-wip-us.apache.org/repos/asf/qpid-site/blob/34159cc7/content/releases/qpid-cpp-master/messaging-api/cpp/examples/OptionParser.h.html
----------------------------------------------------------------------
diff --git a/content/releases/qpid-cpp-master/messaging-api/cpp/examples/OptionParser.h.html b/content/releases/qpid-cpp-master/messaging-api/cpp/examples/OptionParser.h.html
new file mode 100644
index 0000000..8b0cccf
--- /dev/null
+++ b/content/releases/qpid-cpp-master/messaging-api/cpp/examples/OptionParser.h.html
@@ -0,0 +1,186 @@
+<!DOCTYPE html>
+<!--
+ -
+ - 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.
+ -
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+  <head>
+    <title>OptionParser.h - Apache Qpid&#8482;</title>
+    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
+    <link rel="stylesheet" href="/site.css" type="text/css" async="async"/>
+    <link rel="stylesheet" href="/deferred.css" type="text/css" defer="defer"/>
+    <script type="text/javascript">var _deferredFunctions = [];</script>
+    <script type="text/javascript" src="/deferred.js" defer="defer"></script>
+    <!--[if lte IE 8]>
+      <link rel="stylesheet" href="/ie.css" type="text/css"/>
+      <script type="text/javascript" src="/html5shiv.js"></script>
+    <![endif]-->
+
+    <!-- Redirects for `go get` and godoc.org -->
+    <meta name="go-import"
+          content="qpid.apache.org git https://git-wip-us.apache.org/repos/asf/qpid-proton.git"/>
+    <meta name="go-source"
+          content="qpid.apache.org
+https://github.com/apache/qpid-proton/blob/go1/README.md
+https://github.com/apache/qpid-proton/tree/go1{/dir}
+https://github.com/apache/qpid-proton/blob/go1{/dir}/{file}#L{line}"/>
+  </head>
+  <body>
+    <div id="-content">
+      <div id="-top" class="panel">
+        <a id="-menu-link"><img width="16" height="16" src="" alt="Menu"/></a>
+
+        <a id="-search-link"><img width="22" height="16" src="" alt="Search"/></a>
+
+        <ul id="-global-navigation">
+          <li><a id="-logotype" href="/index.html">Apache Qpid<sup>&#8482;</sup></a></li>
+          <li><a href="/documentation.html">Documentation</a></li>
+          <li><a href="/download.html">Download</a></li>
+          <li><a href="/discussion.html">Discussion</a></li>
+        </ul>
+      </div>
+
+      <div id="-menu" class="panel" style="display: none;">
+        <div class="flex">
+          <section>
+            <h3>Project</h3>
+
+            <ul>
+              <li><a href="/overview.html">Overview</a></li>
+              <li><a href="/components/index.html">Components</a></li>
+              <li><a href="/releases/index.html">Releases</a></li>
+            </ul>
+          </section>
+
+          <section>
+            <h3>Messaging APIs</h3>
+
+            <ul>
+              <li><a href="/proton/index.html">Qpid Proton</a></li>
+              <li><a href="/components/jms/index.html">Qpid JMS</a></li>
+              <li><a href="/components/messaging-api/index.html">Qpid Messaging API</a></li>
+            </ul>
+          </section>
+
+          <section>
+            <h3>Servers and tools</h3>
+
+            <ul>
+              <li><a href="/components/java-broker/index.html">Broker for Java</a></li>
+              <li><a href="/components/cpp-broker/index.html">C++ broker</a></li>
+              <li><a href="/components/dispatch-router/index.html">Dispatch router</a></li>
+            </ul>
+          </section>
+
+          <section>
+            <h3>Resources</h3>
+
+            <ul>
+              <li><a href="/dashboard.html">Dashboard</a></li>
+              <li><a href="https://cwiki.apache.org/confluence/display/qpid/Index">Wiki</a></li>
+              <li><a href="/resources.html">More resources</a></li>
+            </ul>
+          </section>
+        </div>
+      </div>
+
+      <div id="-search" class="panel" style="display: none;">
+        <form action="http://www.google.com/search" method="get">
+          <input type="hidden" name="sitesearch" value="qpid.apache.org"/>
+          <input type="text" name="q" maxlength="255" autofocus="autofocus" tabindex="1"/>
+          <button type="submit">Search</button>
+          <a href="/search.html">More ways to search</a>
+        </form>
+      </div>
+
+      <div id="-middle" class="panel">
+        <ul id="-path-navigation"><li><a href="/index.html">Home</a></li><li><a href="/releases/index.html">Releases</a></li><li><a href="/releases/qpid-cpp-master/index.html">Qpid C++ documentation snapshot</a></li><li><a href="/releases/qpid-cpp-master/messaging-api/cpp/examples/index.html">C++ Messaging API Examples</a></li><li>OptionParser.h</li></ul>
+
+        <div id="-middle-content">
+          
+<h1>OptionParser.h</h1>
+<div class="highlight"><pre><span></span><span class="cp">#ifndef OPTIONPARSER_H</span>
+<span class="cp">#define OPTIONPARSER_H</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;vector&gt;</span><span class="cp"></span>
+
+<span class="k">class</span> <span class="nc">Option</span><span class="p">;</span>
+
+<span class="k">class</span> <span class="nc">OptionParser</span>
+<span class="p">{</span>
+  <span class="k">public</span><span class="o">:</span>
+    <span class="n">OptionParser</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">usage</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="o">~</span><span class="n">OptionParser</span><span class="p">();</span>
+    <span class="kt">void</span> <span class="nf">add</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">name</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&amp;</span> <span class="n">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">description</span> <span class="o">=</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="p">());</span>
+    <span class="kt">void</span> <span class="nf">add</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">name</span><span class="p">,</span> <span class="kt">int</span><span class="o">&amp;</span> <span class="n">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">description</span> <span class="o">=</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="p">());</span>
+    <span class="kt">void</span> <span class="nf">add</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">name</span><span class="p">,</span> <span class="kt">bool</span><span class="o">&amp;</span> <span class="n">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">description</span> <span class="o">=</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="p">());</span>
+    <span class="kt">void</span> <span class="nf">add</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">name</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="n">vector</span><span class="o">&lt;</span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&gt;&amp;</span> <span class="n">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">description</span> <span class="o">=</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="p">());</span>
+    <span class="kt">bool</span> <span class="nf">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="o">**</span> <span class="n">argv</span><span class="p">);</span>
+    <span class="kt">void</span> <span class="nf">error</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">message</span><span class="p">);</span>
+    <span class="n">std</span><span class="o">::</span><span class="n">vector</span><span class="o">&lt;</span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&gt;&amp;</span> <span class="n">getArguments</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">vector</span><span class="o">&lt;</span><span class="n">Option</span><span class="o">*&gt;</span> <span class="n">Options</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">summary</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">description</span><span class="p">;</span>
+    <span class="kt">bool</span> <span class="n">help</span><span class="p">;</span>
+    <span class="n">Options</span> <span class="n">options</span><span class="p">;</span>
+    <span class="n">std</span><span class="o">::</span><span class="n">vector</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="n">arguments</span><span class="p">;</span>
+
+    <span class="kt">void</span> <span class="nf">add</span><span class="p">(</span><span class="n">Option</span><span class="o">*</span><span class="p">);</span>
+    <span class="n">Option</span><span class="o">*</span> <span class="nf">getOption</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">argument</span><span class="p">);</span>
+<span class="p">};</span>
+
+<span class="cp">#endif</span>
+</pre></div>
+
+<p><a href="OptionParser.h">Download this file</a></p>
+
+
+          <hr/>
+
+          <ul id="-apache-navigation">
+            <li><a href="http://www.apache.org/">Apache</a></li>
+            <li><a href="http://www.apache.org/licenses/">License</a></li>
+            <li><a href="http://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li>
+            <li><a href="http://www.apache.org/foundation/thanks.html">Thanks!</a></li>
+            <li><a href="/security.html">Security</a></li>
+            <li><a href="http://www.apache.org/"><img id="-apache-feather" width="48" height="14" src="" alt="Apache"/></a></li>
+          </ul>
+
+          <p id="-legal">
+            Apache Qpid, Messaging built on AMQP; Copyright &#169; 2015
+            The Apache Software Foundation; Licensed under
+            the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache
+            License, Version 2.0</a>; Apache Qpid, Qpid, Qpid Proton,
+            Proton, Apache, the Apache feather logo, and the Apache Qpid
+            project logo are trademarks of The Apache Software
+            Foundation; All other marks mentioned may be trademarks or
+            registered trademarks of their respective owners
+          </p>
+        </div>
+      </div>
+    </div>
+  </body>
+</html>

http://git-wip-us.apache.org/repos/asf/qpid-site/blob/34159cc7/content/releases/qpid-cpp-master/messaging-api/cpp/examples/client.cpp
----------------------------------------------------------------------
diff --git a/content/releases/qpid-cpp-master/messaging-api/cpp/examples/client.cpp b/content/releases/qpid-cpp-master/messaging-api/cpp/examples/client.cpp
new file mode 100755
index 0000000..44720ef
--- /dev/null
+++ b/content/releases/qpid-cpp-master/messaging-api/cpp/examples/client.cpp
@@ -0,0 +1,80 @@
+/*
+ *
+ * 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 <qpid/messaging/Address.h>
+#include <qpid/messaging/Connection.h>
+#include <qpid/messaging/Message.h>
+#include <qpid/messaging/Receiver.h>
+#include <qpid/messaging/Sender.h>
+#include <qpid/messaging/Session.h>
+
+#include <cstdlib>
+#include <iostream>
+
+#include <sstream>
+
+using namespace qpid::messaging;
+
+using std::stringstream;
+using std::string;
+
+int main(int argc, char** argv) {
+    const char* url = argc>1 ? argv[1] : "amqp:tcp:127.0.0.1:5672";
+    std::string connectionOptions = argc > 2 ? argv[2] : "";
+
+    Connection connection(url, connectionOptions);
+     try {
+        connection.open();
+        Session session = connection.createSession();
+
+        Sender sender = session.createSender("service_queue");
+
+        //create temp queue & receiver...
+        Receiver receiver = session.createReceiver("#");
+        Address responseQueue = receiver.getAddress();
+
+	// Now send some messages ...
+	string s[] = {
+            "Twas brillig, and the slithy toves",
+            "Did gire and gymble in the wabe.",
+            "All mimsy were the borogroves,",
+            "And the mome raths outgrabe."
+        };
+
+    	Message request;
+        request.setReplyTo(responseQueue);
+	for (int i=0; i<4; i++) {
+            request.setContentObject(s[i]);
+            sender.send(request);
+            Message response = receiver.fetch();
+            std::cout << request.getContentObject() << " -> " << response.getContentObject() << std::endl;
+            session.acknowledge(response);
+	}
+        connection.close();
+        return 0;
+    } catch(const std::exception& error) {
+        std::cout << error.what() << std::endl;
+        connection.close();
+    }
+    return 1;
+}
+
+

http://git-wip-us.apache.org/repos/asf/qpid-site/blob/34159cc7/content/releases/qpid-cpp-master/messaging-api/cpp/examples/client.cpp.html
----------------------------------------------------------------------
diff --git a/content/releases/qpid-cpp-master/messaging-api/cpp/examples/client.cpp.html b/content/releases/qpid-cpp-master/messaging-api/cpp/examples/client.cpp.html
new file mode 100644
index 0000000..88fb36b
--- /dev/null
+++ b/content/releases/qpid-cpp-master/messaging-api/cpp/examples/client.cpp.html
@@ -0,0 +1,206 @@
+<!DOCTYPE html>
+<!--
+ -
+ - 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.
+ -
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+  <head>
+    <title>client.cpp - Apache Qpid&#8482;</title>
+    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
+    <link rel="stylesheet" href="/site.css" type="text/css" async="async"/>
+    <link rel="stylesheet" href="/deferred.css" type="text/css" defer="defer"/>
+    <script type="text/javascript">var _deferredFunctions = [];</script>
+    <script type="text/javascript" src="/deferred.js" defer="defer"></script>
+    <!--[if lte IE 8]>
+      <link rel="stylesheet" href="/ie.css" type="text/css"/>
+      <script type="text/javascript" src="/html5shiv.js"></script>
+    <![endif]-->
+
+    <!-- Redirects for `go get` and godoc.org -->
+    <meta name="go-import"
+          content="qpid.apache.org git https://git-wip-us.apache.org/repos/asf/qpid-proton.git"/>
+    <meta name="go-source"
+          content="qpid.apache.org
+https://github.com/apache/qpid-proton/blob/go1/README.md
+https://github.com/apache/qpid-proton/tree/go1{/dir}
+https://github.com/apache/qpid-proton/blob/go1{/dir}/{file}#L{line}"/>
+  </head>
+  <body>
+    <div id="-content">
+      <div id="-top" class="panel">
+        <a id="-menu-link"><img width="16" height="16" src="" alt="Menu"/></a>
+
+        <a id="-search-link"><img width="22" height="16" src="" alt="Search"/></a>
+
+        <ul id="-global-navigation">
+          <li><a id="-logotype" href="/index.html">Apache Qpid<sup>&#8482;</sup></a></li>
+          <li><a href="/documentation.html">Documentation</a></li>
+          <li><a href="/download.html">Download</a></li>
+          <li><a href="/discussion.html">Discussion</a></li>
+        </ul>
+      </div>
+
+      <div id="-menu" class="panel" style="display: none;">
+        <div class="flex">
+          <section>
+            <h3>Project</h3>
+
+            <ul>
+              <li><a href="/overview.html">Overview</a></li>
+              <li><a href="/components/index.html">Components</a></li>
+              <li><a href="/releases/index.html">Releases</a></li>
+            </ul>
+          </section>
+
+          <section>
+            <h3>Messaging APIs</h3>
+
+            <ul>
+              <li><a href="/proton/index.html">Qpid Proton</a></li>
+              <li><a href="/components/jms/index.html">Qpid JMS</a></li>
+              <li><a href="/components/messaging-api/index.html">Qpid Messaging API</a></li>
+            </ul>
+          </section>
+
+          <section>
+            <h3>Servers and tools</h3>
+
+            <ul>
+              <li><a href="/components/java-broker/index.html">Broker for Java</a></li>
+              <li><a href="/components/cpp-broker/index.html">C++ broker</a></li>
+              <li><a href="/components/dispatch-router/index.html">Dispatch router</a></li>
+            </ul>
+          </section>
+
+          <section>
+            <h3>Resources</h3>
+
+            <ul>
+              <li><a href="/dashboard.html">Dashboard</a></li>
+              <li><a href="https://cwiki.apache.org/confluence/display/qpid/Index">Wiki</a></li>
+              <li><a href="/resources.html">More resources</a></li>
+            </ul>
+          </section>
+        </div>
+      </div>
+
+      <div id="-search" class="panel" style="display: none;">
+        <form action="http://www.google.com/search" method="get">
+          <input type="hidden" name="sitesearch" value="qpid.apache.org"/>
+          <input type="text" name="q" maxlength="255" autofocus="autofocus" tabindex="1"/>
+          <button type="submit">Search</button>
+          <a href="/search.html">More ways to search</a>
+        </form>
+      </div>
+
+      <div id="-middle" class="panel">
+        <ul id="-path-navigation"><li><a href="/index.html">Home</a></li><li><a href="/releases/index.html">Releases</a></li><li><a href="/releases/qpid-cpp-master/index.html">Qpid C++ documentation snapshot</a></li><li><a href="/releases/qpid-cpp-master/messaging-api/cpp/examples/index.html">C++ Messaging API Examples</a></li><li>client.cpp</li></ul>
+
+        <div id="-middle-content">
+          
+<h1>client.cpp</h1>
+<div class="highlight"><pre><span></span><span class="cp">#include</span> <span class="cpf">&lt;qpid/messaging/Address.h&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;qpid/messaging/Connection.h&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;qpid/messaging/Message.h&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;qpid/messaging/Receiver.h&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;qpid/messaging/Sender.h&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;qpid/messaging/Session.h&gt;</span><span class="cp"></span>
+
+<span class="cp">#include</span> <span class="cpf">&lt;cstdlib&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;sstream&gt;</span><span class="cp"></span>
+
+<span class="k">using</span> <span class="k">namespace</span> <span class="n">qpid</span><span class="o">::</span><span class="n">messaging</span><span class="p">;</span>
+
+<span class="k">using</span> <span class="n">std</span><span class="o">::</span><span class="n">stringstream</span><span class="p">;</span>
+<span class="k">using</span> <span class="n">std</span><span class="o">::</span><span class="n">string</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">const</span> <span class="kt">char</span><span class="o">*</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;amqp:tcp:127.0.0.1:5672&quot;</span><span class="p">;</span>
+    <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">connectionOptions</span> <span class="o">=</span> <span class="n">argc</span> <span class="o">&gt;</span> <span class="mi">2</span> <span class="o">?</span> <span class="n">argv</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">:</span> <span class="s">&quot;&quot;</span><span class="p">;</span>
+
+    <span class="n">Connection</span> <span class="n">connection</span><span class="p">(</span><span class="n">url</span><span class="p">,</span> <span class="n">connectionOptions</span><span class="p">);</span>
+     <span class="k">try</span> <span class="p">{</span>
+        <span class="n">connection</span><span class="p">.</span><span class="n">open</span><span class="p">();</span>
+        <span class="n">Session</span> <span class="n">session</span> <span class="o">=</span> <span class="n">connection</span><span class="p">.</span><span class="n">createSession</span><span class="p">();</span>
+
+        <span class="n">Sender</span> <span class="n">sender</span> <span class="o">=</span> <span class="n">session</span><span class="p">.</span><span class="n">createSender</span><span class="p">(</span><span class="s">&quot;service_queue&quot;</span><span class="p">);</span>
+
+        <span class="c1">//create temp queue &amp; receiver...</span>
+        <span class="n">Receiver</span> <span class="n">receiver</span> <span class="o">=</span> <span class="n">session</span><span class="p">.</span><span class="n">createReceiver</span><span class="p">(</span><span class="s">&quot;#&quot;</span><span class="p">);</span>
+        <span class="n">Address</span> <span class="n">responseQueue</span> <span class="o">=</span> <span class="n">receiver</span><span class="p">.</span><span class="n">getAddress</span><span class="p">();</span>
+
+	<span class="c1">// Now send some messages ...</span>
+	<span class="n">string</span> <span class="n">s</span><span class="p">[]</span> <span class="o">=</span> <span class="p">{</span>
+            <span class="s">&quot;Twas brillig, and the slithy toves&quot;</span><span class="p">,</span>
+            <span class="s">&quot;Did gire and gymble in the wabe.&quot;</span><span class="p">,</span>
+            <span class="s">&quot;All mimsy were the borogroves,&quot;</span><span class="p">,</span>
+            <span class="s">&quot;And the mome raths outgrabe.&quot;</span>
+        <span class="p">};</span>
+
+    	<span class="n">Message</span> <span class="n">request</span><span class="p">;</span>
+        <span class="n">request</span><span class="p">.</span><span class="n">setReplyTo</span><span class="p">(</span><span class="n">responseQueue</span><span class="p">);</span>
+	<span class="k">for</span> <span class="p">(</span><span class="kt">int</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="mi">4</span><span class="p">;</span> <span class="n">i</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>
+            <span class="n">request</span><span class="p">.</span><span class="n">setContentObject</span><span class="p">(</span><span class="n">s</span><span class="p">[</span><span class="n">i</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">request</span><span class="p">);</span>
+            <span class="n">Message</span> <span class="n">response</span> <span class="o">=</span> <span class="n">receiver</span><span class="p">.</span><span class="n">fetch</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">request</span><span class="p">.</span><span class="n">getContentObject</span><span class="p">()</span> <span class="o">&lt;&lt;</span> <span class="s">&quot; -&gt; &quot;</span> <span class="o">&lt;&lt;</span> <span class="n">response</span><span class="p">.</span><span class="n">getContentObject</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">session</span><span class="p">.</span><span class="n">acknowledge</span><span class="p">(</span><span class="n">response</span><span class="p">);</span>
+	<span class="p">}</span>
+        <span class="n">connection</span><span class="p">.</span><span class="n">close</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">error</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">error</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="n">connection</span><span class="p">.</span><span class="n">close</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="client.cpp">Download this file</a></p>
+
+
+          <hr/>
+
+          <ul id="-apache-navigation">
+            <li><a href="http://www.apache.org/">Apache</a></li>
+            <li><a href="http://www.apache.org/licenses/">License</a></li>
+            <li><a href="http://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li>
+            <li><a href="http://www.apache.org/foundation/thanks.html">Thanks!</a></li>
+            <li><a href="/security.html">Security</a></li>
+            <li><a href="http://www.apache.org/"><img id="-apache-feather" width="48" height="14" src="" alt="Apache"/></a></li>
+          </ul>
+
+          <p id="-legal">
+            Apache Qpid, Messaging built on AMQP; Copyright &#169; 2015
+            The Apache Software Foundation; Licensed under
+            the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache
+            License, Version 2.0</a>; Apache Qpid, Qpid, Qpid Proton,
+            Proton, Apache, the Apache feather logo, and the Apache Qpid
+            project logo are trademarks of The Apache Software
+            Foundation; All other marks mentioned may be trademarks or
+            registered trademarks of their respective owners
+          </p>
+        </div>
+      </div>
+    </div>
+  </body>
+</html>


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


Mime
View raw message