|
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_SpeechGrammarList_h |
|
8 #define mozilla_dom_SpeechGrammarList_h |
|
9 |
|
10 #include "mozilla/Attributes.h" |
|
11 #include "nsCOMPtr.h" |
|
12 #include "nsCycleCollectionParticipant.h" |
|
13 #include "nsWrapperCache.h" |
|
14 |
|
15 struct JSContext; |
|
16 |
|
17 namespace mozilla { |
|
18 |
|
19 class ErrorResult; |
|
20 |
|
21 namespace dom { |
|
22 |
|
23 class GlobalObject; |
|
24 class SpeechGrammar; |
|
25 template<typename> class Optional; |
|
26 |
|
27 class SpeechGrammarList MOZ_FINAL : public nsISupports, |
|
28 public nsWrapperCache |
|
29 { |
|
30 public: |
|
31 SpeechGrammarList(nsISupports* aParent); |
|
32 ~SpeechGrammarList(); |
|
33 |
|
34 NS_DECL_CYCLE_COLLECTING_ISUPPORTS |
|
35 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(SpeechGrammarList) |
|
36 |
|
37 SpeechGrammarList* Constructor(const GlobalObject& aGlobal, |
|
38 ErrorResult& aRv); |
|
39 |
|
40 nsISupports* GetParentObject() const; |
|
41 |
|
42 virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE; |
|
43 |
|
44 uint32_t Length() const; |
|
45 |
|
46 already_AddRefed<SpeechGrammar> Item(uint32_t aIndex, ErrorResult& aRv); |
|
47 |
|
48 void AddFromURI(const nsAString& aSrc, const Optional<float>& aWeight, ErrorResult& aRv); |
|
49 |
|
50 void AddFromString(const nsAString& aString, const Optional<float>& aWeight, ErrorResult& aRv); |
|
51 |
|
52 already_AddRefed<SpeechGrammar> IndexedGetter(uint32_t aIndex, bool& aPresent, ErrorResult& aRv); |
|
53 |
|
54 private: |
|
55 nsCOMPtr<nsISupports> mParent; |
|
56 }; |
|
57 |
|
58 } // namespace dom |
|
59 } // namespace mozilla |
|
60 |
|
61 #endif |