| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * * Redistributions of source code must retain the above copyright | 7 * * Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * * Redistributions in binary form must reproduce the above copyright | 9 * * Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #ifndef WebSpeechRecognitionHandle_h | 26 #ifndef WebSpeechRecognitionHandle_h |
| 27 #define WebSpeechRecognitionHandle_h | 27 #define WebSpeechRecognitionHandle_h |
| 28 | 28 |
| 29 #include "../platform/WebCommon.h" | 29 #include "../platform/WebCommon.h" |
| 30 #include "../platform/WebPrivatePtr.h" | 30 #include "../platform/WebPrivatePtr.h" |
| 31 | 31 |
| 32 namespace blink { | 32 namespace blink { |
| 33 |
| 33 class SpeechRecognition; | 34 class SpeechRecognition; |
| 34 } | |
| 35 | |
| 36 namespace blink { | |
| 37 | |
| 38 class WebSpeechRecognitionResult; | 35 class WebSpeechRecognitionResult; |
| 39 class WebString; | 36 class WebString; |
| 40 | 37 |
| 41 // WebSpeechRecognitionHandle is used by WebSpeechRecognizer to identify a | 38 // WebSpeechRecognitionHandle is used by WebSpeechRecognizer to identify a |
| 42 // recognition session, and by WebSpeechRecognizerClient to route | 39 // recognition session, and by WebSpeechRecognizerClient to route |
| 43 // recognition events. | 40 // recognition events. |
| 44 class WebSpeechRecognitionHandle { | 41 class WebSpeechRecognitionHandle { |
| 45 public: | 42 public: |
| 46 ~WebSpeechRecognitionHandle() { reset(); } | 43 ~WebSpeechRecognitionHandle() { reset(); } |
| 47 WebSpeechRecognitionHandle() { } | 44 WebSpeechRecognitionHandle() { } |
| 48 | 45 |
| 49 WebSpeechRecognitionHandle(const WebSpeechRecognitionHandle& other) { assign
(other); } | 46 WebSpeechRecognitionHandle(const WebSpeechRecognitionHandle& other) { assign
(other); } |
| 50 WebSpeechRecognitionHandle& operator=(const WebSpeechRecognitionHandle& othe
r) | 47 WebSpeechRecognitionHandle& operator=(const WebSpeechRecognitionHandle& othe
r) |
| 51 { | 48 { |
| 52 assign(other); | 49 assign(other); |
| 53 return *this; | 50 return *this; |
| 54 } | 51 } |
| 55 | 52 |
| 56 BLINK_EXPORT void reset(); | 53 BLINK_EXPORT void reset(); |
| 57 BLINK_EXPORT void assign(const WebSpeechRecognitionHandle&); | 54 BLINK_EXPORT void assign(const WebSpeechRecognitionHandle&); |
| 58 | 55 |
| 59 // Comparison functions are provided so that WebSpeechRecognitionHandle obje
cts | 56 // Comparison functions are provided so that WebSpeechRecognitionHandle obje
cts |
| 60 // can be stored in a hash map. | 57 // can be stored in a hash map. |
| 61 BLINK_EXPORT bool equals(const WebSpeechRecognitionHandle&) const; | 58 BLINK_EXPORT bool equals(const WebSpeechRecognitionHandle&) const; |
| 62 BLINK_EXPORT bool lessThan(const WebSpeechRecognitionHandle&) const; | 59 BLINK_EXPORT bool lessThan(const WebSpeechRecognitionHandle&) const; |
| 63 | 60 |
| 64 #if BLINK_IMPLEMENTATION | 61 #if BLINK_IMPLEMENTATION |
| 65 explicit WebSpeechRecognitionHandle(blink::SpeechRecognition*); | 62 explicit WebSpeechRecognitionHandle(SpeechRecognition*); |
| 66 WebSpeechRecognitionHandle& operator=(blink::SpeechRecognition*); | 63 WebSpeechRecognitionHandle& operator=(SpeechRecognition*); |
| 67 operator blink::SpeechRecognition*() const; | 64 operator SpeechRecognition*() const; |
| 68 #endif | 65 #endif |
| 69 | 66 |
| 70 private: | 67 private: |
| 71 WebPrivatePtr<blink::SpeechRecognition> m_private; | 68 WebPrivatePtr<SpeechRecognition> m_private; |
| 72 }; | 69 }; |
| 73 | 70 |
| 74 inline bool operator==(const WebSpeechRecognitionHandle& a, const WebSpeechRecog
nitionHandle& b) | 71 inline bool operator==(const WebSpeechRecognitionHandle& a, const WebSpeechRecog
nitionHandle& b) |
| 75 { | 72 { |
| 76 return a.equals(b); | 73 return a.equals(b); |
| 77 } | 74 } |
| 78 | 75 |
| 79 inline bool operator!=(const WebSpeechRecognitionHandle& a, const WebSpeechRecog
nitionHandle& b) | 76 inline bool operator!=(const WebSpeechRecognitionHandle& a, const WebSpeechRecog
nitionHandle& b) |
| 80 { | 77 { |
| 81 return !(a == b); | 78 return !(a == b); |
| 82 } | 79 } |
| 83 | 80 |
| 84 inline bool operator<(const WebSpeechRecognitionHandle& a, const WebSpeechRecogn
itionHandle& b) | 81 inline bool operator<(const WebSpeechRecognitionHandle& a, const WebSpeechRecogn
itionHandle& b) |
| 85 { | 82 { |
| 86 return a.lessThan(b); | 83 return a.lessThan(b); |
| 87 } | 84 } |
| 88 | 85 |
| 89 } // namespace blink | 86 } // namespace blink |
| 90 | 87 |
| 91 #endif // WebSpeechRecognitionHandle_h | 88 #endif // WebSpeechRecognitionHandle_h |
| OLD | NEW |