1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/netwerk/base/src/nsSimpleURI.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,89 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef nsSimpleURI_h__ 1.10 +#define nsSimpleURI_h__ 1.11 + 1.12 +#include "mozilla/MemoryReporting.h" 1.13 +#include "nsIURI.h" 1.14 +#include "nsISerializable.h" 1.15 +#include "nsString.h" 1.16 +#include "nsIClassInfo.h" 1.17 +#include "nsIMutable.h" 1.18 +#include "nsISizeOf.h" 1.19 +#include "nsIIPCSerializableURI.h" 1.20 + 1.21 +#define NS_THIS_SIMPLEURI_IMPLEMENTATION_CID \ 1.22 +{ /* 0b9bb0c2-fee6-470b-b9b9-9fd9462b5e19 */ \ 1.23 + 0x0b9bb0c2, \ 1.24 + 0xfee6, \ 1.25 + 0x470b, \ 1.26 + {0xb9, 0xb9, 0x9f, 0xd9, 0x46, 0x2b, 0x5e, 0x19} \ 1.27 +} 1.28 + 1.29 +class nsSimpleURI : public nsIURI, 1.30 + public nsISerializable, 1.31 + public nsIClassInfo, 1.32 + public nsIMutable, 1.33 + public nsISizeOf, 1.34 + public nsIIPCSerializableURI 1.35 +{ 1.36 +public: 1.37 + NS_DECL_ISUPPORTS 1.38 + NS_DECL_NSIURI 1.39 + NS_DECL_NSISERIALIZABLE 1.40 + NS_DECL_NSICLASSINFO 1.41 + NS_DECL_NSIMUTABLE 1.42 + NS_DECL_NSIIPCSERIALIZABLEURI 1.43 + 1.44 + // nsSimpleURI methods: 1.45 + 1.46 + nsSimpleURI(); 1.47 + virtual ~nsSimpleURI(); 1.48 + 1.49 + // nsISizeOf 1.50 + // Among the sub-classes that inherit (directly or indirectly) from 1.51 + // nsSimpleURI, measurement of the following members may be added later if 1.52 + // DMD finds it is worthwhile: 1.53 + // - nsJSURI: mBaseURI 1.54 + // - nsSimpleNestedURI: mInnerURI 1.55 + // - nsBlobURI: mPrincipal 1.56 + virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; 1.57 + virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; 1.58 + 1.59 +protected: 1.60 + // enum used in a few places to specify how .ref attribute should be handled 1.61 + enum RefHandlingEnum { 1.62 + eIgnoreRef, 1.63 + eHonorRef 1.64 + }; 1.65 + 1.66 + // Helper to share code between Equals methods. 1.67 + virtual nsresult EqualsInternal(nsIURI* other, 1.68 + RefHandlingEnum refHandlingMode, 1.69 + bool* result); 1.70 + 1.71 + // Helper to be used by inherited classes who want to test 1.72 + // equality given an assumed nsSimpleURI. This must NOT check 1.73 + // the passed-in other for QI to our CID. 1.74 + bool EqualsInternal(nsSimpleURI* otherUri, RefHandlingEnum refHandlingMode); 1.75 + 1.76 + // NOTE: This takes the refHandlingMode as an argument because 1.77 + // nsSimpleNestedURI's specialized version needs to know how to clone 1.78 + // its inner URI. 1.79 + virtual nsSimpleURI* StartClone(RefHandlingEnum refHandlingMode); 1.80 + 1.81 + // Helper to share code between Clone methods. 1.82 + virtual nsresult CloneInternal(RefHandlingEnum refHandlingMode, 1.83 + nsIURI** clone); 1.84 + 1.85 + nsCString mScheme; 1.86 + nsCString mPath; // NOTE: mPath does not include ref, as an optimization 1.87 + nsCString mRef; // so that URIs with different refs can share string data. 1.88 + bool mMutable; 1.89 + bool mIsRefValid; // To distinguish between empty-ref and no-ref. 1.90 +}; 1.91 + 1.92 +#endif // nsSimpleURI_h__