PaymentAddress.cpp (2807B)
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 #include "mozilla/dom/PaymentAddress.h" 8 9 #include "mozilla/dom/PaymentAddressBinding.h" 10 11 namespace mozilla::dom { 12 13 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(PaymentAddress, mOwner) 14 15 NS_IMPL_CYCLE_COLLECTING_ADDREF(PaymentAddress) 16 NS_IMPL_CYCLE_COLLECTING_RELEASE(PaymentAddress) 17 18 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(PaymentAddress) 19 NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY 20 NS_INTERFACE_MAP_ENTRY(nsISupports) 21 NS_INTERFACE_MAP_END 22 23 PaymentAddress::PaymentAddress( 24 nsPIDOMWindowInner* aWindow, const nsAString& aCountry, 25 const nsTArray<nsString>& aAddressLine, const nsAString& aRegion, 26 const nsAString& aRegionCode, const nsAString& aCity, 27 const nsAString& aDependentLocality, const nsAString& aPostalCode, 28 const nsAString& aSortingCode, const nsAString& aOrganization, 29 const nsAString& aRecipient, const nsAString& aPhone) 30 : mCountry(aCountry), 31 mAddressLine(aAddressLine.Clone()), 32 mRegion(aRegion), 33 mRegionCode(aRegionCode), 34 mCity(aCity), 35 mDependentLocality(aDependentLocality), 36 mPostalCode(aPostalCode), 37 mSortingCode(aSortingCode), 38 mOrganization(aOrganization), 39 mRecipient(aRecipient), 40 mPhone(aPhone), 41 mOwner(aWindow) {} 42 43 void PaymentAddress::GetCountry(nsAString& aRetVal) const { 44 aRetVal = mCountry; 45 } 46 47 void PaymentAddress::GetAddressLine(nsTArray<nsString>& aRetVal) const { 48 aRetVal = mAddressLine.Clone(); 49 } 50 51 void PaymentAddress::GetRegion(nsAString& aRetVal) const { aRetVal = mRegion; } 52 53 void PaymentAddress::GetRegionCode(nsAString& aRetVal) const { 54 aRetVal = mRegionCode; 55 } 56 57 void PaymentAddress::GetCity(nsAString& aRetVal) const { aRetVal = mCity; } 58 59 void PaymentAddress::GetDependentLocality(nsAString& aRetVal) const { 60 aRetVal = mDependentLocality; 61 } 62 63 void PaymentAddress::GetPostalCode(nsAString& aRetVal) const { 64 aRetVal = mPostalCode; 65 } 66 67 void PaymentAddress::GetSortingCode(nsAString& aRetVal) const { 68 aRetVal = mSortingCode; 69 } 70 71 void PaymentAddress::GetOrganization(nsAString& aRetVal) const { 72 aRetVal = mOrganization; 73 } 74 75 void PaymentAddress::GetRecipient(nsAString& aRetVal) const { 76 aRetVal = mRecipient; 77 } 78 79 void PaymentAddress::GetPhone(nsAString& aRetVal) const { aRetVal = mPhone; } 80 81 PaymentAddress::~PaymentAddress() = default; 82 83 JSObject* PaymentAddress::WrapObject(JSContext* aCx, 84 JS::Handle<JSObject*> aGivenProto) { 85 return PaymentAddress_Binding::Wrap(aCx, this, aGivenProto); 86 } 87 88 } // namespace mozilla::dom