Bug 1845134 - Part 4: Update existing ui-icons to use the latest source from acorn...
[gecko.git] / netwerk / base / nsSimpleNestedURI.h
blob0887431421856a2e2adfe83737b7e943c3982cf1
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
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 /**
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.
12 #ifndef nsSimpleNestedURI_h__
13 #define nsSimpleNestedURI_h__
15 #include "nsCOMPtr.h"
16 #include "nsSimpleURI.h"
17 #include "nsINestedURI.h"
18 #include "nsIURIMutator.h"
20 namespace mozilla {
21 namespace net {
23 class nsSimpleNestedURI : public nsSimpleURI, public nsINestedURI {
24 protected:
25 nsSimpleNestedURI() = default;
26 explicit nsSimpleNestedURI(nsIURI* innerURI);
28 ~nsSimpleNestedURI() = default;
30 public:
31 NS_DECL_ISUPPORTS_INHERITED
32 NS_DECL_NSINESTEDURI
34 // Overrides for various methods nsSimpleURI implements follow.
36 // nsSimpleURI overrides
37 virtual nsresult EqualsInternal(nsIURI* other,
38 RefHandlingEnum refHandlingMode,
39 bool* result) override;
40 virtual nsSimpleURI* StartClone(RefHandlingEnum refHandlingMode,
41 const nsACString& newRef) override;
42 NS_IMETHOD Mutate(nsIURIMutator** _retval) override;
43 NS_IMETHOD_(void) Serialize(ipc::URIParams& aParams) override;
45 // nsISerializable overrides
46 NS_IMETHOD Read(nsIObjectInputStream* aStream) override;
47 NS_IMETHOD Write(nsIObjectOutputStream* aStream) override;
49 protected:
50 nsCOMPtr<nsIURI> mInnerURI;
52 nsresult SetPathQueryRef(const nsACString& aPathQueryRef) override;
53 nsresult SetQuery(const nsACString& aQuery) override;
54 nsresult SetRef(const nsACString& aRef) override;
55 bool Deserialize(const mozilla::ipc::URIParams&);
56 nsresult ReadPrivate(nsIObjectInputStream* stream);
58 public:
59 class Mutator final : public nsIURIMutator,
60 public BaseURIMutator<nsSimpleNestedURI>,
61 public nsISerializable,
62 public nsINestedURIMutator {
63 NS_DECL_ISUPPORTS
64 NS_FORWARD_SAFE_NSIURISETTERS_RET(mURI)
66 explicit Mutator() = default;
68 private:
69 virtual ~Mutator() = default;
71 [[nodiscard]] NS_IMETHOD Deserialize(
72 const mozilla::ipc::URIParams& aParams) override {
73 return InitFromIPCParams(aParams);
76 NS_IMETHOD
77 Write(nsIObjectOutputStream* aOutputStream) override {
78 return NS_ERROR_NOT_IMPLEMENTED;
81 [[nodiscard]] NS_IMETHOD Read(nsIObjectInputStream* aStream) override {
82 return InitFromInputStream(aStream);
85 [[nodiscard]] NS_IMETHOD Finalize(nsIURI** aURI) override {
86 mURI.forget(aURI);
87 return NS_OK;
90 [[nodiscard]] NS_IMETHOD SetSpec(const nsACString& aSpec,
91 nsIURIMutator** aMutator) override {
92 if (aMutator) {
93 NS_ADDREF(*aMutator = this);
95 return InitFromSpec(aSpec);
98 [[nodiscard]] NS_IMETHOD Init(nsIURI* innerURI) override {
99 mURI = new nsSimpleNestedURI(innerURI);
100 return NS_OK;
103 friend class nsSimpleNestedURI;
106 friend BaseURIMutator<nsSimpleNestedURI>;
109 } // namespace net
110 } // namespace mozilla
112 #endif /* nsSimpleNestedURI_h__ */