qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Flores, Paul A." <PAUL.A.FLO...@SAIC.COM>
Subject RE: Need Help!: Example of the use of Variant Type
Date Fri, 01 Apr 2016 19:50:14 GMT
An adaptation of what was shared with me by Matt (Thanks!) it compiles and appears to work!

std::map<std::string,std::string> rtnMapfromVar(const Variant::Map &map){
   std::map<std::string,std::string> results;
   Variant::Map::const_iterator it;
   for (it =map.begin(); it != map.end();++it){
       std::string key=(*it).first;
      Variant variant=(*it).second;
       results[key]=variant.asString();
  }
  return results;
}

________________________________________
From: Gordon Sim [gsim@redhat.com]
Sent: Friday, April 01, 2016 10:13 AM
To: users@qpid.apache.org
Subject: Re: Need Help!: Example of the use of Variant Type

On 01/04/16 15:45, Flores, Paul A. wrote:
> Thanks for the example.  I was hoping for something a whole lot simpler.  It appears
to be a royal pain!
>
> Hopefully there is a simplistic example I can implement for my client!  Anyone else?

https://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/Variant.cpp?view=markup#l699


It doesn't explicitly use find but that would be something like (I
haven't tried to compile this!):

     Variant v = ...;//egt map from somewhere
     Variant::Map::const_iterator i = value.asMap().find("foo");
     if (i != value.asMap().end()) {
         std::string value = i->second;
     }



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

________________________________

This communication (including any attachments) may contain information that is proprietary,
confidential or exempt from disclosure. If you are not the intended recipient, please note
that further dissemination, distribution, use or copying of this communication is strictly
prohibited. Anyone who received this message in error should notify the sender immediately
by telephone or by return email and delete it from his or her computer.

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


Mime
View raw message