mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Renamed nsTypicalUrl to nsStandardUrl.
This commit is contained in:
parent
9907679d08
commit
234d6bcc23
@ -25,45 +25,6 @@
|
|||||||
|
|
||||||
#undef GetPort // Windows (sigh)
|
#undef GetPort // Windows (sigh)
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// The "Typical URL" Implementation
|
|
||||||
|
|
||||||
// XXX regenerate:
|
|
||||||
#define NS_ITYPICALURL_IID \
|
|
||||||
{ /* 5053f850-f11e-11d2-9322-000000000000 */ \
|
|
||||||
0x5053f850, \
|
|
||||||
0xf11e, \
|
|
||||||
0x11d2, \
|
|
||||||
{0x93, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} \
|
|
||||||
}
|
|
||||||
|
|
||||||
// XXX regenerate:
|
|
||||||
#define NS_TYPICALURL_CID \
|
|
||||||
{ /* 8ffae6d0-ee37-11d2-9322-000000000000 */ \
|
|
||||||
0x8ffae6d0, \
|
|
||||||
0xee37, \
|
|
||||||
0x11d2, \
|
|
||||||
{0x93, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} \
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The nsITypicalUrl interface defines the initializer for a URL
|
|
||||||
* implementation that only supports the accessors of nsIUrl.
|
|
||||||
*
|
|
||||||
* Protocol writers can obtain one by calling the component manager
|
|
||||||
* to create an instance of a typical URL by the CID, and then call
|
|
||||||
* the Init routine on it and finally QueryInterface to get the nsIUrl
|
|
||||||
* to return.
|
|
||||||
*/
|
|
||||||
|
|
||||||
class nsIUrl;
|
|
||||||
|
|
||||||
class nsITypicalUrl : public nsISupports
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
NS_IMETHOD Init(const char* spec, nsIUrl* baseUrl) = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
#define NS_IURL_IID \
|
#define NS_IURL_IID \
|
||||||
{ /* 82c1b000-ea35-11d2-931b-00104ba0fd40 */ \
|
{ /* 82c1b000-ea35-11d2-931b-00104ba0fd40 */ \
|
||||||
0x82c1b000, \
|
0x82c1b000, \
|
||||||
@ -73,7 +34,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The nsIURI class is an interface to the URI behaviour for parsing
|
* The nsIUrl class is an interface to the URL behaviour for parsing
|
||||||
* portions out of a URI. This follows Tim Berners-Lee's URI spec at-
|
* portions out of a URI. This follows Tim Berners-Lee's URI spec at-
|
||||||
*
|
*
|
||||||
* http://www.w3.org/Addressing/URI/URI_Overview.html
|
* http://www.w3.org/Addressing/URI/URI_Overview.html
|
||||||
@ -102,7 +63,13 @@ class nsIUrl : public nsISupports {
|
|||||||
public:
|
public:
|
||||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IURL_IID);
|
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IURL_IID);
|
||||||
|
|
||||||
// Core parsing functions
|
/**
|
||||||
|
* Parses a URL spec (a string) relative to a base URL.
|
||||||
|
* Any defaults not specified in the spec (because it is a relative
|
||||||
|
* spec) are pulled from the base. The baseUrl can be null in which
|
||||||
|
* case the spec must be an absolute URL.
|
||||||
|
*/
|
||||||
|
NS_IMETHOD Init(const char* spec, nsIUrl* baseUrl) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Scheme is the protocol that this URI refers to.
|
* The Scheme is the protocol that this URI refers to.
|
||||||
@ -170,11 +137,35 @@ public:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern nsresult NS_NewURL(nsIUrl** aInstancePtrResult, const char *aSpec, nsIUrl* aBaseUrl);
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
extern nsresult NS_NewConnection(nsIUrl* url,
|
/**
|
||||||
nsISupports* eventSink,
|
* Protocol writers can obtain a default nsIUrl implementation by calling the
|
||||||
nsIConnectionGroup* group,
|
* component manager with NS_STANDARDURL_CID. The implementation returned will
|
||||||
nsIProtocolConnection* *result);
|
* only implement the set of accessors specified by nsIUrl. After obtaining the
|
||||||
|
* instance from the component manager, the Init routine must be called on it
|
||||||
|
* to initialize it from the user's URL spec.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define NS_STANDARDURL_CID \
|
||||||
|
{ /* 46fc2a26-ff66-11d2-8ccb-0060b0fc14a3 */ \
|
||||||
|
0x46fc2a26, \
|
||||||
|
0xff66, \
|
||||||
|
0x11d2, \
|
||||||
|
{0x8c, 0xcb, 0x00, 0x60, 0xb0, 0xfc, 0x14, 0xa3} \
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
extern nsresult
|
||||||
|
NS_NewURL(nsIUrl** aInstancePtrResult, const char *aSpec, nsIUrl* aBaseUrl);
|
||||||
|
|
||||||
|
extern nsresult
|
||||||
|
NS_NewConnection(nsIUrl* url,
|
||||||
|
nsISupports* eventSink,
|
||||||
|
nsIConnectionGroup* group,
|
||||||
|
nsIProtocolConnection* *result);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#endif /* nsIIUrl_h___ */
|
#endif /* nsIIUrl_h___ */
|
||||||
|
@ -32,15 +32,15 @@ CPPSRCS = \
|
|||||||
nsSocketTransport.cpp \
|
nsSocketTransport.cpp \
|
||||||
nsSocketTransportService.cpp \
|
nsSocketTransportService.cpp \
|
||||||
nsNetService.cpp \
|
nsNetService.cpp \
|
||||||
nsUrl.cpp \
|
nsStandardUrl.cpp \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
EXPORTS = \
|
EXPORTS = \
|
||||||
nsConnectionGroup.h \
|
nsConnectionGroup.h \
|
||||||
nsNetService.h \
|
nsNetService.h \
|
||||||
nsFileTransportService.h \
|
nsFileTransportService.h \
|
||||||
nsSocketTransportService.h \
|
nsSocketTransportService.h \
|
||||||
nsUrl.h \
|
nsStandardUrl.h \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
|
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
|
||||||
|
@ -21,12 +21,12 @@ LCFLAGS = -DWIN32_LEAN_AND_MEAN -D_IMPL_NS_NET
|
|||||||
|
|
||||||
LIBRARY_NAME=netwerkbase_s
|
LIBRARY_NAME=netwerkbase_s
|
||||||
|
|
||||||
EXPORTS = \
|
EXPORTS = \
|
||||||
nsConnectionGroup.h \
|
nsConnectionGroup.h \
|
||||||
nsNetService.h \
|
nsNetService.h \
|
||||||
nsFileTransportService.h \
|
nsFileTransportService.h \
|
||||||
nsSocketTransportService.h \
|
nsSocketTransportService.h \
|
||||||
nsUrl.h \
|
nsStandardUrl.h \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
CPP_OBJS = \
|
CPP_OBJS = \
|
||||||
@ -38,7 +38,7 @@ CPP_OBJS = \
|
|||||||
.\$(OBJDIR)\nsSocketTransport.obj \
|
.\$(OBJDIR)\nsSocketTransport.obj \
|
||||||
.\$(OBJDIR)\nsSocketTransportService.obj \
|
.\$(OBJDIR)\nsSocketTransportService.obj \
|
||||||
.\$(OBJDIR)\nsNetService.obj \
|
.\$(OBJDIR)\nsNetService.obj \
|
||||||
.\$(OBJDIR)\nsUrl.obj \
|
.\$(OBJDIR)\nsStandardUrl.obj \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
LINCS = \
|
LINCS = \
|
||||||
|
@ -16,23 +16,23 @@
|
|||||||
* Reserved.
|
* Reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "nsUrl.h"
|
#include "nsStandardUrl.h"
|
||||||
#include "nscore.h"
|
#include "nscore.h"
|
||||||
#include "nsCRT.h"
|
#include "nsCRT.h"
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
#include "prmem.h"
|
#include "prmem.h"
|
||||||
#include "prprf.h"
|
#include "prprf.h"
|
||||||
|
|
||||||
static NS_DEFINE_CID(kTypicalUrlCID, NS_TYPICALURL_CID);
|
static NS_DEFINE_CID(kStandardUrlCID, NS_STANDARDURL_CID);
|
||||||
static NS_DEFINE_CID(kThisTypicalUrlImplementationCID,
|
static NS_DEFINE_CID(kThisStandardUrlImplementationCID,
|
||||||
NS_THIS_TYPICALURL_IMPLEMENTATION_CID);
|
NS_THIS_STANDARDURL_IMPLEMENTATION_CID);
|
||||||
|
|
||||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// nsUrl methods:
|
// nsStandardUrl methods:
|
||||||
|
|
||||||
nsUrl::nsUrl(nsISupports* outer)
|
nsStandardUrl::nsStandardUrl(nsISupports* outer)
|
||||||
: mScheme(nsnull),
|
: mScheme(nsnull),
|
||||||
mPreHost(nsnull),
|
mPreHost(nsnull),
|
||||||
mHost(nsnull),
|
mHost(nsnull),
|
||||||
@ -45,7 +45,7 @@ nsUrl::nsUrl(nsISupports* outer)
|
|||||||
NS_INIT_AGGREGATED(outer);
|
NS_INIT_AGGREGATED(outer);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsUrl::~nsUrl()
|
nsStandardUrl::~nsStandardUrl()
|
||||||
{
|
{
|
||||||
if (mScheme) delete[] mScheme;
|
if (mScheme) delete[] mScheme;
|
||||||
if (mPreHost) delete[] mPreHost;
|
if (mPreHost) delete[] mPreHost;
|
||||||
@ -56,30 +56,25 @@ nsUrl::~nsUrl()
|
|||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsUrl::Init(const char* aSpec,
|
nsStandardUrl::Init(const char* aSpec,
|
||||||
nsIUrl* aBaseUrl)
|
nsIUrl* aBaseUrl)
|
||||||
{
|
{
|
||||||
return Parse(aSpec, aBaseUrl);
|
return Parse(aSpec, aBaseUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMPL_AGGREGATED(nsUrl);
|
NS_IMPL_AGGREGATED(nsStandardUrl);
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsUrl::AggregatedQueryInterface(const nsIID& aIID, void** aInstancePtr)
|
nsStandardUrl::AggregatedQueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(aInstancePtr, "no instance pointer");
|
NS_ASSERTION(aInstancePtr, "no instance pointer");
|
||||||
if (aIID.Equals(kThisTypicalUrlImplementationCID) || // used by Equals
|
if (aIID.Equals(kThisStandardUrlImplementationCID) || // used by Equals
|
||||||
aIID.Equals(nsIUrl::GetIID()) ||
|
aIID.Equals(nsIUrl::GetIID()) ||
|
||||||
aIID.Equals(kISupportsIID)) {
|
aIID.Equals(kISupportsIID)) {
|
||||||
*aInstancePtr = NS_STATIC_CAST(nsIUrl*, this);
|
*aInstancePtr = NS_STATIC_CAST(nsIUrl*, this);
|
||||||
NS_ADDREF_THIS();
|
NS_ADDREF_THIS();
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
if (aIID.Equals(nsITypicalUrl::GetIID())) {
|
|
||||||
*aInstancePtr = NS_STATIC_CAST(nsITypicalUrl*, this);
|
|
||||||
NS_ADDREF_THIS();
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
return NS_NOINTERFACE;
|
return NS_NOINTERFACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,84 +82,84 @@ nsUrl::AggregatedQueryInterface(const nsIID& aIID, void** aInstancePtr)
|
|||||||
// nsIUrl methods:
|
// nsIUrl methods:
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsUrl::GetScheme(const char* *result)
|
nsStandardUrl::GetScheme(const char* *result)
|
||||||
{
|
{
|
||||||
*result = mScheme;
|
*result = mScheme;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsUrl::SetScheme(const char* scheme)
|
nsStandardUrl::SetScheme(const char* scheme)
|
||||||
{
|
{
|
||||||
mScheme = nsCRT::strdup(scheme);
|
mScheme = nsCRT::strdup(scheme);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsUrl::GetPreHost(const char* *result)
|
nsStandardUrl::GetPreHost(const char* *result)
|
||||||
{
|
{
|
||||||
*result = mPreHost;
|
*result = mPreHost;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsUrl::SetPreHost(const char* preHost)
|
nsStandardUrl::SetPreHost(const char* preHost)
|
||||||
{
|
{
|
||||||
mPreHost = nsCRT::strdup(preHost);
|
mPreHost = nsCRT::strdup(preHost);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsUrl::GetHost(const char* *result)
|
nsStandardUrl::GetHost(const char* *result)
|
||||||
{
|
{
|
||||||
*result = mHost;
|
*result = mHost;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsUrl::SetHost(const char* host)
|
nsStandardUrl::SetHost(const char* host)
|
||||||
{
|
{
|
||||||
mHost = nsCRT::strdup(host);
|
mHost = nsCRT::strdup(host);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsUrl::GetPort(PRInt32 *result)
|
nsStandardUrl::GetPort(PRInt32 *result)
|
||||||
{
|
{
|
||||||
*result = mPort;
|
*result = mPort;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsUrl::SetPort(PRInt32 port)
|
nsStandardUrl::SetPort(PRInt32 port)
|
||||||
{
|
{
|
||||||
mPort = port;
|
mPort = port;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsUrl::GetPath(const char* *result)
|
nsStandardUrl::GetPath(const char* *result)
|
||||||
{
|
{
|
||||||
*result = mPath;
|
*result = mPath;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsUrl::SetPath(const char* path)
|
nsStandardUrl::SetPath(const char* path)
|
||||||
{
|
{
|
||||||
mPath = nsCRT::strdup(path);
|
mPath = nsCRT::strdup(path);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsUrl::Equals(nsIUrl* other)
|
nsStandardUrl::Equals(nsIUrl* other)
|
||||||
{
|
{
|
||||||
PRBool eq = PR_FALSE;
|
PRBool eq = PR_FALSE;
|
||||||
if (other) {
|
if (other) {
|
||||||
// NS_LOCK_INSTANCE();
|
// NS_LOCK_INSTANCE();
|
||||||
nsUrl* otherUrl;
|
nsStandardUrl* otherUrl;
|
||||||
nsresult rv =
|
nsresult rv =
|
||||||
other->QueryInterface(kThisTypicalUrlImplementationCID,
|
other->QueryInterface(kThisStandardUrlImplementationCID,
|
||||||
(void**)&otherUrl);
|
(void**)&otherUrl);
|
||||||
if (NS_SUCCEEDED(rv)) {
|
if (NS_SUCCEEDED(rv)) {
|
||||||
eq = PRBool((0 == PL_strcmp(mScheme, otherUrl->mScheme)) &&
|
eq = PRBool((0 == PL_strcmp(mScheme, otherUrl->mScheme)) &&
|
||||||
@ -179,9 +174,9 @@ nsUrl::Equals(nsIUrl* other)
|
|||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsUrl::Clone(nsIUrl* *result)
|
nsStandardUrl::Clone(nsIUrl* *result)
|
||||||
{
|
{
|
||||||
nsUrl* url = new nsUrl(nsnull); // XXX outer?
|
nsStandardUrl* url = new nsStandardUrl(nsnull); // XXX outer?
|
||||||
if (url == nsnull)
|
if (url == nsnull)
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
url->mScheme = nsCRT::strdup(mScheme);
|
url->mScheme = nsCRT::strdup(mScheme);
|
||||||
@ -210,7 +205,7 @@ nsUrl::Clone(nsIUrl* *result)
|
|||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsUrl::ToNewCString(char* *result)
|
nsStandardUrl::ToNewCString(char* *result)
|
||||||
{
|
{
|
||||||
nsAutoString string;
|
nsAutoString string;
|
||||||
// NS_LOCK_INSTANCE();
|
// NS_LOCK_INSTANCE();
|
||||||
@ -257,7 +252,7 @@ nsUrl::ToNewCString(char* *result)
|
|||||||
// XXX don't bother with ref's
|
// XXX don't bother with ref's
|
||||||
// XXX null pointer checks are incomplete
|
// XXX null pointer checks are incomplete
|
||||||
nsresult
|
nsresult
|
||||||
nsUrl::Parse(const char* spec, nsIUrl* aBaseUrl)
|
nsStandardUrl::Parse(const char* spec, nsIUrl* aBaseUrl)
|
||||||
{
|
{
|
||||||
// XXX hack!
|
// XXX hack!
|
||||||
nsString specStr(spec);
|
nsString specStr(spec);
|
||||||
@ -550,7 +545,7 @@ nsUrl::Parse(const char* spec, nsIUrl* aBaseUrl)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsUrl::ReconstructSpec()
|
nsStandardUrl::ReconstructSpec()
|
||||||
{
|
{
|
||||||
PR_FREEIF(mSpec);
|
PR_FREEIF(mSpec);
|
||||||
|
|
@ -16,14 +16,14 @@
|
|||||||
* Reserved.
|
* Reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef nsUrl_h__
|
#ifndef nsStandardUrl_h__
|
||||||
#define nsUrl_h__
|
#define nsStandardUrl_h__
|
||||||
|
|
||||||
#include "nsIUrl.h"
|
#include "nsIUrl.h"
|
||||||
#include "nsAgg.h"
|
#include "nsAgg.h"
|
||||||
|
|
||||||
// XXX regenerate:
|
// XXX regenerate:
|
||||||
#define NS_THIS_TYPICALURL_IMPLEMENTATION_CID \
|
#define NS_THIS_STANDARDURL_IMPLEMENTATION_CID \
|
||||||
{ /* 905ed480-f11f-11d2-9322-000000000000 */ \
|
{ /* 905ed480-f11f-11d2-9322-000000000000 */ \
|
||||||
0x905ed480, \
|
0x905ed480, \
|
||||||
0xf11f, \
|
0xf11f, \
|
||||||
@ -31,7 +31,7 @@
|
|||||||
{0x93, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} \
|
{0x93, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} \
|
||||||
}
|
}
|
||||||
|
|
||||||
class nsUrl : public nsIUrl, public nsITypicalUrl
|
class nsStandardUrl : public nsIUrl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NS_DECL_AGGREGATED
|
NS_DECL_AGGREGATED
|
||||||
@ -39,6 +39,8 @@ public:
|
|||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
// nsIUrl methods:
|
// nsIUrl methods:
|
||||||
|
|
||||||
|
NS_IMETHOD Init(const char* spec, nsIUrl* baseUrl);
|
||||||
|
|
||||||
NS_IMETHOD GetScheme(const char* *result);
|
NS_IMETHOD GetScheme(const char* *result);
|
||||||
NS_IMETHOD SetScheme(const char* scheme);
|
NS_IMETHOD SetScheme(const char* scheme);
|
||||||
|
|
||||||
@ -60,15 +62,10 @@ public:
|
|||||||
NS_IMETHOD ToNewCString(char* *result);
|
NS_IMETHOD ToNewCString(char* *result);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
// nsITypicalUrl methods:
|
// nsStandardUrl methods:
|
||||||
|
|
||||||
NS_IMETHOD Init(const char* spec, nsIUrl* baseUrl);
|
nsStandardUrl(nsISupports* outer);
|
||||||
|
virtual ~nsStandardUrl();
|
||||||
////////////////////////////////////////////////////////////////////////////
|
|
||||||
// nsUrl methods:
|
|
||||||
|
|
||||||
nsUrl(nsISupports* outer);
|
|
||||||
virtual ~nsUrl();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
nsresult Parse(const char* spec, nsIUrl* aBaseUrl);
|
nsresult Parse(const char* spec, nsIUrl* aBaseUrl);
|
||||||
@ -85,4 +82,4 @@ protected:
|
|||||||
char* mSpec; // XXX go away
|
char* mSpec; // XXX go away
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // nsUrl_h__
|
#endif // nsStandardUrl_h__
|
@ -28,8 +28,8 @@
|
|||||||
static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
|
static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
|
||||||
static NS_DEFINE_CID(kNetServiceCID, NS_NETSERVICE_CID);
|
static NS_DEFINE_CID(kNetServiceCID, NS_NETSERVICE_CID);
|
||||||
static NS_DEFINE_CID(kFileTransportServiceCID, NS_FILETRANSPORTSERVICE_CID);
|
static NS_DEFINE_CID(kFileTransportServiceCID, NS_FILETRANSPORTSERVICE_CID);
|
||||||
static NS_DEFINE_CID(kTypicalUrlCID, NS_TYPICALURL_CID);
|
static NS_DEFINE_CID(kStandardUrlCID, NS_STANDARDURL_CID);
|
||||||
static NS_DEFINE_CID(kSocketTransportServiceCID, NS_SOCKETTRANSPORTSERVICE_CID);
|
static NS_DEFINE_CID(kSocketTransportServiceCID, NS_SOCKETTRANSPORTSERVICE_CID);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@ -118,11 +118,11 @@ nsNetFactory::CreateInstance(nsISupports *aOuter,
|
|||||||
}
|
}
|
||||||
inst = NS_STATIC_CAST(nsISocketTransportService*, trans);
|
inst = NS_STATIC_CAST(nsISocketTransportService*, trans);
|
||||||
}
|
}
|
||||||
else if (mClassID.Equals(kTypicalUrlCID)) {
|
else if (mClassID.Equals(kStandardUrlCID)) {
|
||||||
nsUrl* url = new nsUrl(aOuter);
|
nsStandardUrl* url = new nsStandardUrl(aOuter);
|
||||||
if (url == nsnull)
|
if (url == nsnull)
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
inst = NS_STATIC_CAST(nsITypicalUrl*, url);
|
inst = NS_STATIC_CAST(nsIUrl*, url);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return NS_ERROR_NO_INTERFACE;
|
return NS_ERROR_NO_INTERFACE;
|
||||||
@ -145,8 +145,6 @@ nsresult nsNetFactory::LockFactory(PRBool aLock)
|
|||||||
extern "C" PR_IMPLEMENT(nsresult)
|
extern "C" PR_IMPLEMENT(nsresult)
|
||||||
NSGetFactory(nsISupports* aServMgr,
|
NSGetFactory(nsISupports* aServMgr,
|
||||||
const nsCID &aClass,
|
const nsCID &aClass,
|
||||||
const char *aClassName,
|
|
||||||
const char *aProgID,
|
|
||||||
nsIFactory **aFactory)
|
nsIFactory **aFactory)
|
||||||
{
|
{
|
||||||
if (aFactory == nsnull)
|
if (aFactory == nsnull)
|
||||||
@ -187,9 +185,9 @@ NSRegisterSelf(nsISupports* aServMgr , const char* aPath)
|
|||||||
aPath, PR_TRUE, PR_TRUE);
|
aPath, PR_TRUE, PR_TRUE);
|
||||||
if (NS_FAILED(rv)) return rv;;
|
if (NS_FAILED(rv)) return rv;;
|
||||||
|
|
||||||
rv = compMgr->RegisterComponent(kTypicalUrlCID,
|
rv = compMgr->RegisterComponent(kStandardUrlCID,
|
||||||
"Typical URL Implementation",
|
"Standard URL Implementation",
|
||||||
"component://netscape/network/typcial-url",
|
"component://netscape/network/standard-url",
|
||||||
aPath, PR_TRUE, PR_TRUE);
|
aPath, PR_TRUE, PR_TRUE);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
@ -211,7 +209,7 @@ NSUnregisterSelf(nsISupports* aServMgr, const char* aPath)
|
|||||||
rv = compMgr->UnregisterComponent(kSocketTransportServiceCID, aPath);
|
rv = compMgr->UnregisterComponent(kSocketTransportServiceCID, aPath);
|
||||||
if (NS_FAILED(rv)) return rv;;
|
if (NS_FAILED(rv)) return rv;;
|
||||||
|
|
||||||
rv = compMgr->UnregisterComponent(kTypicalUrlCID, aPath);
|
rv = compMgr->UnregisterComponent(kStandardUrlCID, aPath);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,8 +104,6 @@ nsresult nsNetFactory::LockFactory(PRBool aLock)
|
|||||||
extern "C" PR_IMPLEMENT(nsresult)
|
extern "C" PR_IMPLEMENT(nsresult)
|
||||||
NSGetFactory(nsISupports* aServMgr,
|
NSGetFactory(nsISupports* aServMgr,
|
||||||
const nsCID &aClass,
|
const nsCID &aClass,
|
||||||
const char *aClassName,
|
|
||||||
const char *aProgID,
|
|
||||||
nsIFactory **aFactory)
|
nsIFactory **aFactory)
|
||||||
{
|
{
|
||||||
if (aFactory == nsnull)
|
if (aFactory == nsnull)
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#include "nsIComponentManager.h"
|
#include "nsIComponentManager.h"
|
||||||
#include "nsIServiceManager.h"
|
#include "nsIServiceManager.h"
|
||||||
|
|
||||||
static NS_DEFINE_CID(kTypicalUrlCID, NS_TYPICALURL_CID);
|
static NS_DEFINE_CID(kStandardUrlCID, NS_STANDARDURL_CID);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@ -79,12 +79,12 @@ nsFtpProtocolHandler::NewUrl(const char* aSpec,
|
|||||||
{
|
{
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
|
|
||||||
// Ftp URLs (currently) have no additional structure beyond that provided by typical
|
// Ftp URLs (currently) have no additional structure beyond that provided by standard
|
||||||
// URLs, so there is no "outer" given to CreateInstance
|
// URLs, so there is no "outer" given to CreateInstance
|
||||||
|
|
||||||
nsITypicalUrl* url;
|
nsIUrl* url;
|
||||||
rv = nsComponentManager::CreateInstance(kTypicalUrlCID, nsnull,
|
rv = nsComponentManager::CreateInstance(kStandardUrlCID, nsnull,
|
||||||
nsITypicalUrl::GetIID(),
|
nsIUrl::GetIID(),
|
||||||
(void**)&url);
|
(void**)&url);
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
|
@ -104,8 +104,6 @@ nsresult nsNetFactory::LockFactory(PRBool aLock)
|
|||||||
extern "C" PR_IMPLEMENT(nsresult)
|
extern "C" PR_IMPLEMENT(nsresult)
|
||||||
NSGetFactory(nsISupports* aServMgr,
|
NSGetFactory(nsISupports* aServMgr,
|
||||||
const nsCID &aClass,
|
const nsCID &aClass,
|
||||||
const char *aClassName,
|
|
||||||
const char *aProgID,
|
|
||||||
nsIFactory **aFactory)
|
nsIFactory **aFactory)
|
||||||
{
|
{
|
||||||
if (aFactory == nsnull)
|
if (aFactory == nsnull)
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
#include "nsITransport.h"
|
#include "nsITransport.h"
|
||||||
|
|
||||||
static NS_DEFINE_CID(kSocketTransportServiceCID, NS_SOCKETTRANSPORTSERVICE_CID);
|
static NS_DEFINE_CID(kSocketTransportServiceCID, NS_SOCKETTRANSPORTSERVICE_CID);
|
||||||
static NS_DEFINE_CID(kTypicalUrlCID, NS_TYPICALURL_CID);
|
static NS_DEFINE_CID(kStandardUrlCID, NS_STANDARDURL_CID);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@ -93,12 +93,12 @@ nsHttpProtocolHandler::NewUrl(const char* aSpec,
|
|||||||
{
|
{
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
|
|
||||||
// http URLs (currently) have no additional structure beyond that provided by typical
|
// http URLs (currently) have no additional structure beyond that provided by standard
|
||||||
// URLs, so there is no "outer" given to CreateInstance
|
// URLs, so there is no "outer" given to CreateInstance
|
||||||
|
|
||||||
nsITypicalUrl* url;
|
nsIUrl* url;
|
||||||
rv = nsComponentManager::CreateInstance(kTypicalUrlCID, nsnull,
|
rv = nsComponentManager::CreateInstance(kStandardUrlCID, nsnull,
|
||||||
nsITypicalUrl::GetIID(),
|
nsIUrl::GetIID(),
|
||||||
(void**)&url);
|
(void**)&url);
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user