content/media/webspeech/recognition/SpeechGrammarList.cpp

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/media/webspeech/recognition/SpeechGrammarList.cpp	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,91 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* vim:set ts=2 sw=2 sts=2 et cindent: */
     1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +#include "SpeechGrammarList.h"
    1.11 +
    1.12 +#include "mozilla/dom/SpeechGrammarListBinding.h"
    1.13 +#include "mozilla/ErrorResult.h"
    1.14 +
    1.15 +namespace mozilla {
    1.16 +namespace dom {
    1.17 +
    1.18 +NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_1(SpeechGrammarList, mParent)
    1.19 +NS_IMPL_CYCLE_COLLECTING_ADDREF(SpeechGrammarList)
    1.20 +NS_IMPL_CYCLE_COLLECTING_RELEASE(SpeechGrammarList)
    1.21 +NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(SpeechGrammarList)
    1.22 +  NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
    1.23 +  NS_INTERFACE_MAP_ENTRY(nsISupports)
    1.24 +NS_INTERFACE_MAP_END
    1.25 +
    1.26 +SpeechGrammarList::SpeechGrammarList(nsISupports* aParent)
    1.27 +  : mParent(aParent)
    1.28 +{
    1.29 +  SetIsDOMBinding();
    1.30 +}
    1.31 +
    1.32 +SpeechGrammarList::~SpeechGrammarList()
    1.33 +{
    1.34 +}
    1.35 +
    1.36 +SpeechGrammarList*
    1.37 +SpeechGrammarList::Constructor(const GlobalObject& aGlobal,
    1.38 +                               ErrorResult& aRv)
    1.39 +{
    1.40 +  return new SpeechGrammarList(aGlobal.GetAsSupports());
    1.41 +}
    1.42 +
    1.43 +JSObject*
    1.44 +SpeechGrammarList::WrapObject(JSContext* aCx)
    1.45 +{
    1.46 +  return SpeechGrammarListBinding::Wrap(aCx, this);
    1.47 +}
    1.48 +
    1.49 +nsISupports*
    1.50 +SpeechGrammarList::GetParentObject() const
    1.51 +{
    1.52 +  return mParent;
    1.53 +}
    1.54 +
    1.55 +uint32_t
    1.56 +SpeechGrammarList::Length() const
    1.57 +{
    1.58 +  return 0;
    1.59 +}
    1.60 +
    1.61 +already_AddRefed<SpeechGrammar>
    1.62 +SpeechGrammarList::Item(uint32_t aIndex, ErrorResult& aRv)
    1.63 +{
    1.64 +  aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
    1.65 +  return nullptr;
    1.66 +}
    1.67 +
    1.68 +void
    1.69 +SpeechGrammarList::AddFromURI(const nsAString& aSrc,
    1.70 +                              const Optional<float>& aWeight,
    1.71 +                              ErrorResult& aRv)
    1.72 +{
    1.73 +  aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
    1.74 +  return;
    1.75 +}
    1.76 +
    1.77 +void
    1.78 +SpeechGrammarList::AddFromString(const nsAString& aString,
    1.79 +                                 const Optional<float>& aWeight,
    1.80 +                                 ErrorResult& aRv)
    1.81 +{
    1.82 +  aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
    1.83 +  return;
    1.84 +}
    1.85 +
    1.86 +already_AddRefed<SpeechGrammar>
    1.87 +SpeechGrammarList::IndexedGetter(uint32_t aIndex, bool& aPresent,
    1.88 +                                 ErrorResult& aRv)
    1.89 +{
    1.90 +  aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
    1.91 +  return nullptr;
    1.92 +}
    1.93 +} // namespace dom
    1.94 +} // namespace mozilla

mercurial