2001-09-29 00:14:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
1999-07-01 11:52:52 +04:00
|
|
|
|
|
|
|
#ifndef nsSimpleURI_h__
|
|
|
|
#define nsSimpleURI_h__
|
|
|
|
|
2013-06-23 16:03:39 +04:00
|
|
|
#include "mozilla/MemoryReporting.h"
|
2013-09-22 07:04:57 +04:00
|
|
|
#include "nsIURI.h"
|
2001-07-31 23:05:34 +04:00
|
|
|
#include "nsISerializable.h"
|
2002-03-06 10:48:55 +03:00
|
|
|
#include "nsString.h"
|
2006-03-15 07:59:42 +03:00
|
|
|
#include "nsIClassInfo.h"
|
2006-05-02 22:54:19 +04:00
|
|
|
#include "nsIMutable.h"
|
2012-02-20 07:51:48 +04:00
|
|
|
#include "nsISizeOf.h"
|
2012-08-23 23:33:46 +04:00
|
|
|
#include "nsIIPCSerializableURI.h"
|
1999-07-01 11:52:52 +04:00
|
|
|
|
2016-05-19 05:02:57 +03:00
|
|
|
namespace mozilla {
|
|
|
|
namespace net {
|
|
|
|
|
1999-07-01 11:52:52 +04:00
|
|
|
#define NS_THIS_SIMPLEURI_IMPLEMENTATION_CID \
|
2011-05-22 05:12:45 +04:00
|
|
|
{ /* 0b9bb0c2-fee6-470b-b9b9-9fd9462b5e19 */ \
|
|
|
|
0x0b9bb0c2, \
|
|
|
|
0xfee6, \
|
|
|
|
0x470b, \
|
|
|
|
{0xb9, 0xb9, 0x9f, 0xd9, 0x46, 0x2b, 0x5e, 0x19} \
|
1999-07-01 11:52:52 +04:00
|
|
|
}
|
|
|
|
|
2006-05-02 22:54:19 +04:00
|
|
|
class nsSimpleURI : public nsIURI,
|
|
|
|
public nsISerializable,
|
|
|
|
public nsIClassInfo,
|
2012-02-20 07:51:48 +04:00
|
|
|
public nsIMutable,
|
2012-08-23 23:33:46 +04:00
|
|
|
public nsISizeOf,
|
|
|
|
public nsIIPCSerializableURI
|
1999-07-01 11:52:52 +04:00
|
|
|
{
|
2014-06-24 20:36:44 +04:00
|
|
|
protected:
|
|
|
|
virtual ~nsSimpleURI();
|
|
|
|
|
1999-07-01 11:52:52 +04:00
|
|
|
public:
|
2010-06-13 00:40:05 +04:00
|
|
|
NS_DECL_ISUPPORTS
|
1999-10-12 05:39:37 +04:00
|
|
|
NS_DECL_NSIURI
|
2001-07-31 23:05:34 +04:00
|
|
|
NS_DECL_NSISERIALIZABLE
|
2005-06-30 01:03:24 +04:00
|
|
|
NS_DECL_NSICLASSINFO
|
2006-05-02 22:54:19 +04:00
|
|
|
NS_DECL_NSIMUTABLE
|
2012-08-23 23:33:46 +04:00
|
|
|
NS_DECL_NSIIPCSERIALIZABLEURI
|
1999-07-01 11:52:52 +04:00
|
|
|
|
|
|
|
// nsSimpleURI methods:
|
|
|
|
|
2010-06-13 00:40:05 +04:00
|
|
|
nsSimpleURI();
|
1999-07-01 11:52:52 +04:00
|
|
|
|
2012-02-20 07:51:48 +04:00
|
|
|
// nsISizeOf
|
|
|
|
// Among the sub-classes that inherit (directly or indirectly) from
|
|
|
|
// nsSimpleURI, measurement of the following members may be added later if
|
|
|
|
// DMD finds it is worthwhile:
|
|
|
|
// - nsJSURI: mBaseURI
|
|
|
|
// - nsSimpleNestedURI: mInnerURI
|
|
|
|
// - nsBlobURI: mPrincipal
|
2016-05-19 05:02:57 +03:00
|
|
|
virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const override;
|
|
|
|
virtual size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const override;
|
2012-02-20 07:51:48 +04:00
|
|
|
|
1999-07-01 11:52:52 +04:00
|
|
|
protected:
|
2011-05-22 05:12:45 +04:00
|
|
|
// enum used in a few places to specify how .ref attribute should be handled
|
|
|
|
enum RefHandlingEnum {
|
|
|
|
eIgnoreRef,
|
2016-07-27 01:38:46 +03:00
|
|
|
eHonorRef,
|
|
|
|
eReplaceRef
|
2011-05-22 05:12:45 +04:00
|
|
|
};
|
|
|
|
|
2011-05-22 05:12:45 +04:00
|
|
|
// Helper to share code between Equals methods.
|
2011-05-22 05:12:45 +04:00
|
|
|
virtual nsresult EqualsInternal(nsIURI* other,
|
|
|
|
RefHandlingEnum refHandlingMode,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool* result);
|
2011-05-22 05:12:45 +04:00
|
|
|
|
2011-05-26 00:23:07 +04:00
|
|
|
// Helper to be used by inherited classes who want to test
|
2011-05-26 12:20:06 +04:00
|
|
|
// equality given an assumed nsSimpleURI. This must NOT check
|
2011-05-26 00:23:07 +04:00
|
|
|
// the passed-in other for QI to our CID.
|
|
|
|
bool EqualsInternal(nsSimpleURI* otherUri, RefHandlingEnum refHandlingMode);
|
|
|
|
|
2016-07-27 01:38:46 +03:00
|
|
|
// Used by StartClone (and versions of StartClone in subclasses) to
|
|
|
|
// handle the ref in the right way for clones.
|
|
|
|
void SetRefOnClone(nsSimpleURI* url, RefHandlingEnum refHandlingMode,
|
|
|
|
const nsACString& newRef);
|
|
|
|
|
2011-05-22 05:12:45 +04:00
|
|
|
// NOTE: This takes the refHandlingMode as an argument because
|
|
|
|
// nsSimpleNestedURI's specialized version needs to know how to clone
|
|
|
|
// its inner URI.
|
2016-07-27 01:38:46 +03:00
|
|
|
virtual nsSimpleURI* StartClone(RefHandlingEnum refHandlingMode,
|
|
|
|
const nsACString& newRef);
|
2006-05-02 22:54:19 +04:00
|
|
|
|
2011-05-22 05:12:45 +04:00
|
|
|
// Helper to share code between Clone methods.
|
|
|
|
virtual nsresult CloneInternal(RefHandlingEnum refHandlingMode,
|
2016-07-27 01:38:46 +03:00
|
|
|
const nsACString &newRef,
|
2011-05-22 05:12:45 +04:00
|
|
|
nsIURI** clone);
|
|
|
|
|
2002-03-06 10:48:55 +03:00
|
|
|
nsCString mScheme;
|
2011-05-22 05:12:45 +04:00
|
|
|
nsCString mPath; // NOTE: mPath does not include ref, as an optimization
|
|
|
|
nsCString mRef; // so that URIs with different refs can share string data.
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mMutable;
|
|
|
|
bool mIsRefValid; // To distinguish between empty-ref and no-ref.
|
1999-07-01 11:52:52 +04:00
|
|
|
};
|
|
|
|
|
2016-05-19 05:02:57 +03:00
|
|
|
} // namespace net
|
|
|
|
} // namespace mozilla
|
|
|
|
|
1999-07-01 11:52:52 +04:00
|
|
|
#endif // nsSimpleURI_h__
|