Repository: qpid-proton
Updated Branches:
  refs/heads/cjansen-cpp-client 9f7e34620 -> 697830998


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/proton-c/bindings/cpp/src/url.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/url.hpp 
b/proton-c/bindings/cpp/src/url.hpp
new file mode 100644
index 0000000..0cc8690
--- /dev/null
+++ b/proton-c/bindings/cpp/src/url.hpp
@@ -0,0 +1,48 @@
+#ifndef PROTON_CPP_URL_H
+#define PROTON_CPP_URL_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 "proton/export.hpp"
+#include "proton/proton_handle.hpp"
+#include "proton/url.h"
+#include <string>
+
+namespace proton {
+
+class Url : public proton_handle<pn_url_t>
+{
+  public:
+    PN_CPP_EXTERN Url(const std::string &url);
+    PN_CPP_EXTERN ~Url();
+    PN_CPP_EXTERN Url(const Url&);
+    PN_CPP_EXTERN Url& operator=(const Url&);
+    PN_CPP_EXTERN std::string host();
+    PN_CPP_EXTERN std::string port();
+    PN_CPP_EXTERN std::string path();
+  private:
+    friend class proton_impl_ref<Url>;
+};
+
+
+}
+
+#endif  /*!PROTON_CPP_URL_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/proton-c/bindings/cpp/src/value.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/value.cpp 
b/proton-c/bindings/cpp/src/value.cpp
new file mode 100644
index 0000000..ff95e2e
--- /dev/null
+++ b/proton-c/bindings/cpp/src/value.cpp
@@ -0,0 +1,136 @@
+/*
+ * 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/value.hpp"
+#include "proton_bits.hpp"
+#include <proton/codec.h>
+#include <ostream>
+#include <algorithm>
+
+namespace proton {
+
+value::value() { *this = amqp_null(); }
+value::value(const value& v) { *this = v; }
+value::~value() {}
+
+value& value::operator=(const value& v) { values_ = v.values_; return *this; }
+
+type_id value::type() const {
+    const_cast<values&>(values_).rewind();
+    return values_.type();
+}
+
+namespace {
+template <class T> T check(T result) {
+    if (result < 0)
+        throw encode_error("encode: " + error_str(result));
+    return result;
+}
+}
+
+std::ostream& operator<<(std::ostream& o, const value& v) {
+    return o << v.values_;
+}
+
+namespace {
+
+// Compare nodes, return -1 if a<b, 0 if a==b, +1 if a>b
+// Forward-declare so we can use it recursively.
+int compare_next(values& a, values& b);
+
+template <class T> int compare(const T& a, const T& b) {
+    if (a < b) return -1;
+    else if (a > b) return +1;
+    else return 0;
+}
+
+int compare_container(values& a, values& b) {
+    decoder::scope sa(a), sb(b);
+    // Compare described vs. not-described.
+    int cmp = compare(sa.is_described, sb.is_described);
+    if (cmp) return cmp;
+    // Lexical sort (including descriptor if there is one)
+    size_t min_size = std::min(sa.size, sb.size) + int(sa.is_described);
+    for (size_t i = 0; i < min_size; ++i) {
+        cmp = compare_next(a, b);
+        if (cmp) return cmp;
+    }
+    return compare(sa.size, sb.size);
+}
+
+template <class T> int compare_simple(values& a, values& b) {
+    T va, vb;
+    a >> va;
+    b >> vb;
+    return compare(va, vb);
+}
+
+int compare_next(values& a, values& b) {
+    // Sort by type_id first.
+    type_id ta = a.type(), tb = b.type();
+    int cmp = compare(ta, tb);
+    if (cmp) return cmp;
+
+    switch (ta) {
+      case NULl_: return 0;
+      case ARRAY:
+      case LIST:
+      case MAP:
+      case DESCRIBED:
+        return compare_container(a, b);
+      case BOOL: return compare_simple<amqp_bool>(a, b);
+      case UBYTE: return compare_simple<amqp_ubyte>(a, b);
+      case BYTE: return compare_simple<amqp_byte>(a, b);
+      case USHORT: return compare_simple<amqp_ushort>(a, b);
+      case SHORT: return compare_simple<amqp_short>(a, b);
+      case UINT: return compare_simple<amqp_uint>(a, b);
+      case INT: return compare_simple<amqp_int>(a, b);
+      case CHAR: return compare_simple<amqp_char>(a, b);
+      case ULONG: return compare_simple<amqp_ulong>(a, b);
+      case LONG: return compare_simple<amqp_long>(a, b);
+      case TIMESTAMP: return compare_simple<amqp_timestamp>(a, b);
+      case FLOAT: return compare_simple<amqp_float>(a, b);
+      case DOUBLE: return compare_simple<amqp_double>(a, b);
+      case DECIMAL32: return compare_simple<amqp_decimal32>(a, b);
+      case DECIMAL64: return compare_simple<amqp_decimal64>(a, b);
+      case DECIMAL128: return compare_simple<amqp_decimal128>(a, b);
+      case UUID: return compare_simple<amqp_uuid>(a, b);
+      case BINARY: return compare_simple<amqp_binary>(a, b);
+      case STRING: return compare_simple<amqp_string>(a, b);
+      case SYMBOL: return compare_simple<amqp_symbol>(a, b);
+    }
+    // Invalid but equal type_id, treat as equal.
+    return 0;
+}
+
+} // namespace
+
+bool value::operator==(const value& v) const {
+    values_.rewind();
+    v.values_.rewind();
+    return compare_next(values_, v.values_) == 0;
+}
+
+bool value::operator<(const value& v) const {
+    values_.rewind();
+    v.values_.rewind();
+    return compare_next(values_, v.values_) < 0;
+}
+
+}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/proton-c/bindings/cpp/src/values.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/values.cpp 
b/proton-c/bindings/cpp/src/values.cpp
new file mode 100644
index 0000000..4c8cda1
--- /dev/null
+++ b/proton-c/bindings/cpp/src/values.cpp
@@ -0,0 +1,38 @@
+/*
+ * 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/value.hpp"
+#include "proton_bits.hpp"
+#include <proton/codec.h>
+#include <ostream>
+
+namespace proton {
+
+values::values() {}
+values::values(const values& v) { *this = v; }
+values::values(pn_data_t* d) : data(d) {}
+
+values::~values() {}
+values& values::operator=(const values& v) { data::operator=(v); return *this; 
}
+
+std::ostream& operator<<(std::ostream& o, const values& v) {
+    return o << static_cast<const encoder&>(v);
+}
+
+}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/proton-c/docs/api/index.md
----------------------------------------------------------------------
diff --git a/proton-c/docs/api/index.md b/proton-c/docs/api/index.md
index 8727d9b..ab3267a 100644
--- a/proton-c/docs/api/index.md
+++ b/proton-c/docs/api/index.md
@@ -5,5 +5,3 @@ The proton library contains two C APIs: The [Engine API](@ref 
engine),
 and the [Messenger API](@ref messenger).
 
 There is also a [C++ API](@ref cpp).
-
-@defgroup cpp C++ binding

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/69783099/proton-c/docs/api/user.doxygen.in
----------------------------------------------------------------------
diff --git a/proton-c/docs/api/user.doxygen.in 
b/proton-c/docs/api/user.doxygen.in
index 7c6edf7..951c2fb 100644
--- a/proton-c/docs/api/user.doxygen.in
+++ b/proton-c/docs/api/user.doxygen.in
@@ -162,7 +162,7 @@ STRIP_FROM_INC_PATH    =
 # (but less readable) file names. This can be useful if your file system
 # doesn't support long names like on DOS, Mac, or CD-ROM.
 
-SHORT_NAMES            = YES
+SHORT_NAMES            = NO
 
 # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
 # will interpret the first line (until the first dot) of a JavaDoc-style
@@ -660,7 +660,7 @@ INPUT_ENCODING         = UTF-8
 # *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py
 # *.f90 *.f *.for *.vhd *.vhdl
 
-FILE_PATTERNS          = *.h *.md
+FILE_PATTERNS          = *.h *.md *.hpp
 
 # The RECURSIVE tag can be used to turn specify whether or not subdirectories
 # should be searched for input files as well. Possible values are YES and NO.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to