SpeechRecognitionAlternative.h (1321B)
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_SpeechRecognitionAlternative_h 8 #define mozilla_dom_SpeechRecognitionAlternative_h 9 10 #include "js/TypeDecls.h" 11 #include "nsCycleCollectionParticipant.h" 12 #include "nsString.h" 13 #include "nsWrapperCache.h" 14 15 namespace mozilla::dom { 16 17 class SpeechRecognition; 18 19 class SpeechRecognitionAlternative final : public nsISupports, 20 public nsWrapperCache { 21 public: 22 explicit SpeechRecognitionAlternative(SpeechRecognition* aParent); 23 24 NS_DECL_CYCLE_COLLECTING_ISUPPORTS 25 NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(SpeechRecognitionAlternative) 26 27 nsISupports* GetParentObject() const; 28 29 JSObject* WrapObject(JSContext* aCx, 30 JS::Handle<JSObject*> aGivenProto) override; 31 32 void GetTranscript(nsString& aRetVal) const; 33 34 float Confidence() const; 35 36 nsString mTranscript; 37 float mConfidence; 38 39 private: 40 ~SpeechRecognitionAlternative(); 41 42 RefPtr<SpeechRecognition> mParent; 43 }; 44 45 } // namespace mozilla::dom 46 47 #endif