Step 30-A Constize gesture

Change-Id: I6c0b89d96532dc1c8ca71bb730ba22de5592ec67
main
Satoshi Kataoka 2012-08-15 16:57:32 +09:00
parent 3979f060f0
commit f6be15cffe
7 changed files with 14 additions and 11 deletions

View File

@ -19,8 +19,8 @@
#include "dic_traverse_wrapper.h" #include "dic_traverse_wrapper.h"
namespace latinime { namespace latinime {
void *(*DicTraverseWrapper::sDicTraverseSessionFactoryMethod)(JNIEnv *env, jstring locale) = 0; void *(*DicTraverseWrapper::sDicTraverseSessionFactoryMethod)(JNIEnv *, jstring) = 0;
void (*DicTraverseWrapper::sDicTraverseSessionReleaseMethod)(void *) = 0; void (*DicTraverseWrapper::sDicTraverseSessionReleaseMethod)(void *) = 0;
void (*DicTraverseWrapper::sDicTraverseSessionInitMethod)( void (*DicTraverseWrapper::sDicTraverseSessionInitMethod)(
void *, Dictionary *, const int *, const int) = 0; void *, const Dictionary *const, const int *, const int) = 0;
} // namespace latinime } // namespace latinime

View File

@ -34,7 +34,7 @@ class DicTraverseWrapper {
return 0; return 0;
} }
static void initDicTraverseSession(void *traverseSession, static void initDicTraverseSession(void *traverseSession,
Dictionary *dictionary, const int *prevWord, const int prevWordLength) { const Dictionary *const dictionary, const int *prevWord, const int prevWordLength) {
if (sDicTraverseSessionInitMethod) { if (sDicTraverseSessionInitMethod) {
sDicTraverseSessionInitMethod(traverseSession, dictionary, prevWord, prevWordLength); sDicTraverseSessionInitMethod(traverseSession, dictionary, prevWord, prevWordLength);
} }
@ -45,11 +45,11 @@ class DicTraverseWrapper {
} }
} }
static void setTraverseSessionFactoryMethod( static void setTraverseSessionFactoryMethod(
void *(*factoryMethod)(JNIEnv *env, jstring locale)) { void *(*factoryMethod)(JNIEnv *, jstring)) {
sDicTraverseSessionFactoryMethod = factoryMethod; sDicTraverseSessionFactoryMethod = factoryMethod;
} }
static void setTraverseSessionInitMethod( static void setTraverseSessionInitMethod(
void (*initMethod)(void *, Dictionary *, const int *, const int)) { void (*initMethod)(void *, const Dictionary *const, const int *, const int)) {
sDicTraverseSessionInitMethod = initMethod; sDicTraverseSessionInitMethod = initMethod;
} }
static void setTraverseSessionReleaseMethod(void (*releaseMethod)(void *)) { static void setTraverseSessionReleaseMethod(void (*releaseMethod)(void *)) {
@ -58,7 +58,8 @@ class DicTraverseWrapper {
private: private:
DISALLOW_IMPLICIT_CONSTRUCTORS(DicTraverseWrapper); DISALLOW_IMPLICIT_CONSTRUCTORS(DicTraverseWrapper);
static void *(*sDicTraverseSessionFactoryMethod)(JNIEnv *, jstring); static void *(*sDicTraverseSessionFactoryMethod)(JNIEnv *, jstring);
static void (*sDicTraverseSessionInitMethod)(void *, Dictionary *, const int *, const int); static void (*sDicTraverseSessionInitMethod)(
void *, const Dictionary *const, const int *, const int);
static void (*sDicTraverseSessionReleaseMethod)(void *); static void (*sDicTraverseSessionReleaseMethod)(void *);
}; };
int register_DicTraverseSession(JNIEnv *env); int register_DicTraverseSession(JNIEnv *env);

View File

@ -60,7 +60,7 @@ int Dictionary::getSuggestions(ProximityInfo *proximityInfo, void *traverseSessi
int *codes, int codesSize, int *prevWordChars, int *codes, int codesSize, int *prevWordChars,
int prevWordLength, int commitPoint, bool isGesture, int prevWordLength, int commitPoint, bool isGesture,
bool useFullEditDistance, unsigned short *outWords, bool useFullEditDistance, unsigned short *outWords,
int *frequencies, int *spaceIndices, int *outputTypes) { int *frequencies, int *spaceIndices, int *outputTypes) const {
int result = 0; int result = 0;
if (isGesture) { if (isGesture) {
DicTraverseWrapper::initDicTraverseSession( DicTraverseWrapper::initDicTraverseSession(

View File

@ -48,7 +48,7 @@ class Dictionary {
int *ycoordinates, int *times, int *pointerIds, int *codes, int codesSize, int *ycoordinates, int *times, int *pointerIds, int *codes, int codesSize,
int *prevWordChars, int prevWordLength, int commitPoint, bool isGesture, int *prevWordChars, int prevWordLength, int commitPoint, bool isGesture,
bool useFullEditDistance, unsigned short *outWords, bool useFullEditDistance, unsigned short *outWords,
int *frequencies, int *spaceIndices, int *outputTypes); int *frequencies, int *spaceIndices, int *outputTypes) const;
int getBigrams(const int32_t *word, int length, int *codes, int codesSize, int getBigrams(const int32_t *word, int length, int *codes, int codesSize,
unsigned short *outWords, int *frequencies, int *outputTypes) const; unsigned short *outWords, int *frequencies, int *outputTypes) const;

View File

@ -39,7 +39,8 @@ class GestureDecoderWrapper : public IncrementalDecoderInterface {
int getSuggestions(ProximityInfo *pInfo, void *traverseSession, int *inputXs, int *inputYs, int getSuggestions(ProximityInfo *pInfo, void *traverseSession, int *inputXs, int *inputYs,
int *times, int *pointerIds, int *codes, int inputSize, int commitPoint, int *times, int *pointerIds, int *codes, int inputSize, int commitPoint,
unsigned short *outWords, int *frequencies, int *outputIndices, int *outputTypes) { unsigned short *outWords, int *frequencies, int *outputIndices,
int *outputTypes) const {
if (!mIncrementalDecoderInterface) { if (!mIncrementalDecoderInterface) {
return 0; return 0;
} }

View File

@ -31,7 +31,7 @@ class IncrementalDecoderInterface {
virtual int getSuggestions(ProximityInfo *pInfo, void *traverseSession, virtual int getSuggestions(ProximityInfo *pInfo, void *traverseSession,
int *inputXs, int *inputYs, int *times, int *pointerIds, int *codes, int *inputXs, int *inputYs, int *times, int *pointerIds, int *codes,
int inputSize, int commitPoint, unsigned short *outWords, int *frequencies, int inputSize, int commitPoint, unsigned short *outWords, int *frequencies,
int *outputIndices, int *outputTypes) = 0; int *outputIndices, int *outputTypes) const = 0;
IncrementalDecoderInterface() { }; IncrementalDecoderInterface() { };
virtual ~IncrementalDecoderInterface() { }; virtual ~IncrementalDecoderInterface() { };
private: private:

View File

@ -39,7 +39,8 @@ class IncrementalDecoderWrapper : public IncrementalDecoderInterface {
int getSuggestions(ProximityInfo *pInfo, void *traverseSession, int *inputXs, int *inputYs, int getSuggestions(ProximityInfo *pInfo, void *traverseSession, int *inputXs, int *inputYs,
int *times, int *pointerIds, int *codes, int inputSize, int commitPoint, int *times, int *pointerIds, int *codes, int inputSize, int commitPoint,
unsigned short *outWords, int *frequencies, int *outputIndices, int *outputTypes) { unsigned short *outWords, int *frequencies, int *outputIndices,
int *outputTypes) const {
if (!mIncrementalDecoderInterface) { if (!mIncrementalDecoderInterface) {
return 0; return 0;
} }