Author: tabish Date: Sat Jan 27 11:37:59 2007 New Revision: 500599 URL: http://svn.apache.org/viewvc?view=rev&rev=500599 Log: http://issues.apache.org/activemq/browse/AMQCPP-30
Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/URISupport.cpp incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/URISupport.h Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/URISupport.cpp URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/URISupport.cpp?view=diff&rev=500599&r1=500598&r2=500599 ============================================================================== --- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/URISupport.cpp (original) +++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/URISupport.cpp Sat Jan 27 11:37:59 2007 @@ -30,8 +30,29 @@ { try { - SimpleProperties map; + SimpleProperties options; + URISupport::parseQuery( query, &options ); + return options; + } + AMQ_CATCH_RETHROW( IllegalArgumentException ) + AMQ_CATCH_EXCEPTION_CONVERT( NoSuchElementException, IllegalArgumentException ) + AMQ_CATCHALL_THROW( IllegalArgumentException ) +} + +//////////////////////////////////////////////////////////////////////////////// +void URISupport::parseQuery( std::string query, + util::Properties* properties ) + throw ( exceptions::IllegalArgumentException ) { + + try { + if( properties == NULL ) { + throw IllegalArgumentException( + __FILE__, + __LINE__, + "URISupport::parseQuery - Can't pass in a null properties object" ); + } + // strip the initial "?" size_t pos = query.find_first_of( "?" ); if( pos != std::string::npos ) { @@ -70,13 +91,10 @@ } // Store them. - map.setProperty( key, value ); + properties->setProperty( key, value ); } - - return map; } AMQ_CATCH_RETHROW( IllegalArgumentException ) AMQ_CATCH_EXCEPTION_CONVERT( NoSuchElementException, IllegalArgumentException ) AMQ_CATCHALL_THROW( IllegalArgumentException ) } - Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/URISupport.h URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/URISupport.h?view=diff&rev=500599&r1=500598&r2=500599 ============================================================================== --- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/URISupport.h (original) +++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/URISupport.h Sat Jan 27 11:37:59 2007 @@ -40,6 +40,17 @@ static SimpleProperties parseQuery( std::string query ) throw ( exceptions::IllegalArgumentException ); + /** + * Parse the Query portion of a URI String and return a Simple + * Properties object containing the parameter names as keys, and + * the parameter values and values of the Properties. + * @param query - the query string to parse. + * @param properties - object pointer to get the parsed output. + */ + static void parseQuery( std::string query, + util::Properties* properties ) + throw ( exceptions::IllegalArgumentException ); + }; }}