content/media/webspeech/recognition/SpeechRecognitionAlternative.cpp

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/media/webspeech/recognition/SpeechRecognitionAlternative.cpp	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,60 @@
     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 "SpeechRecognitionAlternative.h"
    1.11 +
    1.12 +#include "mozilla/dom/SpeechRecognitionAlternativeBinding.h"
    1.13 +
    1.14 +#include "SpeechRecognition.h"
    1.15 +
    1.16 +namespace mozilla {
    1.17 +namespace dom {
    1.18 +
    1.19 +NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_1(SpeechRecognitionAlternative, mParent)
    1.20 +NS_IMPL_CYCLE_COLLECTING_ADDREF(SpeechRecognitionAlternative)
    1.21 +NS_IMPL_CYCLE_COLLECTING_RELEASE(SpeechRecognitionAlternative)
    1.22 +NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(SpeechRecognitionAlternative)
    1.23 +  NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
    1.24 +  NS_INTERFACE_MAP_ENTRY(nsISupports)
    1.25 +NS_INTERFACE_MAP_END
    1.26 +
    1.27 +SpeechRecognitionAlternative::SpeechRecognitionAlternative(SpeechRecognition* aParent)
    1.28 +  : mTranscript(NS_LITERAL_STRING(""))
    1.29 +  , mConfidence(0)
    1.30 +  , mParent(aParent)
    1.31 +{
    1.32 +  SetIsDOMBinding();
    1.33 +}
    1.34 +
    1.35 +SpeechRecognitionAlternative::~SpeechRecognitionAlternative()
    1.36 +{
    1.37 +}
    1.38 +
    1.39 +JSObject*
    1.40 +SpeechRecognitionAlternative::WrapObject(JSContext* aCx)
    1.41 +{
    1.42 +  return SpeechRecognitionAlternativeBinding::Wrap(aCx, this);
    1.43 +}
    1.44 +
    1.45 +nsISupports*
    1.46 +SpeechRecognitionAlternative::GetParentObject() const
    1.47 +{
    1.48 +  return static_cast<DOMEventTargetHelper*>(mParent.get());
    1.49 +}
    1.50 +
    1.51 +void
    1.52 +SpeechRecognitionAlternative::GetTranscript(nsString& aRetVal) const
    1.53 +{
    1.54 +  aRetVal = mTranscript;
    1.55 +}
    1.56 +
    1.57 +float
    1.58 +SpeechRecognitionAlternative::Confidence() const
    1.59 +{
    1.60 +  return mConfidence;
    1.61 +}
    1.62 +} // namespace dom
    1.63 +} // namespace mozilla

mercurial