Browse Source

JNI-114 Make generated methods cached

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

13
src/gen_cpp_Engine.ysl2

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

46
src/pEp.yml2

@ -119,14 +119,14 @@ namespace pEp {
inout int flags
);
method re_evaluate_message_rating(
method cached=true re_evaluate_message_rating(
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",
returns Rating rating
);
method outgoing_message_rating(
method cached=true outgoing_message_rating(
in message msg,
returns Rating rating
);
@ -136,18 +136,18 @@ namespace pEp {
returns Rating rating
);
method get_identity(
method cached=true get_identity(
in string address,
in string userid,
returns identity ident
);
method identity_rating(
method cached=true identity_rating(
in identity ident,
returns Rating rating
);
method blacklist_retrieve(
method cached=true blacklist_retrieve(
returns stringlist blacklist
);
@ -157,34 +157,36 @@ namespace pEp {
returns identity ident
);
method OpenPGP_list_keyinfo(
method cached=true OpenPGP_list_keyinfo(
in string pattern,
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 int flags
in uint flags
);
method unset_identity_flags(
method cached=true unset_identity_flags(
in identity ident,
in int flags
in uint flags
);
method own_identities_retrieve(
method cached=true own_identities_retrieve(
returns identitylist identities
);
method get_trustwords(
in identity id1,
in identity id2,
method cached=true get_trustwords(
in identity id1 const,
in identity id2 const,
in string lang,
returns sstring words,
in bool full
);
method get_trustwords_for_fprs(
method cached=true get_trustwords_for_fprs(
in string fpr1,
in string fpr2,
in string lang,
@ -201,13 +203,13 @@ namespace pEp {
in bool full
);
method get_languagelist(
method cached=true get_languagelist(
returns string languagelist
);
// this function is not related to key reset
method key_reset_trust(
method cached=true key_reset_trust(
in identity ident
);
@ -223,14 +225,14 @@ namespace pEp {
method cached=true key_reset_all_own_keys();
method deliverHandshakeResult(
method cached=true deliverHandshakeResult(
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
);

2
src/types_c.ysl2

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

1
src/types_java.ysl2

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

Loading…
Cancel
Save