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/. */
6 
7 #ifndef mozilla_dom_DeprecationReportBody_h
8 #define mozilla_dom_DeprecationReportBody_h
9 
10 #include "mozilla/dom/Nullable.h"
11 #include "mozilla/dom/ReportBody.h"
12 #include "nsString.h"
13 
14 namespace mozilla {
15 namespace dom {
16 
17 class DeprecationReportBody final : public ReportBody {
18  public:
19   DeprecationReportBody(nsIGlobalObject* aGlobal, const nsAString& aId,
20                         const Nullable<uint64_t>& aDate,
21                         const nsAString& aMessage, const nsAString& aSourceFile,
22                         const Nullable<uint32_t>& aLineNumber,
23                         const Nullable<uint32_t>& aColumnNumber);
24 
25   JSObject* WrapObject(JSContext* aCx,
26                        JS::Handle<JSObject*> aGivenProto) override;
27 
28   void GetId(nsAString& aId) const;
29 
30   Nullable<uint64_t> GetAnticipatedRemoval() const;
31 
32   void GetMessage(nsAString& aMessage) const;
33 
34   void GetSourceFile(nsAString& aSourceFile) const;
35 
36   Nullable<uint32_t> GetLineNumber() const;
37 
38   Nullable<uint32_t> GetColumnNumber() const;
39 
40  protected:
41   void ToJSON(JSONWriter& aJSONWriter) const override;
42 
43  private:
44   ~DeprecationReportBody();
45 
46   const nsString mId;
47   const Nullable<uint64_t> mDate;
48   const nsString mMessage;
49   const nsString mSourceFile;
50   const Nullable<uint32_t> mLineNumber;
51   const Nullable<uint32_t> mColumnNumber;
52 };
53 
54 }  // namespace dom
55 }  // namespace mozilla
56 
57 #endif  // mozilla_dom_DeprecationReportBody_h
58