@@ -88,12 +88,12 @@ class Rime {
8888
8989 RIME_PROTO_OBJ statusProto () { return proto->status_proto (session); }
9090
91- void setOption (const std::string & key, bool value) {
92- rime->set_option (session, key.c_str (), value);
91+ void setOption (std::string_view key, bool value) {
92+ rime->set_option (session, key.data (), value);
9393 }
9494
95- bool getOption (const std::string & key) {
96- return rime->get_option (session, key.c_str ());
95+ bool getOption (std::string_view key) {
96+ return rime->get_option (session, key.data ());
9797 }
9898
9999 std::string currentSchemaId () {
@@ -112,8 +112,8 @@ class Rime {
112112 return std::move (result);
113113 }
114114
115- bool selectSchema (const std::string & schemaId) {
116- return rime->select_schema (session, schemaId.c_str ());
115+ bool selectSchema (std::string_view schemaId) {
116+ return rime->select_schema (session, schemaId.data ());
117117 }
118118
119119 std::string rawInput () { return rime->get_input (session); }
@@ -282,13 +282,13 @@ Java_com_osfans_trime_core_Rime_getRimeStatus(JNIEnv *env, jclass /* thiz */) {
282282// runtime options
283283extern " C" JNIEXPORT void JNICALL Java_com_osfans_trime_core_Rime_setRimeOption (
284284 JNIEnv *env, jclass /* thiz */ , jstring option, jboolean value) {
285- Rime::Instance ().setOption (CString (env, option), value);
285+ Rime::Instance ().setOption (* CString (env, option), value);
286286}
287287
288288extern " C" JNIEXPORT jboolean JNICALL
289289Java_com_osfans_trime_core_Rime_getRimeOption (JNIEnv *env, jclass /* thiz */ ,
290290 jstring option) {
291- return Rime::Instance ().getOption (CString (env, option));
291+ return Rime::Instance ().getOption (* CString (env, option));
292292}
293293
294294extern " C" JNIEXPORT jobjectArray JNICALL
@@ -306,7 +306,7 @@ Java_com_osfans_trime_core_Rime_getCurrentRimeSchema(JNIEnv *env,
306306extern " C" JNIEXPORT jboolean JNICALL
307307Java_com_osfans_trime_core_Rime_selectRimeSchema (JNIEnv *env, jclass /* thiz */ ,
308308 jstring schema_id) {
309- return Rime::Instance ().selectSchema (CString (env, schema_id));
309+ return Rime::Instance ().selectSchema (* CString (env, schema_id));
310310}
311311
312312// testing
0 commit comments