modules/libjar/nsJARURI.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/modules/libjar/nsJARURI.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,90 @@
     1.4 +/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
     1.5 + *
     1.6 + * This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +#ifndef nsJARURI_h__
    1.11 +#define nsJARURI_h__
    1.12 +
    1.13 +#include "nsIJARURI.h"
    1.14 +#include "nsISerializable.h"
    1.15 +#include "nsIClassInfo.h"
    1.16 +#include "nsCOMPtr.h"
    1.17 +#include "nsString.h"
    1.18 +#include "nsINestedURI.h"
    1.19 +#include "nsIIPCSerializableURI.h"
    1.20 +
    1.21 +#define NS_THIS_JARURI_IMPL_CID                      \
    1.22 +{ /* 9a55f629-730b-4d08-b75b-fa7d9570a691 */         \
    1.23 +    0x9a55f629,                                      \
    1.24 +    0x730b,                                          \
    1.25 +    0x4d08,                                          \
    1.26 +    {0xb7, 0x5b, 0xfa, 0x7d, 0x95, 0x70, 0xa6, 0x91} \
    1.27 +}
    1.28 +
    1.29 +#define NS_JARURI_CID                                \
    1.30 +{ /* 245abae2-b947-4ded-a46d-9829d3cca462 */         \
    1.31 +    0x245abae2,                                      \
    1.32 +    0xb947,                                          \
    1.33 +    0x4ded,                                          \
    1.34 +    {0xa4, 0x6d, 0x98, 0x29, 0xd3, 0xcc, 0xa4, 0x62} \
    1.35 +}
    1.36 +
    1.37 +
    1.38 +class nsJARURI : public nsIJARURI,
    1.39 +                 public nsISerializable,
    1.40 +                 public nsIClassInfo,
    1.41 +                 public nsINestedURI,
    1.42 +                 public nsIIPCSerializableURI
    1.43 +{
    1.44 +public:
    1.45 +    NS_DECL_THREADSAFE_ISUPPORTS
    1.46 +    NS_DECL_NSIURI
    1.47 +    NS_DECL_NSIURL
    1.48 +    NS_DECL_NSIJARURI
    1.49 +    NS_DECL_NSISERIALIZABLE
    1.50 +    NS_DECL_NSICLASSINFO
    1.51 +    NS_DECL_NSINESTEDURI
    1.52 +    NS_DECL_NSIIPCSERIALIZABLEURI
    1.53 +
    1.54 +    NS_DECLARE_STATIC_IID_ACCESSOR(NS_THIS_JARURI_IMPL_CID)
    1.55 +
    1.56 +    // nsJARURI
    1.57 +    nsJARURI();
    1.58 +    virtual ~nsJARURI();
    1.59 +   
    1.60 +    nsresult Init(const char *charsetHint);
    1.61 +    nsresult FormatSpec(const nsACString &entryPath, nsACString &result,
    1.62 +                        bool aIncludeScheme = true);
    1.63 +    nsresult CreateEntryURL(const nsACString& entryFilename,
    1.64 +                            const char* charset,
    1.65 +                            nsIURL** url);
    1.66 +    nsresult SetSpecWithBase(const nsACString& aSpec, nsIURI* aBaseURL);
    1.67 +
    1.68 +protected:
    1.69 +    // enum used in a few places to specify how .ref attribute should be handled
    1.70 +    enum RefHandlingEnum {
    1.71 +        eIgnoreRef,
    1.72 +        eHonorRef
    1.73 +    };
    1.74 +
    1.75 +    // Helper to share code between Equals methods.
    1.76 +    virtual nsresult EqualsInternal(nsIURI* other,
    1.77 +                                    RefHandlingEnum refHandlingMode,
    1.78 +                                    bool* result);
    1.79 +
    1.80 +    // Helper to share code between Clone methods.
    1.81 +    nsresult CloneWithJARFileInternal(nsIURI *jarFile,
    1.82 +                                      RefHandlingEnum refHandlingMode,
    1.83 +                                      nsIJARURI **result);
    1.84 +    nsCOMPtr<nsIURI> mJARFile;
    1.85 +    // mJarEntry stored as a URL so that we can easily access things
    1.86 +    // like extensions, refs, etc.
    1.87 +    nsCOMPtr<nsIURL> mJAREntry;
    1.88 +    nsCString        mCharsetHint;
    1.89 +};
    1.90 +
    1.91 +NS_DEFINE_STATIC_IID_ACCESSOR(nsJARURI, NS_THIS_JARURI_IMPL_CID)
    1.92 +
    1.93 +#endif // nsJARURI_h__

mercurial