1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /* ***** BEGIN LICENSE BLOCK *****
3 : * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 : *
5 : * The contents of this file are subject to the Mozilla Public License Version
6 : * 1.1 (the "License"); you may not use this file except in compliance with
7 : * the License. You may obtain a copy of the License at
8 : * http://www.mozilla.org/MPL/
9 : *
10 : * Software distributed under the License is distributed on an "AS IS" basis,
11 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 : * for the specific language governing rights and limitations under the
13 : * License.
14 : *
15 : * The Original Code is mozilla.org code.
16 : *
17 : * The Initial Developer of the Original Code is
18 : * the Mozilla Corporation.
19 : * Portions created by the Initial Developer are Copyright (C) 2006
20 : * the Initial Developer. All Rights Reserved.
21 : *
22 : * Contributor(s):
23 : * Boris Zbarsky <bzbarsky@mit.edu> (Original author)
24 : *
25 : * Alternatively, the contents of this file may be used under the terms of
26 : * either of the GNU General Public License Version 2 or later (the "GPL"),
27 : * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 : * in which case the provisions of the GPL or the LGPL are applicable instead
29 : * of those above. If you wish to allow use of your version of this file only
30 : * under the terms of either the GPL or the LGPL, and not to allow others to
31 : * use your version of this file under the terms of the MPL, indicate your
32 : * decision by deleting the provisions above and replace them with the notice
33 : * and other provisions required by the GPL or the LGPL. If you do not delete
34 : * the provisions above, a recipient may use your version of this file under
35 : * the terms of any one of the MPL, the GPL or the LGPL.
36 : *
37 : * ***** END LICENSE BLOCK ***** */
38 :
39 : /**
40 : * URI class to be used for cases when a simple URI actually resolves to some
41 : * other sort of URI, with the latter being what's loaded when the load
42 : * happens. All objects of this class should always be immutable, so that the
43 : * inner URI and this URI don't get out of sync. The Clone() implementation
44 : * will guarantee this for the clone, but it's up to the protocol handlers
45 : * creating these URIs to ensure that in the first place. The innerURI passed
46 : * to this URI will be set immutable if possible.
47 : */
48 :
49 : #ifndef nsSimpleNestedURI_h__
50 : #define nsSimpleNestedURI_h__
51 :
52 : #include "nsCOMPtr.h"
53 : #include "nsSimpleURI.h"
54 : #include "nsINestedURI.h"
55 :
56 : class nsSimpleNestedURI : public nsSimpleURI,
57 : public nsINestedURI
58 1518 : {
59 : public:
60 : // To be used by deserialization only. Leaves this object in an
61 : // uninitialized state that will throw on most accesses.
62 1 : nsSimpleNestedURI()
63 1 : {
64 1 : }
65 :
66 : // Constructor that should generally be used when constructing an object of
67 : // this class with |operator new|.
68 : nsSimpleNestedURI(nsIURI* innerURI);
69 :
70 : NS_DECL_ISUPPORTS_INHERITED
71 : NS_DECL_NSINESTEDURI
72 : NS_DECL_NSIIPCSERIALIZABLE
73 :
74 : // Overrides for various methods nsSimpleURI implements follow.
75 :
76 : // nsSimpleURI overrides
77 : virtual nsresult EqualsInternal(nsIURI* other,
78 : RefHandlingEnum refHandlingMode,
79 : bool* result);
80 : virtual nsSimpleURI* StartClone(RefHandlingEnum refHandlingMode);
81 :
82 : // nsISerializable overrides
83 : NS_IMETHOD Read(nsIObjectInputStream* aStream);
84 : NS_IMETHOD Write(nsIObjectOutputStream* aStream);
85 :
86 : // Override the nsIClassInfo method GetClassIDNoAlloc to make sure our
87 : // nsISerializable impl works right.
88 : NS_IMETHOD GetClassIDNoAlloc(nsCID *aClassIDNoAlloc);
89 :
90 : protected:
91 : nsCOMPtr<nsIURI> mInnerURI;
92 : };
93 :
94 : #endif /* nsSimpleNestedURI_h__ */
|