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 #include "mozilla/dom/PaymentAddress.h"
8 #include "mozilla/dom/PaymentAddressBinding.h"
10 namespace mozilla::dom
{
12 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(PaymentAddress
, mOwner
)
14 NS_IMPL_CYCLE_COLLECTING_ADDREF(PaymentAddress
)
15 NS_IMPL_CYCLE_COLLECTING_RELEASE(PaymentAddress
)
17 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(PaymentAddress
)
18 NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
19 NS_INTERFACE_MAP_ENTRY(nsISupports
)
22 PaymentAddress::PaymentAddress(
23 nsPIDOMWindowInner
* aWindow
, const nsAString
& aCountry
,
24 const nsTArray
<nsString
>& aAddressLine
, const nsAString
& aRegion
,
25 const nsAString
& aRegionCode
, const nsAString
& aCity
,
26 const nsAString
& aDependentLocality
, const nsAString
& aPostalCode
,
27 const nsAString
& aSortingCode
, const nsAString
& aOrganization
,
28 const nsAString
& aRecipient
, const nsAString
& aPhone
)
30 mAddressLine(aAddressLine
.Clone()),
32 mRegionCode(aRegionCode
),
34 mDependentLocality(aDependentLocality
),
35 mPostalCode(aPostalCode
),
36 mSortingCode(aSortingCode
),
37 mOrganization(aOrganization
),
38 mRecipient(aRecipient
),
42 void PaymentAddress::GetCountry(nsAString
& aRetVal
) const {
46 void PaymentAddress::GetAddressLine(nsTArray
<nsString
>& aRetVal
) const {
47 aRetVal
= mAddressLine
.Clone();
50 void PaymentAddress::GetRegion(nsAString
& aRetVal
) const { aRetVal
= mRegion
; }
52 void PaymentAddress::GetRegionCode(nsAString
& aRetVal
) const {
53 aRetVal
= mRegionCode
;
56 void PaymentAddress::GetCity(nsAString
& aRetVal
) const { aRetVal
= mCity
; }
58 void PaymentAddress::GetDependentLocality(nsAString
& aRetVal
) const {
59 aRetVal
= mDependentLocality
;
62 void PaymentAddress::GetPostalCode(nsAString
& aRetVal
) const {
63 aRetVal
= mPostalCode
;
66 void PaymentAddress::GetSortingCode(nsAString
& aRetVal
) const {
67 aRetVal
= mSortingCode
;
70 void PaymentAddress::GetOrganization(nsAString
& aRetVal
) const {
71 aRetVal
= mOrganization
;
74 void PaymentAddress::GetRecipient(nsAString
& aRetVal
) const {
78 void PaymentAddress::GetPhone(nsAString
& aRetVal
) const { aRetVal
= mPhone
; }
80 PaymentAddress::~PaymentAddress() = default;
82 JSObject
* PaymentAddress::WrapObject(JSContext
* aCx
,
83 JS::Handle
<JSObject
*> aGivenProto
) {
84 return PaymentAddress_Binding::Wrap(aCx
, this, aGivenProto
);
87 } // namespace mozilla::dom