SpeechRecognitionResultList.h (1528B)
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim:set ts=2 sw=2 sts=2 et cindent: */ 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_SpeechRecognitionResultList_h 8 #define mozilla_dom_SpeechRecognitionResultList_h 9 10 #include "SpeechRecognitionResult.h" 11 #include "js/TypeDecls.h" 12 #include "nsCycleCollectionParticipant.h" 13 #include "nsTArray.h" 14 #include "nsWrapperCache.h" 15 16 namespace mozilla::dom { 17 18 class SpeechRecognition; 19 20 class SpeechRecognitionResultList final : public nsISupports, 21 public nsWrapperCache { 22 public: 23 explicit SpeechRecognitionResultList(SpeechRecognition* aParent); 24 25 NS_DECL_CYCLE_COLLECTING_ISUPPORTS 26 NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(SpeechRecognitionResultList) 27 28 nsISupports* GetParentObject() const; 29 30 JSObject* WrapObject(JSContext* aCx, 31 JS::Handle<JSObject*> aGivenProto) override; 32 33 uint32_t Length() const; 34 35 already_AddRefed<SpeechRecognitionResult> Item(uint32_t aIndex); 36 37 already_AddRefed<SpeechRecognitionResult> IndexedGetter(uint32_t aIndex, 38 bool& aPresent); 39 40 nsTArray<RefPtr<SpeechRecognitionResult>> mItems; 41 42 private: 43 ~SpeechRecognitionResultList(); 44 45 RefPtr<SpeechRecognition> mParent; 46 }; 47 48 } // namespace mozilla::dom 49 50 #endif