|
1 /* -*- Mode: C++; tab-width: 4; 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/. */ |
|
5 |
|
6 /** |
|
7 * URI class to be used for cases when a simple URI actually resolves to some |
|
8 * other sort of URI, with the latter being what's loaded when the load |
|
9 * happens. All objects of this class should always be immutable, so that the |
|
10 * inner URI and this URI don't get out of sync. The Clone() implementation |
|
11 * will guarantee this for the clone, but it's up to the protocol handlers |
|
12 * creating these URIs to ensure that in the first place. The innerURI passed |
|
13 * to this URI will be set immutable if possible. |
|
14 */ |
|
15 |
|
16 #ifndef nsSimpleNestedURI_h__ |
|
17 #define nsSimpleNestedURI_h__ |
|
18 |
|
19 #include "nsCOMPtr.h" |
|
20 #include "nsSimpleURI.h" |
|
21 #include "nsINestedURI.h" |
|
22 |
|
23 class nsSimpleNestedURI : public nsSimpleURI, |
|
24 public nsINestedURI |
|
25 { |
|
26 public: |
|
27 // To be used by deserialization only. Leaves this object in an |
|
28 // uninitialized state that will throw on most accesses. |
|
29 nsSimpleNestedURI() |
|
30 { |
|
31 } |
|
32 |
|
33 // Constructor that should generally be used when constructing an object of |
|
34 // this class with |operator new|. |
|
35 nsSimpleNestedURI(nsIURI* innerURI); |
|
36 |
|
37 NS_DECL_ISUPPORTS_INHERITED |
|
38 NS_DECL_NSINESTEDURI |
|
39 |
|
40 // Overrides for various methods nsSimpleURI implements follow. |
|
41 |
|
42 // nsSimpleURI overrides |
|
43 virtual nsresult EqualsInternal(nsIURI* other, |
|
44 RefHandlingEnum refHandlingMode, |
|
45 bool* result); |
|
46 virtual nsSimpleURI* StartClone(RefHandlingEnum refHandlingMode); |
|
47 |
|
48 // nsISerializable overrides |
|
49 NS_IMETHOD Read(nsIObjectInputStream* aStream); |
|
50 NS_IMETHOD Write(nsIObjectOutputStream* aStream); |
|
51 |
|
52 // Override the nsIClassInfo method GetClassIDNoAlloc to make sure our |
|
53 // nsISerializable impl works right. |
|
54 NS_IMETHOD GetClassIDNoAlloc(nsCID *aClassIDNoAlloc); |
|
55 |
|
56 protected: |
|
57 nsCOMPtr<nsIURI> mInnerURI; |
|
58 }; |
|
59 |
|
60 #endif /* nsSimpleNestedURI_h__ */ |