1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/netwerk/base/src/nsSimpleNestedURI.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,60 @@ 1.4 +/* -*- Mode: C++; tab-width: 4; 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 +/** 1.10 + * URI class to be used for cases when a simple URI actually resolves to some 1.11 + * other sort of URI, with the latter being what's loaded when the load 1.12 + * happens. All objects of this class should always be immutable, so that the 1.13 + * inner URI and this URI don't get out of sync. The Clone() implementation 1.14 + * will guarantee this for the clone, but it's up to the protocol handlers 1.15 + * creating these URIs to ensure that in the first place. The innerURI passed 1.16 + * to this URI will be set immutable if possible. 1.17 + */ 1.18 + 1.19 +#ifndef nsSimpleNestedURI_h__ 1.20 +#define nsSimpleNestedURI_h__ 1.21 + 1.22 +#include "nsCOMPtr.h" 1.23 +#include "nsSimpleURI.h" 1.24 +#include "nsINestedURI.h" 1.25 + 1.26 +class nsSimpleNestedURI : public nsSimpleURI, 1.27 + public nsINestedURI 1.28 +{ 1.29 +public: 1.30 + // To be used by deserialization only. Leaves this object in an 1.31 + // uninitialized state that will throw on most accesses. 1.32 + nsSimpleNestedURI() 1.33 + { 1.34 + } 1.35 + 1.36 + // Constructor that should generally be used when constructing an object of 1.37 + // this class with |operator new|. 1.38 + nsSimpleNestedURI(nsIURI* innerURI); 1.39 + 1.40 + NS_DECL_ISUPPORTS_INHERITED 1.41 + NS_DECL_NSINESTEDURI 1.42 + 1.43 + // Overrides for various methods nsSimpleURI implements follow. 1.44 + 1.45 + // nsSimpleURI overrides 1.46 + virtual nsresult EqualsInternal(nsIURI* other, 1.47 + RefHandlingEnum refHandlingMode, 1.48 + bool* result); 1.49 + virtual nsSimpleURI* StartClone(RefHandlingEnum refHandlingMode); 1.50 + 1.51 + // nsISerializable overrides 1.52 + NS_IMETHOD Read(nsIObjectInputStream* aStream); 1.53 + NS_IMETHOD Write(nsIObjectOutputStream* aStream); 1.54 + 1.55 + // Override the nsIClassInfo method GetClassIDNoAlloc to make sure our 1.56 + // nsISerializable impl works right. 1.57 + NS_IMETHOD GetClassIDNoAlloc(nsCID *aClassIDNoAlloc); 1.58 + 1.59 +protected: 1.60 + nsCOMPtr<nsIURI> mInnerURI; 1.61 +}; 1.62 + 1.63 +#endif /* nsSimpleNestedURI_h__ */