mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-04 20:46:28 +01:00
add dict_getStartsWith to jni
This commit is contained in:
parent
482aca5cfb
commit
9f2158f094
2 changed files with 24 additions and 0 deletions
|
@ -1455,4 +1455,26 @@ Java_org_eehouse_android_xw4_jni_XwJNI_dict_1iter_1nthWord
|
|||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_org_eehouse_android_xw4_jni_XwJNI_dict_1iter_1getStartsWith
|
||||
( JNIEnv* env, jclass C, jint closure, jstring jprefix )
|
||||
{
|
||||
jint result = -1;
|
||||
DictIterData* data = (DictIterData*)closure;
|
||||
if ( NULL != data ) {
|
||||
Tile tiles[MAX_COLS];
|
||||
XP_U16 nTiles = VSIZE(tiles);
|
||||
const char* prefix = (*env)->GetStringUTFChars( env, jprefix, NULL );
|
||||
if ( dict_tilesForString( data->dict, prefix, tiles, &nTiles ) ) {
|
||||
IndexData* idata = NULL;
|
||||
DictPosition pos = dict_getStartsWith( data->dict, idata, tiles,
|
||||
nTiles );
|
||||
result = pos;
|
||||
}
|
||||
(*env)->ReleaseStringUTFChars( env, jprefix, prefix );
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif /* XWFEATURE_BOARDWORDS */
|
||||
|
|
|
@ -244,4 +244,6 @@ public class XwJNI {
|
|||
public static native void dict_iter_makeIndex( int closure );
|
||||
public static native String[] dict_iter_getPrefixes( int closure );
|
||||
public static native int[] dict_iter_getIndices( int closure );
|
||||
public static native int dict_iter_getStartsWith( int closure,
|
||||
String prefix );
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue