content/media/webspeech/recognition/SpeechGrammarList.h

Fri, 16 Jan 2015 04:50:19 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 04:50:19 +0100
branch
TOR_BUG_9701
changeset 13
44a2da4a2ab2
permissions
-rw-r--r--

Replace accessor implementation with direct member state manipulation, by
request https://trac.torproject.org/projects/tor/ticket/9701#comment:32

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

mercurial