@@ -11,6 +11,19 @@ using namespace trygvis::mqtt_support;
1111
1212namespace msgflo {
1313
14+ std::string string_to_upper_copy (const std::string &str) {
15+ std::string ret;
16+ ret.resize (str.size ());
17+ for (uint i=0 ; i<str.size (); i++) {
18+ ret[i] = toupper (str[i]);
19+ }
20+ return ret;
21+ }
22+
23+ bool string_starts_with (const std::string &str, const std::string &prefix) {
24+ return str.substr (0 , prefix.size ()) == prefix;
25+ }
26+
1427class DiscoveryMessage {
1528public:
1629 DiscoveryMessage (const Definition &def)
@@ -179,7 +192,7 @@ class AmqpEngine final : public Engine, protected AbstractEngine<AmqpEngine> {
179192
180193protected:
181194 string generateQueueName (const Definition &d, const Definition::Port &port) override {
182- return d.role + " ." + boost::to_upper_copy<std::string> (port.id );
195+ return d.role + " ." + string_to_upper_copy (port.id );
183196 }
184197
185198private:
@@ -281,7 +294,7 @@ class MosquittoEngine final : public Engine, protected mqtt_event_listener, prot
281294
282295protected:
283296 string generateQueueName (const Definition &d, const Definition::Port &port) override {
284- return " /" + d.role + " ." + boost::to_upper_copy<std::string> (port.id );
297+ return " /" + d.role + " ." + string_to_upper_copy (port.id );
285298 }
286299
287300 virtual void on_msg (const string &msg) override {
@@ -335,7 +348,7 @@ shared_ptr<Engine> createEngine(const EngineConfig config) {
335348 }
336349 }
337350
338- if (boost::starts_with (url, " mqtt://" )) {
351+ if (string_starts_with (url, " mqtt://" )) {
339352 string host, username, password;
340353 int port = 1883 ;
341354 int keep_alive = 180 ;
@@ -431,7 +444,7 @@ shared_ptr<Engine> createEngine(const EngineConfig config) {
431444 }
432445
433446 return make_shared<MosquittoEngine>(config, host, port, keep_alive, client_id, clean_session);
434- } else if (boost::starts_with (url, " amqp://" )) {
447+ } else if (string_starts_with (url, " amqp://" )) {
435448 return make_shared<AmqpEngine>(url);
436449 }
437450
0 commit comments