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 01:48:14 UTC

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

Author: tabish
Date: Mon Aug 13 16:48:13 2007
New Revision: 565575

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

Adding start of URI class

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=565575&r1=565574&r2=565575
==============================================================================
--- 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 Mon Aug 13 16:48:13 2007
@@ -22,7 +22,36 @@
 using namespace decaf::lang;
 
 ////////////////////////////////////////////////////////////////////////////////
-URI::URI( const std::string& uri ) {
+URI::URI( const std::string& uri ) throw ( URISyntaxException) {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+URI::URI( const std::string& scheme,
+          const std::string& ssp,
+          const std::string& fragment ) throw ( URISyntaxException ) {
+
+}
+
+////////////////////////////////////////////////////////////////////////////////
+URI::URI( const std::string& scheme, const std::string& userInfo,
+          const std::string& host, int port,
+          const std::string& path, const std::string& query,
+          const std::string& fragment ) throw ( URISyntaxException ) {
+
+}
+
+////////////////////////////////////////////////////////////////////////////////
+URI::URI( const std::string& scheme, const std::string& host,
+          const std::string& path, const std::string& fragment )
+            throw ( URISyntaxException ) {
+
+}
+
+////////////////////////////////////////////////////////////////////////////////
+URI::URI( const std::string& scheme, const std::string& authority,
+          const std::string& path, const std::string& query,
+          const std::string& fragment ) throw ( URISyntaxException ) {
+
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -42,5 +71,11 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 bool URI::operator<( const URI& value ) const {
+
+}
+
+////////////////////////////////////////////////////////////////////////////////
+URI URI::create( const std::string uri )
+    throw ( lang::exceptions::IllegalArgumentException ) {
 
 }

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=565575&r1=565574&r2=565575
==============================================================================
--- 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 Mon Aug 13 16:48:13 2007
@@ -20,19 +20,27 @@
 
 #include <decaf/util/Config.h>
 #include <decaf/lang/Comparable.h>
+#include <decaf/lang/exceptions/IllegalArgumentException.h>
+#include <decaf/net/URISyntaxException.h>
 #include <string>
 
 namespace decaf{
 namespace net{
 
     class DECAF_API URI : public lang::Comparable<URI> {
+    private:
+
+        std::string authority;
+        std::string fragment;
+        std::string host;
+
     public:
 
         /**
          * Constructs a URI from the given string
          * @param uri - string uri to parse.
          */
-        URI( const std::string& uri );
+        URI( const std::string& uri ) throw ( URISyntaxException );
 
         /**
          * Constructs a URI from the given components.
@@ -42,7 +50,7 @@
          */
         URI( const std::string& scheme,
              const std::string& ssp,
-             const std::string& fragment);
+             const std::string& fragment) throw ( URISyntaxException );
 
         /**
          * Constructs a URI from the given components.
@@ -57,7 +65,7 @@
         URI( const std::string& scheme, const std::string& userInfo,
              const std::string& host, int port,
              const std::string& path, const std::string& query,
-             const std::string& fragment );
+             const std::string& fragment ) throw ( URISyntaxException );
 
         /**
          * Constructs a URI from the given components.
@@ -67,7 +75,8 @@
          * @param fragment - Fragment
          */
         URI( const std::string& scheme, const std::string& host,
-             const std::string& path, const std::string& fragment );
+             const std::string& path, const std::string& fragment )
+                 throw ( URISyntaxException );
 
         /**
          * Constructs a URI from the given components.
@@ -79,7 +88,7 @@
          */
         URI( const std::string& scheme, const std::string& authority,
              const std::string& path, const std::string& query,
-             const std::string& fragment );
+             const std::string& fragment ) throw ( URISyntaxException);
 
         virtual ~URI() {}
 
@@ -111,6 +120,40 @@
          * @return true if this object is equal to the one passed.
          */
         virtual bool operator<( const URI& value ) const;
+
+        /**
+         * @eturns the decoded authority component of this URI.
+         */
+        std::string getAuthority() const {
+            return this->authority;
+        }
+
+        /**
+         * @returns the decoded fragment component of this URI.
+         */
+        std::string getFragment() const {
+            return this->fragment;
+        }
+
+        /**
+         * @returns the host component of this URI.
+         */
+        std::string getHost() const {
+            return this->host;
+        }
+
+    public:   // Static Methods
+
+        /**
+         * Creates a URI by parsing the given string.
+         * This convenience factory method works as if by invoking the URI(string)
+         * constructor; any URISyntaxException thrown by the constructor is caught
+         * and wrapped in a new IllegalArgumentException object, which is then thrown.
+         * @param uri - URI string to parse
+         * @throws IllegalArgumentException
+         */
+        static URI create( const std::string uri )
+            throw ( lang::exceptions::IllegalArgumentException );
 
     };