Bug 1945643 - Update to mozilla-nimbus-schemas 2025.1.1 r=chumphreys
[gecko.git] / dom / media / webspeech / recognition / SpeechRecognitionResult.h
blobfc9e8fd6602664c7d174aebcba74223e52541c2c
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/. */
7 #ifndef mozilla_dom_SpeechRecognitionResult_h
8 #define mozilla_dom_SpeechRecognitionResult_h
10 #include "nsCOMPtr.h"
11 #include "nsCycleCollectionParticipant.h"
12 #include "nsWrapperCache.h"
13 #include "nsTArray.h"
14 #include "js/TypeDecls.h"
16 #include "mozilla/Attributes.h"
18 #include "SpeechRecognitionAlternative.h"
20 namespace mozilla::dom {
22 class SpeechRecognitionResult final : public nsISupports,
23 public nsWrapperCache {
24 public:
25 explicit SpeechRecognitionResult(SpeechRecognition* aParent);
27 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
28 NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(SpeechRecognitionResult)
30 nsISupports* GetParentObject() const;
32 JSObject* WrapObject(JSContext* aCx,
33 JS::Handle<JSObject*> aGivenProto) override;
35 uint32_t Length() const;
37 already_AddRefed<SpeechRecognitionAlternative> Item(uint32_t aIndex);
39 bool IsFinal() const;
41 already_AddRefed<SpeechRecognitionAlternative> IndexedGetter(uint32_t aIndex,
42 bool& aPresent);
44 nsTArray<RefPtr<SpeechRecognitionAlternative>> mItems;
46 private:
47 ~SpeechRecognitionResult();
49 RefPtr<SpeechRecognition> mParent;
52 } // namespace mozilla::dom
54 #endif