From 723470d6d614e27dc55ad33a8151633bd77c5ea8 Mon Sep 17 00:00:00 2001 From: Bas van Berckel Date: Wed, 23 Sep 2020 17:09:27 +0200 Subject: [PATCH] add string/cstring constructors to addresses.h; add addresses.h to include file --- include/amqpcpp.h | 1 + include/amqpcpp/addresses.h | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/include/amqpcpp.h b/include/amqpcpp.h index ebb064e..deb69d9 100644 --- a/include/amqpcpp.h +++ b/include/amqpcpp.h @@ -77,6 +77,7 @@ #include "amqpcpp/channel.h" #include "amqpcpp/login.h" #include "amqpcpp/address.h" +#include "amqpcpp/addresses.h" #include "amqpcpp/connectionhandler.h" #include "amqpcpp/connectionimpl.h" #include "amqpcpp/connection.h" diff --git a/include/amqpcpp/addresses.h b/include/amqpcpp/addresses.h index 3af0e76..2379658 100644 --- a/include/amqpcpp/addresses.h +++ b/include/amqpcpp/addresses.h @@ -12,6 +12,11 @@ */ #pragma once +/** + * Dependencies + */ +#include + /** * Begin of namespace */ @@ -68,6 +73,20 @@ public: throw std::runtime_error("no addresses"); } + /** + * Constructor for a comma separated list + * @param buffer + * @throws std::runtime_error + */ + Addresses(const char *buffer) : Addresses(buffer, strlen(buffer)) {} + + /** + * Constructor for a comma separated list + * @param buffer + * @throws std::runtime_error + */ + Addresses(const std::string &buffer) : Addresses(buffer.data(), buffer.size()) {} + /** * Destructed */