http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/cpp/include/proton/sender_options.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/sender_options.hpp b/proton-c/bindings/cpp/include/proton/sender_options.hpp deleted file mode 100644 index 9d7bb42..0000000 --- a/proton-c/bindings/cpp/include/proton/sender_options.hpp +++ /dev/null @@ -1,101 +0,0 @@ -#ifndef PROTON_SENDER_OPTIONS_HPP -#define PROTON_SENDER_OPTIONS_HPP - -/* - * - * 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 "./fwd.hpp" -#include "./internal/export.hpp" -#include "./internal/pn_unique_ptr.hpp" -#include "./delivery_mode.hpp" - -namespace proton { - -/// Options for creating a sender. -/// -/// Options can be "chained" like this: -/// -/// @code -/// l = container.create_sender(url, sender_options().handler(h).auto_settle(false)); -/// @endcode -/// -/// You can also create an options object with common settings and use -/// it as a base for different connections that have mostly the same -/// settings: -/// -/// @code -/// sender_options opts; -/// opts.browsing(true); -/// l1 = container.open_sender(url1, opts.handler(h1)); -/// c2 = container.open_receiver(url2, opts.handler(h2)); -/// @endcode -/// -/// Normal value semantics: copy or assign creates a separate copy of -/// the options. -// XXX opts.browsing is not a good example here -class sender_options { - public: - /// Create an empty set of options. - PN_CPP_EXTERN sender_options(); - - /// Copy options. - PN_CPP_EXTERN sender_options(const sender_options&); - - PN_CPP_EXTERN ~sender_options(); - - /// Copy options. - PN_CPP_EXTERN sender_options& operator=(const sender_options&); - - /// Merge with another option set - PN_CPP_EXTERN void update(const sender_options& other); - - /// Set a messaging_handler for sender events only. - /// The handler is no longer in use when messaging_handler::on_sender_close() is called. - /// messaging_handler::on_sender_close() may not be called if a connection is aborted, - /// in that case it should be cleaned up in its connection's messaging_handler::on_transport_close() - PN_CPP_EXTERN sender_options& handler(class messaging_handler&); - - /// Set the delivery mode on the sender. - PN_CPP_EXTERN sender_options& delivery_mode(delivery_mode); - - /// Automatically settle messages (default is true). - PN_CPP_EXTERN sender_options& auto_settle(bool); - - /// Options for the source node of the sender. - PN_CPP_EXTERN sender_options& source(const source_options &); - - /// Options for the receiver node of the receiver. - PN_CPP_EXTERN sender_options& target(const target_options &); - - /// @cond INTERNAL - private: - void apply(sender&) const; - - class impl; - internal::pn_unique_ptr<impl> impl_; - - friend class sender; - /// @endcond -}; - -} // proton - -#endif // PROTON_SENDER_OPTIONS_HPP
http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/cpp/include/proton/session.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/session.hpp b/proton-c/bindings/cpp/include/proton/session.hpp deleted file mode 100644 index cbdf1b9..0000000 --- a/proton-c/bindings/cpp/include/proton/session.hpp +++ /dev/null @@ -1,121 +0,0 @@ -#ifndef PROTON_SESSION_HPP -#define PROTON_SESSION_HPP - -/* - * - * 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 "./fwd.hpp" -#include "./internal/export.hpp" -#include "./endpoint.hpp" -#include "./receiver.hpp" -#include "./sender.hpp" - -#include <string> - -struct pn_session_t; - -namespace proton { - -/// A container of senders and receivers. -class -PN_CPP_CLASS_EXTERN session : public internal::object<pn_session_t>, public endpoint { - public: - /// @cond INTERNAL - PN_CPP_EXTERN session(pn_session_t* s) : internal::object<pn_session_t>(s) {} - /// @endcond - - public: - /// Create an empty session. - session() : internal::object<pn_session_t>(0) {} - - PN_CPP_EXTERN bool uninitialized() const; - PN_CPP_EXTERN bool active() const; - PN_CPP_EXTERN bool closed() const; - - PN_CPP_EXTERN class error_condition error() const; - - /// Open the session. - /// - /// @see endpoint_lifecycle - PN_CPP_EXTERN void open(); - - /// @copydoc open - PN_CPP_EXTERN void open(const session_options &opts); - - PN_CPP_EXTERN void close(); - PN_CPP_EXTERN void close(const error_condition&); - - /// Get the container for this session. - PN_CPP_EXTERN class container &container() const; - - /// Get the connection this session belongs to. - PN_CPP_EXTERN class connection connection() const; - - /// Open a sender for `addr`. - PN_CPP_EXTERN sender open_sender(const std::string &addr); - - /// @copydoc open_sender - PN_CPP_EXTERN sender open_sender(const std::string &addr, const sender_options &opts); - - /// Open a receiver for `addr`. - PN_CPP_EXTERN receiver open_receiver(const std::string &addr); - - /// @copydoc open_receiver - PN_CPP_EXTERN receiver open_receiver(const std::string &addr, const receiver_options &opts); - - /// The number of incoming bytes currently buffered. - PN_CPP_EXTERN size_t incoming_bytes() const; - - /// The number of outgoing bytes currently buffered. - PN_CPP_EXTERN size_t outgoing_bytes() const; - - /// Return the senders on this session. - PN_CPP_EXTERN sender_range senders() const; - - /// Return the receivers on this session. - PN_CPP_EXTERN receiver_range receivers() const; - - /// @cond INTERNAL - friend class internal::factory<session>; - friend class session_iterator; - friend class thread_safe<session>; - /// @endcond -}; - -/// @cond INTERNAL - -/// An iterator of sessions. -class session_iterator : public internal::iter_base<session, session_iterator> { - public: - explicit session_iterator(session s = 0) : internal::iter_base<session, session_iterator>(s) {} - - /// Advance to the next session. - PN_CPP_EXTERN session_iterator operator++(); -}; - -/// A range of sessions. -typedef internal::iter_range<session_iterator> session_range; - -/// @endcond - -} // proton - -#endif // PROTON_SESSION_HPP http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/cpp/include/proton/session_options.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/session_options.hpp b/proton-c/bindings/cpp/include/proton/session_options.hpp deleted file mode 100644 index eb47a89..0000000 --- a/proton-c/bindings/cpp/include/proton/session_options.hpp +++ /dev/null @@ -1,68 +0,0 @@ -#ifndef PROTON_SESSION_OPTIONS_HPP -#define PROTON_SESSION_OPTIONS_HPP - -/* - * - * 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 "./fwd.hpp" -#include "./internal/export.hpp" -#include "./internal/pn_unique_ptr.hpp" - -namespace proton { - -/// Options for creating a session. -/// -/// Options can be "chained" (see proton::connection_options). -/// -/// Normal value semantics: copy or assign creates a separate copy of -/// the options. -// XXX Does this need the CLASS_EXTERN stuff? - Add just for consistency -class session_options { - public: - /// Create an empty set of options. - PN_CPP_EXTERN session_options(); - - /// Copy options. - PN_CPP_EXTERN session_options(const session_options&); - - PN_CPP_EXTERN ~session_options(); - - /// Copy options. - PN_CPP_EXTERN session_options& operator=(const session_options&); - - /// Set a messaging_handler for the session. - PN_CPP_EXTERN session_options& handler(class messaging_handler &); - - /// @cond INTERNAL - // Other useful session configuration TBD. - private: - void apply(session&) const; - - class impl; - internal::pn_unique_ptr<impl> impl_; - - friend class session; - /// @endcond -}; - -} // proton - -#endif // PROTON_SESSION_OPTIONS_HPP http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/cpp/include/proton/source.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/source.hpp b/proton-c/bindings/cpp/include/proton/source.hpp deleted file mode 100644 index 321af9a..0000000 --- a/proton-c/bindings/cpp/include/proton/source.hpp +++ /dev/null @@ -1,88 +0,0 @@ -#ifndef PROTON_SOURCE_HPP -#define PROTON_SOURCE_HPP - -/* - * - * 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 "./fwd.hpp" -#include "./internal/export.hpp" -#include "./internal/cached_map.hpp" -#include "./symbol.hpp" -#include "./terminus.hpp" -#include "./value.hpp" - -#include <string> - -struct pn_terminus_t; - -namespace proton { - -/// A point of origin for messages. -/// -/// @see proton::sender, proton::receiver, proton::target -class source : public terminus { - public: - /// **Experimental** - A map of AMQP symbol keys and filter - /// specifiers. - class filter_map : public internal::cached_map<symbol, value> {}; - - /// Create an empty source. - source() : terminus() {} - - /// The policy for distributing messages. - enum distribution_mode { - // XXX Why is unspecified needed? The protocol doesn't have - // it. - /// Unspecified - UNSPECIFIED = PN_DIST_MODE_UNSPECIFIED, - /// Once transferred, the message remains available to other links - COPY = PN_DIST_MODE_COPY, - /// Once transferred, the message is unavailable to other links - MOVE = PN_DIST_MODE_MOVE - }; - - using terminus::durability_mode; - using terminus::expiry_policy; - - /// The address of the source. - PN_CPP_EXTERN std::string address() const; - - /// Get the distribution mode. - PN_CPP_EXTERN enum distribution_mode distribution_mode() const; - - /// **Experimental** - Obtain the set of message filters. - PN_CPP_EXTERN filter_map filters() const; - - private: - source(pn_terminus_t* t); - source(const sender&); - source(const receiver&); - - /// @cond INTERNAL - friend class proton::internal::factory<source>; - friend class sender; - friend class receiver; - /// @endcond -}; - -} // proton - -#endif // PROTON_SOURCE_HPP http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/cpp/include/proton/source_options.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/source_options.hpp b/proton-c/bindings/cpp/include/proton/source_options.hpp deleted file mode 100644 index f7dde48..0000000 --- a/proton-c/bindings/cpp/include/proton/source_options.hpp +++ /dev/null @@ -1,93 +0,0 @@ -#ifndef PROTON_SOURCE_OPTIONS_HPP -#define PROTON_SOURCE_OPTIONS_HPP - -/* - * - * 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 "./internal/export.hpp" -#include "./internal/pn_unique_ptr.hpp" -#include "./duration.hpp" -#include "./source.hpp" - -#include <string> - -namespace proton { - -/// Options for creating a source node for a sender or receiver. -/// -/// Options can be "chained" (@see proton::connection_options). -/// -/// Normal value semantics: copy or assign creates a separate copy of -/// the options. -class source_options { - public: - - /// Create an empty set of options. - PN_CPP_EXTERN source_options(); - - /// Copy options. - PN_CPP_EXTERN source_options(const source_options&); - - PN_CPP_EXTERN ~source_options(); - - /// Copy options. - PN_CPP_EXTERN source_options& operator=(const source_options&); - - /// Set the address for the source. Ignored if dynamic is true. - PN_CPP_EXTERN source_options& address(const std::string&); - - /// Request a dynamically created node to be created by the remote peer. - /// Any specified source address is ignored. - PN_CPP_EXTERN source_options& dynamic(bool); - - /// Control whether messsages are browsed or consumed. - PN_CPP_EXTERN source_options& distribution_mode(enum source::distribution_mode); - - /// Control the persistence of source state. - PN_CPP_EXTERN source_options& durability_mode(enum source::durability_mode); - - /// The expiry period after which the source is discarded. - PN_CPP_EXTERN source_options& timeout(duration); - - /// Control when the clock for expiration begins. - PN_CPP_EXTERN source_options& expiry_policy(enum source::expiry_policy); - - /// **Experimental** - Specify a filter mechanism on the source - /// that restricts message flow to a subset of the available - /// messages. - PN_CPP_EXTERN source_options& filters(const source::filter_map&); - - private: - void apply(source&) const; - - class impl; - internal::pn_unique_ptr<impl> impl_; - - /// @cond INTERNAL - friend class source; - friend class sender_options; - friend class receiver_options; - /// @endcond -}; - -} // proton - -#endif // PROTON_SOURCE_OPTIONS_HPP http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/cpp/include/proton/ssl.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/ssl.hpp b/proton-c/bindings/cpp/include/proton/ssl.hpp deleted file mode 100644 index c6c4c93..0000000 --- a/proton-c/bindings/cpp/include/proton/ssl.hpp +++ /dev/null @@ -1,198 +0,0 @@ -#ifndef PROTON_SSL_HPP -#define PROTON_SSL_HPP - -/* - * - * 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 "./internal/export.hpp" - -#include <proton/ssl.h> - -#include <string> - -namespace proton { - -namespace internal { -template <class T> class factory; -} - -/// SSL information. -class ssl { - /// @cond INTERNAL - ssl(pn_ssl_t* s) : object_(s) {} - /// @endcond - - public: - /// Create an empty ssl object. - ssl() : object_(0) {} - - /// Determines the level of peer validation. - enum verify_mode { - /// Require peer to provide a valid identifying certificate - VERIFY_PEER = PN_SSL_VERIFY_PEER, - /// Do not require a certificate or cipher authorization - ANONYMOUS_PEER = PN_SSL_ANONYMOUS_PEER, - /// Require valid certificate and matching name - VERIFY_PEER_NAME = PN_SSL_VERIFY_PEER_NAME - }; - - /// Outcome specifier for an attempted session resume. - enum resume_status { - UNKNOWN = PN_SSL_RESUME_UNKNOWN, ///< Session resume state unknown or not supported - NEW = PN_SSL_RESUME_NEW, ///< Session renegotiated, not resumed - REUSED = PN_SSL_RESUME_REUSED ///< Session resumed from previous session - }; - - /// @cond INTERNAL - - /// XXX C API uses cipher_name - /// Get the cipher name. - PN_CPP_EXTERN std::string cipher() const; - - /// XXX C API uses protocol_name - /// Get the protocol name. - PN_CPP_EXTERN std::string protocol() const; - - /// Get the security strength factor. - PN_CPP_EXTERN int ssf() const; - - /// XXX discuss, what's the meaning of "remote" here? - PN_CPP_EXTERN std::string remote_subject() const; - - /// XXX setters? versus connection options - PN_CPP_EXTERN void resume_session_id(const std::string& session_id); - - PN_CPP_EXTERN enum resume_status resume_status() const; - - /// @endcond - - private: - pn_ssl_t* object_; - - /// @cond INTERNAL - friend class internal::factory<ssl>; - /// @endcond -}; - -/// **Experimental** - An SSL certificate. -class ssl_certificate { - public: - /// Create an SSL certificate. - PN_CPP_EXTERN ssl_certificate(const std::string &certdb_main); - - // XXX Document the following constructors - - /// @copydoc ssl_certificate - PN_CPP_EXTERN ssl_certificate(const std::string &certdb_main, const std::string &certdb_extra); - - /// @copydoc ssl_certificate - PN_CPP_EXTERN ssl_certificate(const std::string &certdb_main, const std::string &certdb_extra, const std::string &passwd); - /// @endcond - - private: - std::string certdb_main_; - std::string certdb_extra_; - std::string passwd_; - bool pw_set_; - - /// @cond INTERNAL - friend class ssl_client_options; - friend class ssl_server_options; - /// @endcond -}; - -class ssl_domain_impl; - -namespace internal { - -// Base class for SSL configuration -class ssl_domain { - public: - PN_CPP_EXTERN ssl_domain(const ssl_domain&); - PN_CPP_EXTERN ssl_domain& operator=(const ssl_domain&); - PN_CPP_EXTERN ~ssl_domain(); - - protected: - ssl_domain(bool is_server); - pn_ssl_domain_t *pn_domain(); - - private: - ssl_domain_impl *impl_; - bool server_type_; -}; - -} - -/// **Experimental** - SSL configuration for inbound connections. -class ssl_server_options : private internal::ssl_domain { - public: - /// Server SSL options based on the supplied X.509 certificate - /// specifier. - PN_CPP_EXTERN ssl_server_options(ssl_certificate &cert); - - /// Server SSL options requiring connecting clients to provide a - /// client certificate. - PN_CPP_EXTERN ssl_server_options(ssl_certificate &cert, const std::string &trust_db, - const std::string &advertise_db = std::string(), - enum ssl::verify_mode mode = ssl::VERIFY_PEER); - - /// Server SSL options restricted to available anonymous cipher - /// suites on the platform. - PN_CPP_EXTERN ssl_server_options(); - - private: - // Bring pn_domain into scope and allow connection_options to use - // it. - using internal::ssl_domain::pn_domain; - - /// @cond INTERNAL - friend class connection_options; - /// @endcond -}; - -/// **Experimental** - SSL configuration for outbound connections. -class ssl_client_options : private internal::ssl_domain { - public: - /// Create SSL client options (no client certificate). - PN_CPP_EXTERN ssl_client_options(const std::string &trust_db, - enum ssl::verify_mode = ssl::VERIFY_PEER_NAME); - - /// Create SSL client options with a client certificate. - PN_CPP_EXTERN ssl_client_options(ssl_certificate&, const std::string &trust_db, - enum ssl::verify_mode = ssl::VERIFY_PEER_NAME); - - /// SSL connections restricted to available anonymous cipher - /// suites on the platform. - PN_CPP_EXTERN ssl_client_options(); - - private: - // Bring pn_domain into scope and allow connection_options to use - // it. - using internal::ssl_domain::pn_domain; - - /// @cond INTERNAL - friend class connection_options; - /// @endcond -}; - -} // proton - -#endif // PROTON_SSL_HPP http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/cpp/include/proton/symbol.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/symbol.hpp b/proton-c/bindings/cpp/include/proton/symbol.hpp deleted file mode 100644 index 303f350..0000000 --- a/proton-c/bindings/cpp/include/proton/symbol.hpp +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef PROTON_SYMBOL_HPP -#define PROTON_SYMBOL_HPP - -/* - * - * 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 <string> - -namespace proton { - -/// A std::string that represents the AMQP symbol type. -/// -/// A symbol can only contain 7-bit ASCII characters. -class symbol : public std::string { - public: - /// Construct from a std::string. - symbol(const std::string& s=std::string()) : std::string(s) {} - - /// Construct from a C string. - symbol(const char* s) : std::string(s) {} - - /// Construct from any sequence of char. - template<class Iter> symbol(Iter start, Iter finish) : std::string(start, finish) {} -}; - -} // proton - -#endif // PROTON_SYMBOL_HPP http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/cpp/include/proton/target.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/target.hpp b/proton-c/bindings/cpp/include/proton/target.hpp deleted file mode 100644 index 746133a..0000000 --- a/proton-c/bindings/cpp/include/proton/target.hpp +++ /dev/null @@ -1,67 +0,0 @@ -#ifndef PROTON_TARGET_HPP -#define PROTON_TARGET_HPP - -/* - * - * 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 "./fwd.hpp" -#include "./internal/export.hpp" -#include "./terminus.hpp" - -#include <string> - -struct pn_terminus_t; - -namespace proton { - -namespace internal { -template <class T> class factory; -} - -/// A destination for messages. -/// -/// @see proton::sender, proton::receiver, proton::target -class target : public terminus { - public: - /// Create an empty target. - target() : terminus() {} - - using terminus::durability_mode; - using terminus::expiry_policy; - - /// The address of the target. - PN_CPP_EXTERN std::string address() const; - - private: - target(pn_terminus_t* t); - target(const sender&); - target(const receiver&); - - /// @cond INTERNAL - friend class internal::factory<target>; - friend class sender; - friend class receiver; - /// @endcond -}; - -} // proton - -#endif // PROTON_TARGET_HPP http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/cpp/include/proton/target_options.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/target_options.hpp b/proton-c/bindings/cpp/include/proton/target_options.hpp deleted file mode 100644 index 547dbbe..0000000 --- a/proton-c/bindings/cpp/include/proton/target_options.hpp +++ /dev/null @@ -1,84 +0,0 @@ -#ifndef PROTON_TARGET_OPTIONS_HPP -#define PROTON_TARGET_OPTIONS_HPP - -/* - * - * 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 "./internal/export.hpp" -#include "./internal/pn_unique_ptr.hpp" -#include "./duration.hpp" -#include "./target.hpp" - -#include <string> - -namespace proton { - -/// Options for creating a target node for a sender or receiver. -/// -/// Options can be "chained" (see proton::connection_options). -/// -/// Normal value semantics: copy or assign creates a separate copy of -/// the options. -class target_options { - public: - /// Create an empty set of options. - PN_CPP_EXTERN target_options(); - - /// Copy options. - PN_CPP_EXTERN target_options(const target_options&); - - PN_CPP_EXTERN ~target_options(); - - /// Copy options. - PN_CPP_EXTERN target_options& operator=(const target_options&); - - /// Set the address for the target. Ignored if dynamic is true. - PN_CPP_EXTERN target_options& address(const std::string& addr); - - /// Request a dynamically created node to be created by the peer. - /// Any specified target address is ignored. - PN_CPP_EXTERN target_options& dynamic(bool); - - /// Control the persistence of target state. - PN_CPP_EXTERN target_options& durability_mode(enum target::durability_mode); - - /// The expiry period after which the target is discarded. - PN_CPP_EXTERN target_options& timeout(duration); - - /// Control when the clock for expiration begins. - PN_CPP_EXTERN target_options& expiry_policy(enum target::expiry_policy); - - private: - void apply(target&) const; - - class impl; - internal::pn_unique_ptr<impl> impl_; - - /// @cond INTERNAL - friend class target; - friend class sender_options; - friend class receiver_options; - /// @endcond -}; - -} // proton - -#endif // PROTON_TARGET_OPTIONS_HPP http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/cpp/include/proton/terminus.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/terminus.hpp b/proton-c/bindings/cpp/include/proton/terminus.hpp deleted file mode 100644 index b63a8ad..0000000 --- a/proton-c/bindings/cpp/include/proton/terminus.hpp +++ /dev/null @@ -1,111 +0,0 @@ -#ifndef PROTON_TERMINUS_HPP -#define PROTON_TERMINUS_HPP - -/* - * - * 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 "./types_fwd.hpp" -#include "./internal/export.hpp" - -#include <proton/terminus.h> - -#include <string> - -struct pn_link_t; -struct pn_terminus_t; - -namespace proton { - -namespace internal { -template <class T> class factory; -} - -/// One end of a link, either a source or a target. -/// -/// The source terminus is where messages originate; the target -/// terminus is where they go. -/// -/// @see proton::link -class terminus { - /// @cond INTERNAL - terminus(pn_terminus_t* t); - /// @endcond - - public: - terminus() : object_(0), parent_(0) {} - - /// The persistence mode of the source or target. - enum durability_mode { - /// No persistence. - NONDURABLE = PN_NONDURABLE, - /// Only configuration is persisted. - CONFIGURATION = PN_CONFIGURATION, - /// Configuration and unsettled state are persisted. - UNSETTLED_STATE = PN_DELIVERIES - }; - - /// When expiration of the source or target begins. - enum expiry_policy { - /// When the link is closed. - LINK_CLOSE = PN_EXPIRE_WITH_LINK, - /// When the containing session is closed. - SESSION_CLOSE = PN_EXPIRE_WITH_SESSION, - /// When the containing connection is closed. - CONNECTION_CLOSE = PN_EXPIRE_WITH_CONNECTION, - /// The terminus never expires. - NEVER = PN_EXPIRE_NEVER - }; - - // XXX This should have address? - - /// Get the policy for when expiration begins. - PN_CPP_EXTERN enum expiry_policy expiry_policy() const; - - /// The period after which the source is discarded on expiry. The - /// duration is rounded to the nearest second. - PN_CPP_EXTERN duration timeout() const; - - /// Get the durability flag. - PN_CPP_EXTERN enum durability_mode durability_mode(); - - /// True if the remote node is created dynamically. - PN_CPP_EXTERN bool dynamic() const; - - /// Obtain a reference to the AMQP dynamic node properties for the - /// terminus. See also lifetime_policy. - PN_CPP_EXTERN value node_properties() const; - - protected: - pn_terminus_t *pn_object() { return object_; } - private: - pn_terminus_t* object_; - pn_link_t* parent_; - - /// @cond INTERNAL - friend class internal::factory<terminus>; - friend class source; - friend class target; - /// @endcond -}; - -} // proton - -#endif // PROTON_TERMINUS_HPP http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/cpp/include/proton/thread_safe.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/thread_safe.hpp b/proton-c/bindings/cpp/include/proton/thread_safe.hpp deleted file mode 100644 index 608a1ca..0000000 --- a/proton-c/bindings/cpp/include/proton/thread_safe.hpp +++ /dev/null @@ -1,178 +0,0 @@ -#ifndef PROTON_THREAD_SAFE_HPP -#define PROTON_THREAD_SAFE_HPP - -/* - * - * 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 "./fwd.hpp" -#include "./internal/config.hpp" -#include "./connection.hpp" -#include "./event_loop.hpp" -#include "./function.hpp" -#include "./internal/object.hpp" -#include "./internal/type_traits.hpp" - -#include <functional> - -namespace proton { - -namespace internal { -template <class T> struct endpoint_traits; -template<> struct endpoint_traits<connection> {}; -template<> struct endpoint_traits<session> {}; -template<> struct endpoint_traits<link> {}; -template<> struct endpoint_traits<sender> {}; -template<> struct endpoint_traits<receiver> {}; -} - -/// **Experimental** - A thread-safe object wrapper. -/// -/// The proton::object subclasses (proton::connection, proton::sender etc.) are -/// reference-counted wrappers for C structs. They are not safe for concurrent use, -/// not even to copy or assign. -/// -/// A pointer to thread_safe<> can be used from any thread to get the -/// proton::event_loop for the object's connection. The object will not be -/// destroyed until the thread_safe<> is deleted. You can use std::shared_ptr, -/// std::unique_ptr or any other memory management technique to manage the -/// thread_safe<>. -/// -/// Use make_thread_safe(), make_shared_thread_safe(), make_unique_thread_safe() to -/// create a thread_safe<> -/// -/// @see @ref mt_page -template <class T> -class thread_safe : private internal::pn_ptr_base, private internal::endpoint_traits<T> { - typedef typename T::pn_type pn_type; - - struct inject_decref : public void_function0 { - pn_type* ptr_; - inject_decref(pn_type* p) : ptr_(p) {} - void operator()() PN_CPP_OVERRIDE { decref(ptr_); delete this; } - }; - - public: - /// @cond INTERNAL - static void operator delete(void*) {} - /// @endcond - - ~thread_safe() { - if (ptr()) { - if (!!event_loop()) { -#if PN_CPP_HAS_STD_BIND - event_loop().inject(std::bind(&decref, ptr())); -#else - event_loop().inject(*new inject_decref(ptr())); -#endif - } else { - decref(ptr()); - } - } - } - - /// Get the event loop for this object. - class event_loop& event_loop() { return event_loop::get(ptr()); } - - /// Get the thread-unsafe proton object wrapped by this thread_safe<T> - T unsafe() { return T(ptr()); } - - private: - static thread_safe* create(const T& obj) { return new (obj.pn_object()) thread_safe(); } - static void* operator new(size_t, pn_type* p) { return p; } - static void operator delete(void*, pn_type*) {} - thread_safe() { incref(ptr()); } - pn_type* ptr() { return reinterpret_cast<pn_type*>(this); } - - - // Non-copyable. - thread_safe(const thread_safe&); - thread_safe& operator=(const thread_safe&); - - /// @cond INTERNAL - friend class returned<T>; - /// @endcond -}; - -// A return value for functions returning a thread_safe<> object. -// -// Temporary return value only, you should release() to get a plain pointer or -// assign to a smart pointer type. -template <class T> -class returned : private internal::endpoint_traits<T> -{ - public: - /// Take ownership - explicit returned(thread_safe<T>* p) : ptr_(p) {} - /// Create an owned thread_safe<T> - explicit returned(const T& obj) : ptr_(thread_safe<T>::create(obj)) {} - /// Transfer ownership. - /// Use the same "cheat" as std::auto_ptr, calls x.release() even though x is const. - returned(const returned& x) : ptr_(const_cast<returned&>(x).release()) {} - /// Delete if still owned. - ~returned() { if (ptr_) delete ptr_; } - - /// Release ownership. - thread_safe<T>* release() const { thread_safe<T>* p = ptr_; ptr_ = 0; return p; } - - /// Get the raw pointer, caller must not delete. - thread_safe<T>* get() const { return ptr_; } - - /// Implicit conversion to target, usable only in a safe context. - operator T() { return ptr_->unsafe(); } - -#if PN_CPP_HAS_SHARED_PTR - /// Release to a std::shared_ptr - operator std::shared_ptr<thread_safe<T> >() { - return std::shared_ptr<thread_safe<T> >(release()); - } -#endif -#if PN_CPP_HAS_UNIQUE_PTR - /// Release to a std::unique_ptr - operator std::unique_ptr<thread_safe<T> >() { - return std::unique_ptr<thread_safe<T> >(release()); - } -#endif - - private: - void operator=(const returned&); - mutable thread_safe<T>* ptr_; -}; - -/// Make a thread-safe wrapper for `obj`. -template <class T> returned<T> make_thread_safe(const T& obj) { return returned<T>(obj); } - -#if PN_CPP_HAS_SHARED_PTR -/// Create a thread-safe shared_ptr to `obj`. -template <class T> std::shared_ptr<thread_safe<T> > make_shared_thread_safe(const T& obj) { - return make_thread_safe(obj); -} -#endif -#if PN_CPP_HAS_UNIQUE_PTR -/// Create a thread-safe unique_ptr to `obj`. -template <class T> std::unique_ptr<thread_safe<T> > make_unique_thread_safe(const T& obj) { - return make_thread_safe(obj); -} - -#endif - -} // proton - -#endif // PROTON_THREAD_SAFE_HPP http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/cpp/include/proton/timestamp.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/timestamp.hpp b/proton-c/bindings/cpp/include/proton/timestamp.hpp deleted file mode 100644 index 6e4281b..0000000 --- a/proton-c/bindings/cpp/include/proton/timestamp.hpp +++ /dev/null @@ -1,68 +0,0 @@ -#ifndef PROTON_TIMESTAMP_HPP -#define PROTON_TIMESTAMP_HPP - -/* - * 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 "./duration.hpp" - -#include <proton/type_compat.h> - -namespace proton { - -/// A 64-bit timestamp in milliseconds since the Unix epoch. -/// -/// The dawn of the Unix epoch was 00:00:00 (UTC), 1 January 1970. -class timestamp : private internal::comparable<timestamp> { - public: - /// A numeric type holding a milliseconds value. - typedef int64_t numeric_type; - - /// The current wall-clock time. - PN_CPP_EXTERN static timestamp now(); - - /// Construct from milliseconds. - explicit timestamp(numeric_type ms = 0) : ms_(ms) {} - - /// Assign from milliseconds. - timestamp& operator=(numeric_type ms) { ms_ = ms; return *this; } - - /// Get milliseconds. - numeric_type milliseconds() const { return ms_; } - - private: - numeric_type ms_; -}; - -/// @name Comparison and arithmetic operators -/// @{ -inline bool operator==(timestamp x, timestamp y) { return x.milliseconds() == y.milliseconds(); } -inline bool operator<(timestamp x, timestamp y) { return x.milliseconds() < y.milliseconds(); } - -inline timestamp operator+(timestamp ts, duration d) { return timestamp(ts.milliseconds() + d.milliseconds()); } -inline duration operator-(timestamp t0, timestamp t1) { return duration(t0.milliseconds() - t1.milliseconds()); } -inline timestamp operator+(duration d, timestamp ts) { return ts + d; } -/// @} - -/// Printable format. -PN_CPP_EXTERN std::ostream& operator<<(std::ostream&, timestamp); - -} // proton - -#endif // PROTON_TIMESTAMP_HPP http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/cpp/include/proton/tracker.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/tracker.hpp b/proton-c/bindings/cpp/include/proton/tracker.hpp deleted file mode 100644 index 408b04d..0000000 --- a/proton-c/bindings/cpp/include/proton/tracker.hpp +++ /dev/null @@ -1,56 +0,0 @@ -#ifndef PROTON_TRACKER_HPP -#define PROTON_TRACKER_HPP - -/* - * - * 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 "./internal/export.hpp" -#include "./transfer.hpp" - -struct pn_delivery_t; - -namespace proton { - -/// A tracker for a sent message. Every tracker exists within the -/// context of a sender. -/// -/// A delivery attempt can fail. As a result, a particular message may -/// correspond to multiple trackers. -class tracker : public transfer { - /// @cond INTERNAL - tracker(pn_delivery_t* d); - /// @endcond - - public: - /// Create an empty tracker. - tracker() {} - - /// Get the sender for this tracker. - PN_CPP_EXTERN class sender sender() const; - - // @cond INTERNAL - friend class internal::factory<tracker>; - // @endcond -}; - -} // proton - -#endif // PROTON_TRACKER_HPP http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/cpp/include/proton/transfer.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/transfer.hpp b/proton-c/bindings/cpp/include/proton/transfer.hpp deleted file mode 100644 index ea073f6..0000000 --- a/proton-c/bindings/cpp/include/proton/transfer.hpp +++ /dev/null @@ -1,80 +0,0 @@ -#ifndef PROTON_TRANSFER_HPP -#define PROTON_TRANSFER_HPP - -/* - * - * 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 "./fwd.hpp" -#include "./internal/export.hpp" -#include "./internal/object.hpp" - -#include <proton/disposition.h> - -struct pn_delivery_t; - -namespace proton { - -/// The base class for delivery and tracker. -class transfer : public internal::object<pn_delivery_t> { - /// @cond INTERNAL - transfer(pn_delivery_t* d) : internal::object<pn_delivery_t>(d) {} - /// @endcond - - public: - /// Create an empty transfer. - transfer() : internal::object<pn_delivery_t>(0) {} - - /// Delivery state values. - enum state { - NONE = 0, ///< Unknown state - RECEIVED = PN_RECEIVED, ///< Received but not yet settled - ACCEPTED = PN_ACCEPTED, ///< Settled as accepted - REJECTED = PN_REJECTED, ///< Settled as rejected - RELEASED = PN_RELEASED, ///< Settled as released - MODIFIED = PN_MODIFIED ///< Settled as modified - }; // AMQP spec 3.4 delivery State - - /// Get the remote state for a delivery. - PN_CPP_EXTERN enum state state() const; - - /// Return the session for this transfer. - PN_CPP_EXTERN class session session() const; - - /// Return the connection for this transfer. - PN_CPP_EXTERN class connection connection() const; - - /// Return the container for this transfer. - PN_CPP_EXTERN class container &container() const; - - /// Settle the delivery; informs the remote end. - PN_CPP_EXTERN void settle(); - - /// Return true if the transfer has been settled. - PN_CPP_EXTERN bool settled() const; - - /// @cond INTERNAL - friend class internal::factory<transfer>; - /// @endcond -}; - -} // proton - -#endif // PROTON_TRANSFER_HPP http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/cpp/include/proton/transport.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/transport.hpp b/proton-c/bindings/cpp/include/proton/transport.hpp deleted file mode 100644 index 614eff2..0000000 --- a/proton-c/bindings/cpp/include/proton/transport.hpp +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef PROTON_TRANSPORT_HPP -#define PROTON_TRANSPORT_HPP - -/* - * - * 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 "./fwd.hpp" -#include "./internal/export.hpp" -#include "./internal/object.hpp" - -struct pn_transport_t; - -namespace proton { - -/// A network channel supporting an AMQP connection. -class transport : public internal::object<pn_transport_t> { - /// @cond INTERNAL - transport(pn_transport_t* t) : internal::object<pn_transport_t>(t) {} - /// @endcond - - public: - /// Create an empty transport. - transport() : internal::object<pn_transport_t>(0) {} - - /// Get the connection associated with this transport. - PN_CPP_EXTERN class connection connection() const; - - /// Get SSL information. - PN_CPP_EXTERN class ssl ssl() const; - - /// Get SASL information. - PN_CPP_EXTERN class sasl sasl() const; - - /// Get the error condition. - PN_CPP_EXTERN class error_condition error() const; - - /// @cond INTERNAL - friend class internal::factory<transport>; - /// @endcond -}; - -} // proton - -#endif // PROTON_TRANSPORT_HPP http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/cpp/include/proton/type_id.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/type_id.hpp b/proton-c/bindings/cpp/include/proton/type_id.hpp deleted file mode 100644 index 4460eb6..0000000 --- a/proton-c/bindings/cpp/include/proton/type_id.hpp +++ /dev/null @@ -1,92 +0,0 @@ -#ifndef PROTON_TYPE_ID_HPP -#define PROTON_TYPE_ID_HPP - -/* - * - * 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. - * - */ - -/// @file -/// -/// Type-identifiers for AMQP types. - -#include "./internal/export.hpp" - -#include <proton/codec.h> - -#include <string> - -namespace proton { - -/// An identifier for AMQP types. -enum type_id { - NULL_TYPE = PN_NULL, ///< The null type, contains no data. - BOOLEAN = PN_BOOL, ///< Boolean true or false. - UBYTE = PN_UBYTE, ///< Unsigned 8-bit integer. - BYTE = PN_BYTE, ///< Signed 8-bit integer. - USHORT = PN_USHORT, ///< Unsigned 16-bit integer. - SHORT = PN_SHORT, ///< Signed 16-bit integer. - UINT = PN_UINT, ///< Unsigned 32-bit integer. - INT = PN_INT, ///< Signed 32-bit integer. - CHAR = PN_CHAR, ///< 32-bit unicode character. - ULONG = PN_ULONG, ///< Unsigned 64-bit integer. - LONG = PN_LONG, ///< Signed 64-bit integer. - TIMESTAMP = PN_TIMESTAMP, ///< Signed 64-bit milliseconds since the epoch. - FLOAT = PN_FLOAT, ///< 32-bit binary floating point. - DOUBLE = PN_DOUBLE, ///< 64-bit binary floating point. - DECIMAL32 = PN_DECIMAL32, ///< 32-bit decimal floating point. - DECIMAL64 = PN_DECIMAL64, ///< 64-bit decimal floating point. - DECIMAL128 = PN_DECIMAL128, ///< 128-bit decimal floating point. - UUID = PN_UUID, ///< 16-byte UUID. - BINARY = PN_BINARY, ///< Variable-length sequence of bytes. - STRING = PN_STRING, ///< Variable-length utf8-encoded string. - SYMBOL = PN_SYMBOL, ///< Variable-length encoded string. - DESCRIBED = PN_DESCRIBED, ///< A descriptor and a value. - ARRAY = PN_ARRAY, ///< A sequence of values of the same type. - LIST = PN_LIST, ///< A sequence of values of mixed types. - MAP = PN_MAP ///< A sequence of key-value pairs. -}; - -/// Get the name of the AMQP type. -PN_CPP_EXTERN std::string type_name(type_id); - -/// Print the type name. -PN_CPP_EXTERN std::ostream& operator<<(std::ostream&, type_id); - -/// Throw a conversion_error if want != got with a message including -/// the names of the types. -PN_CPP_EXTERN void assert_type_equal(type_id want, type_id got); - -/// @name Test the properties of a type_id. -/// @{ -inline bool type_id_is_signed_int(type_id t) { return t == BYTE || t == SHORT || t == INT || t == LONG; } -inline bool type_id_is_unsigned_int(type_id t) { return t == UBYTE || t == USHORT || t == UINT || t == ULONG; } -inline bool type_id_is_integral(type_id t) { return t == BOOLEAN || t == CHAR || t == TIMESTAMP || type_id_is_unsigned_int(t) || type_id_is_signed_int(t); } -inline bool type_id_is_floating_point(type_id t) { return t == FLOAT || t == DOUBLE; } -inline bool type_id_is_decimal(type_id t) { return t == DECIMAL32 || t == DECIMAL64 || t == DECIMAL128; } -inline bool type_id_is_signed(type_id t) { return type_id_is_signed_int(t) || type_id_is_floating_point(t) || type_id_is_decimal(t); } -inline bool type_id_is_string_like(type_id t) { return t == BINARY || t == STRING || t == SYMBOL; } -inline bool type_id_is_container(type_id t) { return t == LIST || t == MAP || t == ARRAY || t == DESCRIBED; } -inline bool type_id_is_scalar(type_id t) { return type_id_is_integral(t) || type_id_is_floating_point(t) || type_id_is_decimal(t) || type_id_is_string_like(t) || t == TIMESTAMP || t == UUID; } -inline bool type_id_is_null(type_id t) { return t == NULL_TYPE; } -/// } - -} // proton - -#endif // PROTON_TYPE_ID_HPP http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/cpp/include/proton/types.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/types.hpp b/proton-c/bindings/cpp/include/proton/types.hpp deleted file mode 100644 index d21cb8f..0000000 --- a/proton-c/bindings/cpp/include/proton/types.hpp +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef PROTON_TYPES_HPP -#define PROTON_TYPES_HPP - -/* - * - * 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. - * - */ - -/// @file -/// -/// Include the definitions of all proton types used to represent AMQP -/// types. - -// TODO aconway 2016-03-15: described types, described arrays. - -#include "./internal/config.hpp" - -#include "./annotation_key.hpp" -#include "./binary.hpp" -#include "./codec/deque.hpp" -#include "./codec/list.hpp" -#include "./codec/map.hpp" -#include "./codec/vector.hpp" -#include "./decimal.hpp" -#include "./duration.hpp" -#include "./message_id.hpp" -#include "./scalar.hpp" -#include "./symbol.hpp" -#include "./timestamp.hpp" -#include "./types_fwd.hpp" -#include "./uuid.hpp" -#include "./value.hpp" - -#if PN_CPP_HAS_CPP11 -#include "./codec/forward_list.hpp" -#include "./codec/unordered_map.hpp" -#endif - -#endif // PROTON_TYPES_HPP http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/cpp/include/proton/types_fwd.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/types_fwd.hpp b/proton-c/bindings/cpp/include/proton/types_fwd.hpp deleted file mode 100644 index ff53b0c..0000000 --- a/proton-c/bindings/cpp/include/proton/types_fwd.hpp +++ /dev/null @@ -1,58 +0,0 @@ -#ifndef PROTON_TYPES_FWD_HPP -#define PROTON_TYPES_FWD_HPP - -/* - * - * 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. - * - */ - -/// @file -/// -/// Forward declarations for all the C++ types used by Proton to -/// represent AMQP types. - -#include "./internal/config.hpp" - -#if PN_CPP_HAS_NULLPTR -#include <cstddef> -#endif - -namespace proton { - -class binary; -class decimal128; -class decimal32; -class decimal64; -class scalar; -class symbol; -class timestamp; -class duration; -class uuid; -class value; - -struct null { - null() {} -#if PN_CPP_HAS_NULLPTR - null(std::nullptr_t) {} -#endif -}; - -} // proton - -#endif // PROTON_TYPES_FWD_HPP http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/cpp/include/proton/url.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/url.hpp b/proton-c/bindings/cpp/include/proton/url.hpp deleted file mode 100644 index b94b24d..0000000 --- a/proton-c/bindings/cpp/include/proton/url.hpp +++ /dev/null @@ -1,147 +0,0 @@ -#ifndef PROTON_URL_HPP -#define PROTON_URL_HPP - -/* - * - * 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 "./internal/pn_unique_ptr.hpp" -#include "./error.hpp" - -#include <proton/type_compat.h> - -#include <iosfwd> -#include <string> - -namespace proton { - -/// An error encountered during URL parsing. -struct -PN_CPP_CLASS_EXTERN url_error : public error { - /// @cond INTERNAL - /// Construct a URL error with a message. - PN_CPP_EXTERN explicit url_error(const std::string&); - /// @endcond -}; - -/// A URL parser. -/// -/// Proton URLs take the form -/// `<scheme>://<username>:<password>@<host>:<port>/<path>`. -/// -/// - Scheme can be `amqp` or `amqps`. Host is a DNS name or IP -/// address (v4 or v6). -/// -/// - Port can be a number or a symbolic service name such as `amqp`. -/// -/// - Path is normally used as a link source or target address. On a -/// broker it typically corresponds to a queue or topic name. -class url { - public: - static const std::string AMQP; ///< "amqp" prefix - static const std::string AMQPS; ///< "amqps" prefix - - // XXX No constructor for an empty URL? - // XXX What is the default 'defaults' behavior? - - /// Parse `url_str` as an AMQP URL. - /// - /// @note Converts automatically from string. - /// @throw url_error if URL is invalid. - PN_CPP_EXTERN url(const std::string& url_str); - - /// @cond INTERNAL - /// XXX I want to understand why this is important to keep. - /// - /// **Experimental** - Parse `url_str` as an AMQP URL. If - /// `defaults` is true, fill in defaults for missing values. - /// Otherwise, return an empty string for missing values. - /// - /// @note Converts automatically from string. - /// @throw url_error if URL is invalid. - PN_CPP_EXTERN url(const std::string& url_str, bool defaults); - /// @endcond - - /// Copy a URL. - PN_CPP_EXTERN url(const url&); - - PN_CPP_EXTERN ~url(); - - /// Copy a URL. - PN_CPP_EXTERN url& operator=(const url&); - - /// True if the URL is empty. - PN_CPP_EXTERN bool empty() const; - - /// Returns the URL as a string - PN_CPP_EXTERN operator std::string() const; - - /// @name URL fields - /// - /// @{ - - /// `amqp` or `amqps`. - PN_CPP_EXTERN std::string scheme() const; - /// The user name for authentication. - PN_CPP_EXTERN std::string user() const; - // XXX Passwords in URLs are dumb. - /// The password. - PN_CPP_EXTERN std::string password() const; - /// The host name or IP address. - PN_CPP_EXTERN std::string host() const; - /// `port` can be a number or a symbolic name such as "amqp". - PN_CPP_EXTERN std::string port() const; - /// `port_int` is the numeric value of the port. - PN_CPP_EXTERN uint16_t port_int() const; - /// host_port returns just the `host:port` part of the URL - PN_CPP_EXTERN std::string host_port() const; - - // XXX is this not confusing (or incorrect)? The path starts with - // the first / after //. - /// `path` is everything after the final "/". - PN_CPP_EXTERN std::string path() const; - - /// @} - - /// Return URL as a string. - friend PN_CPP_EXTERN std::string to_string(const url&); - - private: - struct impl; - internal::pn_unique_ptr<impl> impl_; - - /// @cond INTERNAL - - friend PN_CPP_EXTERN std::ostream& operator<<(std::ostream&, const url&); - - // XXX Why is it important to have this? - /// Parse `url` from istream. This automatically fills in - /// defaults for missing values. - /// - /// @note An invalid url is indicated by setting - /// std::stream::fail(), NOT by throwing url_error. - friend PN_CPP_EXTERN std::istream& operator>>(std::istream&, url&); - - /// @endcond -}; - -} // proton - -#endif // PROTON_URL_HPP http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/cpp/include/proton/uuid.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/uuid.hpp b/proton-c/bindings/cpp/include/proton/uuid.hpp deleted file mode 100644 index a60c944..0000000 --- a/proton-c/bindings/cpp/include/proton/uuid.hpp +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef PROTON_UUID_HPP -#define PROTON_UUID_HPP - -/* - * - * 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 "./internal/export.hpp" -#include "./byte_array.hpp" - -#include <string> -#include <iosfwd> - -namespace proton { - -/// A 16-byte universally unique identifier. -class uuid : public byte_array<16> { - public: - /// Make a copy. - PN_CPP_EXTERN static uuid copy(); - - /// Return a uuid copied from bytes. Bytes must point to at least - /// 16 bytes. If `bytes == 0` the UUID is zero-initialized. - PN_CPP_EXTERN static uuid copy(const char* bytes); - - /// Return a simple randomly-generated UUID. This is used by the - /// Proton library to generate default UUIDs. - /// - /// For specific security, performance, or uniqueness - /// requirements, you may want to use a better UUID generator or - /// some other form of identifier entirely. - PN_CPP_EXTERN static uuid random(); - - /// UUID standard string format: 8-4-4-4-12 (36 chars, 32 - /// alphanumeric chars and 4 hypens). - PN_CPP_EXTERN std::string str() const; -}; - -/// UUID standard format: 8-4-4-4-12 (36 chars, 32 alphanumeric chars -/// and 4 hypens). -PN_CPP_EXTERN std::ostream& operator<<(std::ostream&, const uuid&); - -} // proton - -#endif // PROTON_UUID_HPP http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/cpp/include/proton/value.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/value.hpp b/proton-c/bindings/cpp/include/proton/value.hpp deleted file mode 100644 index 3ac1763..0000000 --- a/proton-c/bindings/cpp/include/proton/value.hpp +++ /dev/null @@ -1,207 +0,0 @@ -#ifndef PROTON_VALUE_HPP -#define PROTON_VALUE_HPP - -/* - * - * 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 "./codec/encoder.hpp" -#include "./codec/decoder.hpp" -#include "./internal/type_traits.hpp" -#include "./scalar.hpp" -#include "./types_fwd.hpp" - -#include <proton/type_compat.h> - -#include <iosfwd> - -namespace proton { - -namespace internal { - -// Separate value data from implicit conversion constructors to avoid template recursion. -class value_base { - protected: - internal::data& data(); - internal::data data_; - - friend class value_ref; - friend class codec::encoder; - friend class codec::decoder; -}; - -} // internal - -/// A holder for any AMQP value, simple or complex. -/// -/// @see @ref types_page -class value : public internal::value_base, private internal::comparable<value> { - private: - // Enabler for encodable types excluding proton::value. - template<class T, class U=void> struct assignable : - public internal::enable_if<codec::is_encodable<T>::value, U> {}; - template<class U> struct assignable<value, U> {}; - - public: - /// Create a null value - PN_CPP_EXTERN value(); - - /// @name Copy a value - /// @{ - PN_CPP_EXTERN value(const value&); - PN_CPP_EXTERN value& operator=(const value&); -#if PN_CPP_HAS_RVALUE_REFERENCES - PN_CPP_EXTERN value(value&&); - PN_CPP_EXTERN value& operator=(value&&); -#endif - /// @} - - /// Construct from any allowed type T. - template <class T> value(const T& x, typename assignable<T>::type* = 0) { *this = x; } - - /// Assign from any allowed type T. - template <class T> typename assignable<T, value&>::type operator=(const T& x) { - codec::encoder e(*this); - e << x; - return *this; - } - - /// Get the type ID for the current value. - PN_CPP_EXTERN type_id type() const; - - /// True if the value is null - PN_CPP_EXTERN bool empty() const; - - - /// Reset the value to null/empty - PN_CPP_EXTERN void clear(); - - /// @cond INTERNAL (deprecated) - template<class T> void get(T &t) const; - template<class T> T get() const; - PN_CPP_EXTERN int64_t as_int() const; - PN_CPP_EXTERN uint64_t as_uint() const; - PN_CPP_EXTERN double as_double() const; - PN_CPP_EXTERN std::string as_string() const; - /// @endcond - - /// swap values - friend PN_CPP_EXTERN void swap(value&, value&); - - /// @name Comparison operators - /// @{ - friend PN_CPP_EXTERN bool operator==(const value& x, const value& y); - friend PN_CPP_EXTERN bool operator<(const value& x, const value& y); - ///@} - - /// If contained value is a scalar type T, print using operator<<(T) - /// - /// Complex types are printed in a non-standard human-readable format but - /// that may change in future so should not be parsed. - friend PN_CPP_EXTERN std::ostream& operator<<(std::ostream&, const value&); -}; - -namespace internal { - -// value_ref is a `pn_data_t* p` that can be returned as a value& and used to modify -// the underlying value in-place. -// -// Classes with a value_ref member can return it as a value& in accessor functions. -// It can also be used to copy a pn_data_t* p to a proton::value via: value(value_ref(p)); -// None of the constructors make copies, they just refer to the same value. -// -class value_ref : public value { - public: - value_ref(pn_data_t* = 0); - value_ref(const internal::data&); - value_ref(const value_base&); - - // Use refer() not operator= to avoid confusion with value op= - void refer(pn_data_t*); - void refer(const internal::data&); - void refer(const value_base&); - - // Reset to refer to nothing, release existing references. Equivalent to refer(0). - void reset(); - - // Assignments to value_ref means assigning to the value. - template <class T> value_ref& operator=(const T& x) { - static_cast<value&>(*this) = x; - return *this; - } -}; - -} - - -/// @copydoc scalar::get -/// @related proton::value -template<class T> T get(const value& v) { T x; get(v, x); return x; } - -/// Like get(const value&) but assigns the value to a reference -/// instead of returning it. May be more efficient for complex values -/// (arrays, maps, etc.) -/// -/// @related proton::value -template<class T> void get(const value& v, T& x) { codec::decoder d(v, true); d >> x; } - -/// @related proton::value -template<class T, class U> inline void get(const U& u, T& x) { const value v(u); get(v, x); } - -/// @copydoc scalar::coerce -/// @related proton::value -template<class T> T coerce(const value& v) { T x; coerce(v, x); return x; } - -/// Like coerce(const value&) but assigns the value to a reference -/// instead of returning it. May be more efficient for complex values -/// (arrays, maps, etc.) -/// -/// @related proton::value -template<class T> void coerce(const value& v, T& x) { - codec::decoder d(v, false); - if (type_id_is_scalar(v.type())) { - scalar s; - d >> s; - x = internal::coerce<T>(s); - } else { - d >> x; - } -} - -/// Special case for get<null>(), just checks that value contains NULL. -template<> inline void get<null>(const value& v, null&) { - assert_type_equal(NULL_TYPE, v.type()); -} - -/// Return a readable string representation of x for display purposes. -PN_CPP_EXTERN std::string to_string(const value& x); - -/// @cond INTERNAL -template<class T> void value::get(T &x) const { x = proton::get<T>(*this); } -template<class T> T value::get() const { return proton::get<T>(*this); } -inline int64_t value::as_int() const { return proton::coerce<int64_t>(*this); } -inline uint64_t value::as_uint() const { return proton::coerce<uint64_t>(*this); } -inline double value::as_double() const { return proton::coerce<double>(*this); } -inline std::string value::as_string() const { return proton::coerce<std::string>(*this); } -/// @endcond - -} // proton - -#endif // PROTON_VALUE_HPP http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/cpp/libqpid-proton-cpp.pc.in ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/libqpid-proton-cpp.pc.in b/proton-c/bindings/cpp/libqpid-proton-cpp.pc.in deleted file mode 100644 index 4b556f4..0000000 --- a/proton-c/bindings/cpp/libqpid-proton-cpp.pc.in +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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. - */ - -prefix=@PREFIX@ -exec_prefix=@EXEC_PREFIX@ -libdir=@LIBDIR@ -includedir=@INCLUDEDIR@ - -Name: Proton C++ -Description: Qpid Proton C++ library -Version: @PN_VERSION@ -URL: http://qpid.apache.org/proton/ -Libs: -L${libdir} -lqpid-proton-cpp -Cflags: -I${includedir} http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/cpp/src/binary.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/binary.cpp b/proton-c/bindings/cpp/src/binary.cpp deleted file mode 100644 index fb366f0..0000000 --- a/proton-c/bindings/cpp/src/binary.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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 "types_internal.hpp" - -#include "proton/binary.hpp" - -#include <ostream> -#include <iomanip> - -#include <ctype.h> - -namespace proton { - -std::ostream& operator<<(std::ostream& o, const binary& x) { - ios_guard restore_flags(o); - o << std::hex << std::setfill('0') << "b\""; - for (binary::const_iterator i = x.begin(); i != x.end(); ++i) { - if (!isprint(*i) && !isspace(*i)) { // Non-printables in hex. - o << "\\x" << std::setw(2) << printable_byte(*i); - } else { - o << char(*i); - } - } - return o << '"'; -} - -} http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/cpp/src/byte_array.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/byte_array.cpp b/proton-c/bindings/cpp/src/byte_array.cpp deleted file mode 100644 index cd6bb1b..0000000 --- a/proton-c/bindings/cpp/src/byte_array.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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 "types_internal.hpp" - -#include "proton/byte_array.hpp" - -#include <ostream> -#include <iomanip> - -namespace proton { -namespace internal { - -void print_hex(std::ostream& o, const uint8_t* p, size_t n) { - ios_guard restore_flags(o); - o << "0x" << std::hex << std::setfill('0'); - for (size_t i = 0; i < n; ++i) { - o << std::setw(2) << printable_byte(p[i]); - } -} - -}} http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/cpp/src/cached_map.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/cached_map.cpp b/proton-c/bindings/cpp/src/cached_map.cpp deleted file mode 100644 index 5411aa1..0000000 --- a/proton-c/bindings/cpp/src/cached_map.cpp +++ /dev/null @@ -1,130 +0,0 @@ -/* - * - * 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/internal/cached_map.hpp" - -#include "proton/annotation_key.hpp" -#include "proton/scalar.hpp" -#include "proton/value.hpp" -#include "proton/codec/decoder.hpp" -#include "proton/codec/encoder.hpp" -#include "proton/codec/map.hpp" - -#include <map> -#include <string> - -namespace proton { -namespace internal { - - // use std::map as the actual cached_map implementation type -template <class K, class V> -class map_type_impl : public std::map<K, V> {}; - -template <class K, class V> -cached_map<K,V>::cached_map() {} -template <class K, class V> -cached_map<K,V>::cached_map(const cached_map& cm) { if ( !cm.map_ ) return; map_.reset(new map_type(*cm.map_)); } -template <class K, class V> -cached_map<K,V>& cached_map<K,V>::operator=(const cached_map& cm) { - if (&cm != this) { - cached_map<K,V> t; - map_type *m = !cm.map_ ? 0 : new map_type(*cm.map_); - t.map_.reset(map_.release()); - map_.reset(m); - } - return *this; -} - -template <class K, class V> -#if PN_CPP_HAS_RVALUE_REFERENCES -cached_map<K,V>::cached_map(cached_map&& cm) : map_(std::move(cm.map_)) {} -template <class K, class V> -cached_map<K,V>& cached_map<K,V>::operator=(cached_map&& cm) { map_.reset(cm.map_.release()); return *this; } -template <class K, class V> -#endif -cached_map<K,V>::~cached_map() {} - -template <class K, class V> -V cached_map<K,V>::get(const K& k) const { - if ( !map_ ) return V(); - typename map_type::const_iterator i = map_->find(k); - if ( i==map_->end() ) return V(); - return i->second; -} -template <class K, class V> -void cached_map<K,V>::put(const K& k, const V& v) { - if ( !map_ ) make_cached_map(); - (*map_)[k] = v; -} -template <class K, class V> -size_t cached_map<K,V>::erase(const K& k) { - if ( !map_ ) return 0; - return map_->erase(k); -} -template <class K, class V> -bool cached_map<K,V>::exists(const K& k) const { - if ( !map_ ) return false; - return map_->count(k) > 0; -} - -template <class K, class V> -size_t cached_map<K,V>::size() { - if ( !map_ ) return 0; - return map_->size(); -} -template <class K, class V> -void cached_map<K,V>::clear() { - map_.reset(); -} -template <class K, class V> -bool cached_map<K,V>::empty() { - if ( !map_ ) return true; - return map_->empty(); -} - -template <class K, class V> -void cached_map<K,V>::make_cached_map() { map_.reset(new map_type); } - -template <class K, class V> -PN_CPP_EXTERN proton::codec::decoder& operator>>(proton::codec::decoder& d, cached_map<K,V>& m) { - if ( !m.map_ ) m.make_cached_map(); - return d >> *(m.map_); -} -template <class K, class V> -PN_CPP_EXTERN proton::codec::encoder& operator<<(proton::codec::encoder& e, const cached_map<K,V>& m) { - if ( !m.map_ ) return e; - return e << *(m.map_); -} - -// Force the necessary template instantiations so that the library exports the correct symbols -template class PN_CPP_CLASS_EXTERN cached_map<std::string, scalar>; -template class PN_CPP_CLASS_EXTERN cached_map<annotation_key, value>; -template class PN_CPP_CLASS_EXTERN cached_map<symbol, value>; - -template proton::codec::decoder& operator>> <>(proton::codec::decoder& d, cached_map<std::string, scalar>& m); -template proton::codec::encoder& operator<< <>(proton::codec::encoder& e, const cached_map<std::string, scalar>& m); -template proton::codec::decoder& operator>> <>(proton::codec::decoder& d, cached_map<annotation_key, value>& m); -template proton::codec::encoder& operator<< <>(proton::codec::encoder& e, const cached_map<annotation_key, value>& m); -template proton::codec::decoder& operator>> <>(proton::codec::decoder& d, cached_map<symbol, value>& m); -template proton::codec::encoder& operator<< <>(proton::codec::encoder& e, const cached_map<symbol, value>& m); - -} -} http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/cpp/src/codec_test.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/codec_test.cpp b/proton-c/bindings/cpp/src/codec_test.cpp deleted file mode 100644 index 7791749..0000000 --- a/proton-c/bindings/cpp/src/codec_test.cpp +++ /dev/null @@ -1,115 +0,0 @@ -/* - * 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 "test_bits.hpp" - -#include "proton/internal/data.hpp" -#include "proton/internal/config.hpp" -#include "proton/types.hpp" - -namespace { - -using namespace proton; - -template <class T> void simple_type_test(const T& x) { - ASSERT(codec::is_encodable<T>::value); - value v; - codec::encoder e(v); - e << x; - T y; - codec::decoder d(v); - d >> y; - ASSERT_EQUAL(x, y); -} - -template <class T> T make_fill(const char c) { - T x; std::fill(x.begin(), x.end(), c); - return x; -} - -template <class T> void uncodable_type_test() { - ASSERT(!codec::is_encodable<T>::value); -} - -} - -int main(int, char**) { - int failed = 0; - - // Basic AMQP types - RUN_TEST(failed, simple_type_test(false)); - RUN_TEST(failed, simple_type_test(uint8_t(42))); - RUN_TEST(failed, simple_type_test(int8_t(-42))); - RUN_TEST(failed, simple_type_test(uint16_t(4242))); - RUN_TEST(failed, simple_type_test(int16_t(-4242))); - RUN_TEST(failed, simple_type_test(uint32_t(4242))); - RUN_TEST(failed, simple_type_test(int32_t(-4242))); - RUN_TEST(failed, simple_type_test(uint64_t(4242))); - RUN_TEST(failed, simple_type_test(int64_t(-4242))); - RUN_TEST(failed, simple_type_test(wchar_t('X'))); - RUN_TEST(failed, simple_type_test(float(1.234))); - RUN_TEST(failed, simple_type_test(double(11.2233))); - RUN_TEST(failed, simple_type_test(timestamp(1234))); - RUN_TEST(failed, simple_type_test(make_fill<decimal32>(0))); - RUN_TEST(failed, simple_type_test(make_fill<decimal64>(0))); - RUN_TEST(failed, simple_type_test(make_fill<decimal128>(0))); - RUN_TEST(failed, simple_type_test(uuid::copy("\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff"))); - RUN_TEST(failed, simple_type_test(std::string("xxx"))); - RUN_TEST(failed, simple_type_test(symbol("aaa"))); - RUN_TEST(failed, simple_type_test(binary("aaa"))); - - // Native int type that may map differently per platform to uint types. - RUN_TEST(failed, simple_type_test(char(42))); - RUN_TEST(failed, simple_type_test(short(42))); - RUN_TEST(failed, simple_type_test(int(42))); - RUN_TEST(failed, simple_type_test(long(42))); - - RUN_TEST(failed, simple_type_test(static_cast<signed char>(42))); - RUN_TEST(failed, simple_type_test(static_cast<signed short>(42))); - RUN_TEST(failed, simple_type_test(static_cast<signed int>(42))); - RUN_TEST(failed, simple_type_test(static_cast<signed long>(42))); - - RUN_TEST(failed, simple_type_test(static_cast<unsigned char>(42))); - RUN_TEST(failed, simple_type_test(static_cast<unsigned short>(42))); - RUN_TEST(failed, simple_type_test(static_cast<unsigned int>(42))); - RUN_TEST(failed, simple_type_test(static_cast<unsigned long>(42))); - -#if PN_CPP_HAS_LONG_LONG - RUN_TEST(failed, simple_type_test(static_cast<long>(42))); - RUN_TEST(failed, simple_type_test(static_cast<signed long>(42))); - RUN_TEST(failed, simple_type_test(static_cast<unsigned long>(42))); -#endif - - // value and scalar types, more tests in value_test and scalar_test. - RUN_TEST(failed, simple_type_test(value("foo"))); - RUN_TEST(failed, value v(23); simple_type_test(v)); - RUN_TEST(failed, simple_type_test(scalar(23))); - RUN_TEST(failed, simple_type_test(annotation_key(42))); - RUN_TEST(failed, simple_type_test(message_id(42))); - - // Make sure we reject uncodable types - RUN_TEST(failed, (uncodable_type_test<std::pair<int, float> >())); - RUN_TEST(failed, (uncodable_type_test<std::pair<scalar, value> >())); - RUN_TEST(failed, (uncodable_type_test<std::basic_string<wchar_t> >())); - RUN_TEST(failed, (uncodable_type_test<internal::data>())); - RUN_TEST(failed, (uncodable_type_test<pn_data_t*>())); - - return failed; -} - --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
