Fri, 16 Jan 2015 04:50:19 +0100
Replace accessor implementation with direct member state manipulation, by
request https://trac.torproject.org/projects/tor/ticket/9701#comment:32
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* vim:set ts=2 sw=2 sts=2 et cindent: */ |
michael@0 | 3 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | #include "SpeechRecognitionAlternative.h" |
michael@0 | 8 | |
michael@0 | 9 | #include "mozilla/dom/SpeechRecognitionAlternativeBinding.h" |
michael@0 | 10 | |
michael@0 | 11 | #include "SpeechRecognition.h" |
michael@0 | 12 | |
michael@0 | 13 | namespace mozilla { |
michael@0 | 14 | namespace dom { |
michael@0 | 15 | |
michael@0 | 16 | NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_1(SpeechRecognitionAlternative, mParent) |
michael@0 | 17 | NS_IMPL_CYCLE_COLLECTING_ADDREF(SpeechRecognitionAlternative) |
michael@0 | 18 | NS_IMPL_CYCLE_COLLECTING_RELEASE(SpeechRecognitionAlternative) |
michael@0 | 19 | NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(SpeechRecognitionAlternative) |
michael@0 | 20 | NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY |
michael@0 | 21 | NS_INTERFACE_MAP_ENTRY(nsISupports) |
michael@0 | 22 | NS_INTERFACE_MAP_END |
michael@0 | 23 | |
michael@0 | 24 | SpeechRecognitionAlternative::SpeechRecognitionAlternative(SpeechRecognition* aParent) |
michael@0 | 25 | : mTranscript(NS_LITERAL_STRING("")) |
michael@0 | 26 | , mConfidence(0) |
michael@0 | 27 | , mParent(aParent) |
michael@0 | 28 | { |
michael@0 | 29 | SetIsDOMBinding(); |
michael@0 | 30 | } |
michael@0 | 31 | |
michael@0 | 32 | SpeechRecognitionAlternative::~SpeechRecognitionAlternative() |
michael@0 | 33 | { |
michael@0 | 34 | } |
michael@0 | 35 | |
michael@0 | 36 | JSObject* |
michael@0 | 37 | SpeechRecognitionAlternative::WrapObject(JSContext* aCx) |
michael@0 | 38 | { |
michael@0 | 39 | return SpeechRecognitionAlternativeBinding::Wrap(aCx, this); |
michael@0 | 40 | } |
michael@0 | 41 | |
michael@0 | 42 | nsISupports* |
michael@0 | 43 | SpeechRecognitionAlternative::GetParentObject() const |
michael@0 | 44 | { |
michael@0 | 45 | return static_cast<DOMEventTargetHelper*>(mParent.get()); |
michael@0 | 46 | } |
michael@0 | 47 | |
michael@0 | 48 | void |
michael@0 | 49 | SpeechRecognitionAlternative::GetTranscript(nsString& aRetVal) const |
michael@0 | 50 | { |
michael@0 | 51 | aRetVal = mTranscript; |
michael@0 | 52 | } |
michael@0 | 53 | |
michael@0 | 54 | float |
michael@0 | 55 | SpeechRecognitionAlternative::Confidence() const |
michael@0 | 56 | { |
michael@0 | 57 | return mConfidence; |
michael@0 | 58 | } |
michael@0 | 59 | } // namespace dom |
michael@0 | 60 | } // namespace mozilla |