michael@0: /* -*- Mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- michael@0: * 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 nsJARURI_h__ michael@0: #define nsJARURI_h__ michael@0: michael@0: #include "nsIJARURI.h" michael@0: #include "nsISerializable.h" michael@0: #include "nsIClassInfo.h" michael@0: #include "nsCOMPtr.h" michael@0: #include "nsString.h" michael@0: #include "nsINestedURI.h" michael@0: #include "nsIIPCSerializableURI.h" michael@0: michael@0: #define NS_THIS_JARURI_IMPL_CID \ michael@0: { /* 9a55f629-730b-4d08-b75b-fa7d9570a691 */ \ michael@0: 0x9a55f629, \ michael@0: 0x730b, \ michael@0: 0x4d08, \ michael@0: {0xb7, 0x5b, 0xfa, 0x7d, 0x95, 0x70, 0xa6, 0x91} \ michael@0: } michael@0: michael@0: #define NS_JARURI_CID \ michael@0: { /* 245abae2-b947-4ded-a46d-9829d3cca462 */ \ michael@0: 0x245abae2, \ michael@0: 0xb947, \ michael@0: 0x4ded, \ michael@0: {0xa4, 0x6d, 0x98, 0x29, 0xd3, 0xcc, 0xa4, 0x62} \ michael@0: } michael@0: michael@0: michael@0: class nsJARURI : public nsIJARURI, michael@0: public nsISerializable, michael@0: public nsIClassInfo, michael@0: public nsINestedURI, michael@0: public nsIIPCSerializableURI michael@0: { michael@0: public: michael@0: NS_DECL_THREADSAFE_ISUPPORTS michael@0: NS_DECL_NSIURI michael@0: NS_DECL_NSIURL michael@0: NS_DECL_NSIJARURI michael@0: NS_DECL_NSISERIALIZABLE michael@0: NS_DECL_NSICLASSINFO michael@0: NS_DECL_NSINESTEDURI michael@0: NS_DECL_NSIIPCSERIALIZABLEURI michael@0: michael@0: NS_DECLARE_STATIC_IID_ACCESSOR(NS_THIS_JARURI_IMPL_CID) michael@0: michael@0: // nsJARURI michael@0: nsJARURI(); michael@0: virtual ~nsJARURI(); michael@0: michael@0: nsresult Init(const char *charsetHint); michael@0: nsresult FormatSpec(const nsACString &entryPath, nsACString &result, michael@0: bool aIncludeScheme = true); michael@0: nsresult CreateEntryURL(const nsACString& entryFilename, michael@0: const char* charset, michael@0: nsIURL** url); michael@0: nsresult SetSpecWithBase(const nsACString& aSpec, nsIURI* aBaseURL); 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 share code between Clone methods. michael@0: nsresult CloneWithJARFileInternal(nsIURI *jarFile, michael@0: RefHandlingEnum refHandlingMode, michael@0: nsIJARURI **result); michael@0: nsCOMPtr mJARFile; michael@0: // mJarEntry stored as a URL so that we can easily access things michael@0: // like extensions, refs, etc. michael@0: nsCOMPtr mJAREntry; michael@0: nsCString mCharsetHint; michael@0: }; michael@0: michael@0: NS_DEFINE_STATIC_IID_ACCESSOR(nsJARURI, NS_THIS_JARURI_IMPL_CID) michael@0: michael@0: #endif // nsJARURI_h__