From 66ee6fdde46bb9c246f7912fcc38d0883f66f961 Mon Sep 17 00:00:00 2001 From: JustOff Date: Wed, 13 Mar 2019 20:13:17 +0200 Subject: Rename MozMap.h to Record.h --- dom/bindings/Record.h | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 dom/bindings/Record.h (limited to 'dom/bindings/Record.h') diff --git a/dom/bindings/Record.h b/dom/bindings/Record.h new file mode 100644 index 000000000..2fe18be2b --- /dev/null +++ b/dom/bindings/Record.h @@ -0,0 +1,80 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/** + * Class for representing record arguments. Basically an array under the hood. + */ + +#ifndef mozilla_dom_Record_h +#define mozilla_dom_Record_h + +#include "nsTHashtable.h" +#include "nsHashKeys.h" +#include "nsStringGlue.h" +#include "nsTArray.h" +#include "mozilla/Attributes.h" +#include "mozilla/Move.h" + +namespace mozilla { +namespace dom { + +namespace binding_detail { +template +class RecordEntry +{ +public: + RecordEntry() + { + } + + // Move constructor so we can do Records of Records. + RecordEntry(RecordEntry&& aOther) + : mKey(Move(aOther.mKey)), + mValue(Move(aOther.mValue)) + { + } + + KeyType mKey; + ValueType mValue; +}; + +} // namespace binding_detail + +template +class Record +{ +public: + typedef typename binding_detail::RecordEntry EntryType; + typedef Record SelfType; + + Record() + { + } + + // Move constructor so we can do Record of Record. + Record(SelfType&& aOther) : + mEntries(Move(aOther.mEntries)) + { + } + + const nsTArray& Entries() const + { + return mEntries; + } + + nsTArray& Entries() + { + return mEntries; + } + +private: + nsTArray mEntries; +}; + +} // namespace dom +} // namespace mozilla + +#endif // mozilla_dom_Record_h -- cgit v1.2.3