SpeechRecognitionResult.h (1546B)
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_SpeechRecognitionResult_h 8 #define mozilla_dom_SpeechRecognitionResult_h 9 10 #include "SpeechRecognitionAlternative.h" 11 #include "js/TypeDecls.h" 12 #include "nsCOMPtr.h" 13 #include "nsCycleCollectionParticipant.h" 14 #include "nsTArray.h" 15 #include "nsWrapperCache.h" 16 17 namespace mozilla::dom { 18 19 class SpeechRecognitionResult final : public nsISupports, 20 public nsWrapperCache { 21 public: 22 explicit SpeechRecognitionResult(SpeechRecognition* aParent); 23 24 NS_DECL_CYCLE_COLLECTING_ISUPPORTS 25 NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(SpeechRecognitionResult) 26 27 nsISupports* GetParentObject() const; 28 29 JSObject* WrapObject(JSContext* aCx, 30 JS::Handle<JSObject*> aGivenProto) override; 31 32 uint32_t Length() const; 33 34 already_AddRefed<SpeechRecognitionAlternative> Item(uint32_t aIndex); 35 36 bool IsFinal() const; 37 38 already_AddRefed<SpeechRecognitionAlternative> IndexedGetter(uint32_t aIndex, 39 bool& aPresent); 40 41 nsTArray<RefPtr<SpeechRecognitionAlternative>> mItems; 42 43 private: 44 ~SpeechRecognitionResult(); 45 46 RefPtr<SpeechRecognition> mParent; 47 }; 48 49 } // namespace mozilla::dom 50 51 #endif