You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2007/08/14 20:56:33 UTC

svn commit: r565856 - in /activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/net: URI.cpp URI.h

Author: tabish
Date: Tue Aug 14 11:56:32 2007
New Revision: 565856

URL: http://svn.apache.org/viewvc?view=rev&rev=565856
Log:
http://issues.apache.org/activemq/browse/AMQCPP-103

Adding start of URI class and URL class plus associated classes.

Modified:
    activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/net/URI.cpp
    activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/net/URI.h

Modified: activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/net/URI.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/net/URI.cpp?view=diff&rev=565856&r1=565855&r2=565856
==============================================================================
--- activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/net/URI.cpp (original)
+++ activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/net/URI.cpp Tue Aug 14 11:56:32 2007
@@ -56,26 +56,31 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 int URI::compareTo( const URI& value ) const {
-
+    return 0;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 bool URI::equals( const URI& value ) const {
-
+    return compareTo( value ) == 0 ? true : false;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 bool URI::operator==( const URI& value ) const {
-
+    return compareTo( value ) == 0 ? true : false;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 bool URI::operator<( const URI& value ) const {
-
+    return compareTo( value ) == -1 ? true : false;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 URI URI::create( const std::string uri )
     throw ( lang::exceptions::IllegalArgumentException ) {
 
+    try {
+        return URI( uri );
+    } catch( URISyntaxException& e ) {
+        throw IllegalArgumentException( e );
+    }
 }

Modified: activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/net/URI.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/net/URI.h?view=diff&rev=565856&r1=565855&r2=565856
==============================================================================
--- activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/net/URI.h (original)
+++ activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/net/URI.h Tue Aug 14 11:56:32 2007
@@ -25,6 +25,8 @@
 #include <decaf/net/MalformedURLException.h>
 #include <decaf/net/URL.h>
 #include <string>
+#include <apr_uri.h>
+#include <decaf/internal/AprPool.h>
 
 namespace decaf{
 namespace net{
@@ -35,14 +37,12 @@
     class DECAF_API URI : public lang::Comparable<URI> {
     private:
 
-        std::string scheme;
-        std::string authority;
-        std::string fragment;
-        std::string host;
-        std::string path;
-        std::string userInfo;
-        int port;
-        std::string query;
+        // Apr Data for parsing the uri.
+        apr_uri_t uri;
+        AprPool pool;
+
+        // The original string entered from URI( string ), empty if not set.
+        std::string uri;
 
     public:
 
@@ -135,56 +135,56 @@
          * @eturns the decoded authority component of this URI.
          */
         std::string getAuthority() const {
-            return this->authority;
+            return this->uri.hostinfo;
         }
 
         /**
          * @returns the decoded fragment component of this URI.
          */
         std::string getFragment() const {
-            return this->fragment;
+            return this->uri.fragment;
         }
 
         /**
          * @returns the host component of this URI.
          */
         std::string getHost() const {
-            return this->host;
+            return this->uri.host;
         }
 
         /**
          * @returns the path component of this URI.
          */
         std::string getPath() const {
-            return this->path;
+            return this->uri.path;
         }
 
         /**
          * @returns the port component of this URI.
          */
         int getPort() const {
-            return this->port;
+            return this->uri.port;
         }
 
         /**
          * @returns the query component of this URI.
          */
         std::string getQuery() const {
-            return this->query;
+            return this->uri.query;
         }
 
         /**
          * @returns the scheme component of this URI
          */
         std::string getScheme() const {
-            return this->scheme;
+            return this->uri.scheme;
         }
 
         /**
          * @returns the user info component of this URI
          */
         std::string getUserInfo() const {
-            return this->userInfo;
+            return this->uri.username;
         }
 
         /**