Bug 1700051: part 26) Correct typo in comment of `mozInlineSpellWordUtil::BuildSoftTe...
[gecko.git] / dom / fetch / BodyExtractor.h
blobe612306d1d702df28c14e7c5c1d997f03a5fd37b
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_dom_BodyExtractor_h
8 #define mozilla_dom_BodyExtractor_h
10 #include "nsString.h"
12 class nsIInputStream;
13 class nsIGlobalObject;
15 namespace mozilla {
16 namespace dom {
18 class BodyExtractorBase {
19 public:
20 virtual nsresult GetAsStream(nsIInputStream** aResult,
21 uint64_t* aContentLength,
22 nsACString& aContentTypeWithCharset,
23 nsACString& aCharset) const = 0;
26 // The implementation versions of this template are:
27 // ArrayBuffer, ArrayBufferView, Blob, FormData,
28 // URLSearchParams, nsAString, Document, nsIInputStream.
29 template <typename Type>
30 class BodyExtractor final : public BodyExtractorBase {
31 Type* mBody;
33 public:
34 explicit BodyExtractor(Type* aBody) : mBody(aBody) {}
36 nsresult GetAsStream(nsIInputStream** aResult, uint64_t* aContentLength,
37 nsACString& aContentTypeWithCharset,
38 nsACString& aCharset) const override;
41 } // namespace dom
42 } // namespace mozilla
44 #endif // mozilla_dom_BodyExtractor_h