Browse Source

JNI-114 Make generated methods cached

JNI-114
Hussein Kasem 5 years ago
parent
commit
ff5e01680c
  1. 9
      src/gen_cpp_Engine.ysl2
  2. 46
      src/pEp.yml2
  3. 2
      src/types_c.ysl2
  4. 1
      src/types_java.ysl2

9
src/gen_cpp_Engine.ysl2

@ -270,6 +270,7 @@ tstylesheet {
const "dir", "name(*[1])"; const "dir", "name(*[1])";
const "type", "name(*[2])"; const "type", "name(*[2])";
const "name", "name(*[3])"; const "name", "name(*[3])";
const "const", "name(*[4])";
choose { choose {
when "$type = 'message'" when "$type = 'message'"
@ -280,12 +281,20 @@ tstylesheet {
| bool _«$name» = (bool) «$name»; | bool _«$name» = (bool) «$name»;
when "$type='int'" when "$type='int'"
| int _«$name» = (int) «$name»; | int _«$name» = (int) «$name»;
when "$type='uint'"
| auto _«$name» = (uint) «$name»;
when "$type='string'" when "$type='string'"
| const char *_«$name» = to_string(env, «$name»); | const char *_«$name» = to_string(env, «$name»);
otherwise {
choose {
when "$const"
| const √$type *_«$name» = to_«$type»(env, «$name»);
otherwise otherwise
| √$type *_«$name» = to_«$type»(env, «$name»); | √$type *_«$name» = to_«$type»(env, «$name»);
} }
} }
}
}
template "parm", mode=out { template "parm", mode=out {
param "name", "name(*[3])"; param "name", "name(*[3])";

46
src/pEp.yml2

@ -119,14 +119,14 @@ namespace pEp {
inout int flags inout int flags
); );
method re_evaluate_message_rating( method cached=true re_evaluate_message_rating(
in message src, in message src,
Cconst stringlist x_keylist "NULL", Cconst stringlist x_keylist "static_cast<stringlist_t*>(nullptr)",
Cconst Rating x_enc_status "PEP_rating_undefined", Cconst Rating x_enc_status "PEP_rating_undefined",
returns Rating rating returns Rating rating
); );
method outgoing_message_rating( method cached=true outgoing_message_rating(
in message msg, in message msg,
returns Rating rating returns Rating rating
); );
@ -136,18 +136,18 @@ namespace pEp {
returns Rating rating returns Rating rating
); );
method get_identity( method cached=true get_identity(
in string address, in string address,
in string userid, in string userid,
returns identity ident returns identity ident
); );
method identity_rating( method cached=true identity_rating(
in identity ident, in identity ident,
returns Rating rating returns Rating rating
); );
method blacklist_retrieve( method cached=true blacklist_retrieve(
returns stringlist blacklist returns stringlist blacklist
); );
@ -157,34 +157,36 @@ namespace pEp {
returns identity ident returns identity ident
); );
method OpenPGP_list_keyinfo( method cached=true OpenPGP_list_keyinfo(
in string pattern, in string pattern,
returns stringpairlist keyinfoList returns stringpairlist keyinfoList
); );
method set_identity_flags( //TODO Move to use IdentityFlag instead of ints
method cached=true set_identity_flags(
in identity ident, in identity ident,
in int flags in uint flags
); );
method unset_identity_flags( method cached=true unset_identity_flags(
in identity ident, in identity ident,
in int flags in uint flags
); );
method own_identities_retrieve( method cached=true own_identities_retrieve(
returns identitylist identities returns identitylist identities
); );
method get_trustwords(
in identity id1, method cached=true get_trustwords(
in identity id2, in identity id1 const,
in identity id2 const,
in string lang, in string lang,
returns sstring words, returns sstring words,
in bool full in bool full
); );
method get_trustwords_for_fprs( method cached=true get_trustwords_for_fprs(
in string fpr1, in string fpr1,
in string fpr2, in string fpr2,
in string lang, in string lang,
@ -201,13 +203,13 @@ namespace pEp {
in bool full in bool full
); );
method get_languagelist( method cached=true get_languagelist(
returns string languagelist returns string languagelist
); );
// this function is not related to key reset // this function is not related to key reset
method key_reset_trust( method cached=true key_reset_trust(
in identity ident in identity ident
); );
@ -223,14 +225,14 @@ namespace pEp {
method cached=true key_reset_all_own_keys(); method cached=true key_reset_all_own_keys();
method deliverHandshakeResult( method cached=true deliverHandshakeResult(
in SyncHandshakeResult shr, in SyncHandshakeResult shr,
in identitylist identities in identitylist identities const
); );
method leave_device_group(); method cached=true leave_device_group();
method enable_identity_for_sync( method cached=true enable_identity_for_sync(
in identity ident in identity ident
); );

2
src/types_c.ysl2

@ -17,6 +17,7 @@ function "toC" {
when "$type='Rating'" > PEP_rating when "$type='Rating'" > PEP_rating
when "$type='SyncHandshakeResult'" > sync_handshake_result when "$type='SyncHandshakeResult'" > sync_handshake_result
when "$type='CipherSuite'" > PEP_CIPHER_SUITE when "$type='CipherSuite'" > PEP_CIPHER_SUITE
when "$type='uint'" > uint
otherwise value "$type"; otherwise value "$type";
} }
@ -31,6 +32,7 @@ function "jni_type" {
when "$type = 'string' or $type = 'sstring'" > jbyteArray when "$type = 'string' or $type = 'sstring'" > jbyteArray
when "$type='bool'" > jboolean when "$type='bool'" > jboolean
when "$type='int'" > jint when "$type='int'" > jint
when "$type='uint'" > jint
otherwise > jobject otherwise > jobject
} }
} }

1
src/types_java.ysl2

@ -4,6 +4,7 @@ function "toJava" {
choose { choose {
when "$type='bool'" > Boolean when "$type='bool'" > Boolean
when "$type='int'" > int when "$type='int'" > int
when "$type='uint'" > int
when "$type='string' or $type='sstring'" > String when "$type='string' or $type='sstring'" > String
when "$type='timestamp'" > Date when "$type='timestamp'" > Date
when "$type='void'" > void when "$type='void'" > void

Loading…
Cancel
Save