michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsSimpleURI_h__ michael@0: #define nsSimpleURI_h__ michael@0: michael@0: #include "mozilla/MemoryReporting.h" michael@0: #include "nsIURI.h" michael@0: #include "nsISerializable.h" michael@0: #include "nsString.h" michael@0: #include "nsIClassInfo.h" michael@0: #include "nsIMutable.h" michael@0: #include "nsISizeOf.h" michael@0: #include "nsIIPCSerializableURI.h" michael@0: michael@0: #define NS_THIS_SIMPLEURI_IMPLEMENTATION_CID \ michael@0: { /* 0b9bb0c2-fee6-470b-b9b9-9fd9462b5e19 */ \ michael@0: 0x0b9bb0c2, \ michael@0: 0xfee6, \ michael@0: 0x470b, \ michael@0: {0xb9, 0xb9, 0x9f, 0xd9, 0x46, 0x2b, 0x5e, 0x19} \ michael@0: } michael@0: michael@0: class nsSimpleURI : public nsIURI, michael@0: public nsISerializable, michael@0: public nsIClassInfo, michael@0: public nsIMutable, michael@0: public nsISizeOf, michael@0: public nsIIPCSerializableURI michael@0: { michael@0: public: michael@0: NS_DECL_ISUPPORTS michael@0: NS_DECL_NSIURI michael@0: NS_DECL_NSISERIALIZABLE michael@0: NS_DECL_NSICLASSINFO michael@0: NS_DECL_NSIMUTABLE michael@0: NS_DECL_NSIIPCSERIALIZABLEURI michael@0: michael@0: // nsSimpleURI methods: michael@0: michael@0: nsSimpleURI(); michael@0: virtual ~nsSimpleURI(); michael@0: michael@0: // nsISizeOf michael@0: // Among the sub-classes that inherit (directly or indirectly) from michael@0: // nsSimpleURI, measurement of the following members may be added later if michael@0: // DMD finds it is worthwhile: michael@0: // - nsJSURI: mBaseURI michael@0: // - nsSimpleNestedURI: mInnerURI michael@0: // - nsBlobURI: mPrincipal michael@0: virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; michael@0: virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; michael@0: michael@0: protected: michael@0: // enum used in a few places to specify how .ref attribute should be handled michael@0: enum RefHandlingEnum { michael@0: eIgnoreRef, michael@0: eHonorRef michael@0: }; michael@0: michael@0: // Helper to share code between Equals methods. michael@0: virtual nsresult EqualsInternal(nsIURI* other, michael@0: RefHandlingEnum refHandlingMode, michael@0: bool* result); michael@0: michael@0: // Helper to be used by inherited classes who want to test michael@0: // equality given an assumed nsSimpleURI. This must NOT check michael@0: // the passed-in other for QI to our CID. michael@0: bool EqualsInternal(nsSimpleURI* otherUri, RefHandlingEnum refHandlingMode); michael@0: michael@0: // NOTE: This takes the refHandlingMode as an argument because michael@0: // nsSimpleNestedURI's specialized version needs to know how to clone michael@0: // its inner URI. michael@0: virtual nsSimpleURI* StartClone(RefHandlingEnum refHandlingMode); michael@0: michael@0: // Helper to share code between Clone methods. michael@0: virtual nsresult CloneInternal(RefHandlingEnum refHandlingMode, michael@0: nsIURI** clone); michael@0: michael@0: nsCString mScheme; michael@0: nsCString mPath; // NOTE: mPath does not include ref, as an optimization michael@0: nsCString mRef; // so that URIs with different refs can share string data. michael@0: bool mMutable; michael@0: bool mIsRefValid; // To distinguish between empty-ref and no-ref. michael@0: }; michael@0: michael@0: #endif // nsSimpleURI_h__