From 8658e552f350167bb8f5af7b9e991775f2cc6a6d Mon Sep 17 00:00:00 2001 From: Ken Wakasa Date: Sat, 30 Jun 2012 08:53:33 +0900 Subject: Makefile and source code structure update for LatinIME AOSP build Change-Id: Ia2ab54651ef96521fce01fe4755147909b818803 --- .../src/gesture/impl/incremental_decoder_impl.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'native/jni/src/gesture/impl/incremental_decoder_impl.cpp') 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 -- cgit v1.2.3-83-g751a