netwerk/base/src/nsSimpleURI.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 #ifndef nsSimpleURI_h__
     7 #define nsSimpleURI_h__
     9 #include "mozilla/MemoryReporting.h"
    10 #include "nsIURI.h"
    11 #include "nsISerializable.h"
    12 #include "nsString.h"
    13 #include "nsIClassInfo.h"
    14 #include "nsIMutable.h"
    15 #include "nsISizeOf.h"
    16 #include "nsIIPCSerializableURI.h"
    18 #define NS_THIS_SIMPLEURI_IMPLEMENTATION_CID         \
    19 { /* 0b9bb0c2-fee6-470b-b9b9-9fd9462b5e19 */         \
    20     0x0b9bb0c2,                                      \
    21     0xfee6,                                          \
    22     0x470b,                                          \
    23     {0xb9, 0xb9, 0x9f, 0xd9, 0x46, 0x2b, 0x5e, 0x19} \
    24 }
    26 class nsSimpleURI : public nsIURI,
    27                     public nsISerializable,
    28                     public nsIClassInfo,
    29                     public nsIMutable,
    30                     public nsISizeOf,
    31                     public nsIIPCSerializableURI
    32 {
    33 public:
    34     NS_DECL_ISUPPORTS
    35     NS_DECL_NSIURI
    36     NS_DECL_NSISERIALIZABLE
    37     NS_DECL_NSICLASSINFO
    38     NS_DECL_NSIMUTABLE
    39     NS_DECL_NSIIPCSERIALIZABLEURI
    41     // nsSimpleURI methods:
    43     nsSimpleURI();
    44     virtual ~nsSimpleURI();
    46     // nsISizeOf
    47     // Among the sub-classes that inherit (directly or indirectly) from
    48     // nsSimpleURI, measurement of the following members may be added later if
    49     // DMD finds it is worthwhile:
    50     // - nsJSURI: mBaseURI
    51     // - nsSimpleNestedURI: mInnerURI
    52     // - nsBlobURI: mPrincipal
    53     virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
    54     virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
    56 protected:
    57     // enum used in a few places to specify how .ref attribute should be handled
    58     enum RefHandlingEnum {
    59         eIgnoreRef,
    60         eHonorRef
    61     };
    63     // Helper to share code between Equals methods.
    64     virtual nsresult EqualsInternal(nsIURI* other,
    65                                     RefHandlingEnum refHandlingMode,
    66                                     bool* result);
    68     // Helper to be used by inherited classes who want to test
    69     // equality given an assumed nsSimpleURI.  This must NOT check
    70     // the passed-in other for QI to our CID.
    71     bool EqualsInternal(nsSimpleURI* otherUri, RefHandlingEnum refHandlingMode);
    73     // NOTE: This takes the refHandlingMode as an argument because
    74     // nsSimpleNestedURI's specialized version needs to know how to clone
    75     // its inner URI.
    76     virtual nsSimpleURI* StartClone(RefHandlingEnum refHandlingMode);
    78     // Helper to share code between Clone methods.
    79     virtual nsresult CloneInternal(RefHandlingEnum refHandlingMode,
    80                                    nsIURI** clone);
    82     nsCString mScheme;
    83     nsCString mPath; // NOTE: mPath does not include ref, as an optimization
    84     nsCString mRef;  // so that URIs with different refs can share string data.
    85     bool mMutable;
    86     bool mIsRefValid; // To distinguish between empty-ref and no-ref.
    87 };
    89 #endif // nsSimpleURI_h__

mercurial