2001-09-28 20:14:13 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-05-21 11:12:37 +00: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 07:52:52 +00:00
|
|
|
|
|
|
|
#ifndef nsSimpleURI_h__
|
|
|
|
#define nsSimpleURI_h__
|
|
|
|
|
2013-06-23 12:03:39 +00:00
|
|
|
#include "mozilla/MemoryReporting.h"
|
2013-09-22 03:04:57 +00:00
|
|
|
#include "nsIURI.h"
|
2001-07-31 19:05:34 +00:00
|
|
|
#include "nsISerializable.h"
|
2002-03-06 07:48:55 +00:00
|
|
|
#include "nsString.h"
|
2006-03-15 04:59:42 +00:00
|
|
|
#include "nsIClassInfo.h"
|
2006-05-02 18:54:19 +00:00
|
|
|
#include "nsIMutable.h"
|
2012-02-20 03:51:48 +00:00
|
|
|
#include "nsISizeOf.h"
|
2012-08-23 19:33:46 +00:00
|
|
|
#include "nsIIPCSerializableURI.h"
|
1999-07-01 07:52:52 +00:00
|
|
|
|
|
|
|
#define NS_THIS_SIMPLEURI_IMPLEMENTATION_CID \
|
2011-05-22 01:12:45 +00:00
|
|
|
{ /* 0b9bb0c2-fee6-470b-b9b9-9fd9462b5e19 */ \
|
|
|
|
0x0b9bb0c2, \
|
|
|
|
0xfee6, \
|
|
|
|
0x470b, \
|
|
|
|
{0xb9, 0xb9, 0x9f, 0xd9, 0x46, 0x2b, 0x5e, 0x19} \
|
1999-07-01 07:52:52 +00:00
|
|
|
}
|
|
|
|
|
2006-05-02 18:54:19 +00:00
|
|
|
class nsSimpleURI : public nsIURI,
|
|
|
|
public nsISerializable,
|
|
|
|
public nsIClassInfo,
|
2012-02-20 03:51:48 +00:00
|
|
|
public nsIMutable,
|
2012-08-23 19:33:46 +00:00
|
|
|
public nsISizeOf,
|
|
|
|
public nsIIPCSerializableURI
|
1999-07-01 07:52:52 +00:00
|
|
|
{
|
2014-06-24 16:36:44 +00:00
|
|
|
protected:
|
|
|
|
virtual ~nsSimpleURI();
|
|
|
|
|
1999-07-01 07:52:52 +00:00
|
|
|
public:
|
2010-06-12 20:40:05 +00:00
|
|
|
NS_DECL_ISUPPORTS
|
1999-10-12 01:39:37 +00:00
|
|
|
NS_DECL_NSIURI
|
2001-07-31 19:05:34 +00:00
|
|
|
NS_DECL_NSISERIALIZABLE
|
2005-06-29 21:03:24 +00:00
|
|
|
NS_DECL_NSICLASSINFO
|
2006-05-02 18:54:19 +00:00
|
|
|
NS_DECL_NSIMUTABLE
|
2012-08-23 19:33:46 +00:00
|
|
|
NS_DECL_NSIIPCSERIALIZABLEURI
|
1999-07-01 07:52:52 +00:00
|
|
|
|
|
|
|
// nsSimpleURI methods:
|
|
|
|
|
2010-06-12 20:40:05 +00:00
|
|
|
nsSimpleURI();
|
1999-07-01 07:52:52 +00:00
|
|
|
|
2012-02-20 03:51:48 +00: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
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override;
|
|
|
|
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override;
|
2012-02-20 03:51:48 +00:00
|
|
|
|
1999-07-01 07:52:52 +00:00
|
|
|
protected:
|
2011-05-22 01:12:45 +00:00
|
|
|
// enum used in a few places to specify how .ref attribute should be handled
|
|
|
|
enum RefHandlingEnum {
|
|
|
|
eIgnoreRef,
|
|
|
|
eHonorRef
|
|
|
|
};
|
|
|
|
|
2011-05-22 01:12:45 +00:00
|
|
|
// Helper to share code between Equals methods.
|
2011-05-22 01:12:45 +00:00
|
|
|
virtual nsresult EqualsInternal(nsIURI* other,
|
|
|
|
RefHandlingEnum refHandlingMode,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool* result);
|
2011-05-22 01:12:45 +00:00
|
|
|
|
2011-05-25 20:23:07 +00:00
|
|
|
// Helper to be used by inherited classes who want to test
|
2011-05-26 08:20:06 +00:00
|
|
|
// equality given an assumed nsSimpleURI. This must NOT check
|
2011-05-25 20:23:07 +00:00
|
|
|
// the passed-in other for QI to our CID.
|
|
|
|
bool EqualsInternal(nsSimpleURI* otherUri, RefHandlingEnum refHandlingMode);
|
|
|
|
|
2011-05-22 01:12:45 +00:00
|
|
|
// NOTE: This takes the refHandlingMode as an argument because
|
|
|
|
// nsSimpleNestedURI's specialized version needs to know how to clone
|
|
|
|
// its inner URI.
|
|
|
|
virtual nsSimpleURI* StartClone(RefHandlingEnum refHandlingMode);
|
2006-05-02 18:54:19 +00:00
|
|
|
|
2011-05-22 01:12:45 +00:00
|
|
|
// Helper to share code between Clone methods.
|
|
|
|
virtual nsresult CloneInternal(RefHandlingEnum refHandlingMode,
|
|
|
|
nsIURI** clone);
|
|
|
|
|
2002-03-06 07:48:55 +00:00
|
|
|
nsCString mScheme;
|
2011-05-22 01:12:45 +00: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 06:19:26 +00:00
|
|
|
bool mMutable;
|
|
|
|
bool mIsRefValid; // To distinguish between empty-ref and no-ref.
|
1999-07-01 07:52:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // nsSimpleURI_h__
|