aboutsummaryrefslogtreecommitdiffstats
path: root/native/jni/src/gesture/impl/incremental_decoder_impl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'native/jni/src/gesture/impl/incremental_decoder_impl.cpp')
-rw-r--r--native/jni/src/gesture/impl/incremental_decoder_impl.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/native/jni/src/gesture/impl/incremental_decoder_impl.cpp b/native/jni/src/gesture/impl/incremental_decoder_impl.cpp
index b7e8b3bd1..f2b76ed26 100644
--- a/native/jni/src/gesture/impl/incremental_decoder_impl.cpp
+++ b/native/jni/src/gesture/impl/incremental_decoder_impl.cpp
@@ -15,7 +15,26 @@
*/
#include "incremental_decoder_impl.h"
+#include "incremental_decoder_interface.h"
namespace latinime {
+
+// A factory method for IncrementalDecoderImpl
+static IncrementalDecoderInterface *getDecoderInstance(int maxWordLength, int maxWords) {
+ return new IncrementalDecoderImpl(maxWordLength, maxWords);
+}
+
+// An ad-hoc internal class to register the factory method defined above
+class IncrementalDecoderFactoryRegisterer {
+ public:
+ IncrementalDecoderFactoryRegisterer() {
+ IncrementalDecoderInterface::setIncrementalDecoderFactoryMethod(getDecoderInstance);
+ }
+ private:
+ DISALLOW_COPY_AND_ASSIGN(IncrementalDecoderFactoryRegisterer);
};
-// namespace latinime
+
+// To invoke the IncrementalDecoderFactoryRegisterer constructor in the global constructor
+// Not sure, but can be static?
+IncrementalDecoderFactoryRegisterer incrementalDecoderFactoryRegisterer;
+} // namespace latinime