diff --git a/src/gen_cpp_Message.ysl2 b/src/gen_cpp_Message.ysl2 index 57ea985..bd47a3d 100644 --- a/src/gen_cpp_Message.ysl2 +++ b/src/gen_cpp_Message.ysl2 @@ -123,6 +123,10 @@ tstylesheet { const "jname" call "CamelCase" with "text", "name(*[1])"; const "cname" call "lcase" with "text", "name(*[1])"; const "type", "name(.)"; + const "jnitype" choose { + when "$type = 'direction' or $type = 'EncFormat'" > jint + otherwise > `call "jni_type" with "type", "name(.)"` + } const "getname" call "mangle" { with "type", "$type"; with "classname", "$class"; @@ -134,12 +138,12 @@ tstylesheet { with "name", "concat('set', $jname)"; } || - JNIEXPORT `call "jni_type" with "type", "name(.)"` JNICALL + JNIEXPORT «$jnitype» JNICALL «$getname»(JNIEnv *env, jobject obj) { «$name» *_obj = «$name»_ptr(env, obj); || choose { - when "../enum[@name=$type]" + when "$jnitype = 'jint' " |> return (jint) _obj->«$cname»; otherwise |> return from_«$type»(env, _obj->«$cname»); @@ -148,11 +152,11 @@ tstylesheet { } JNIEXPORT void JNICALL - «$setname»(JNIEnv *env, jobject obj, `call "jni_type" with "type", "name(.)"` value) { + «$setname»(JNIEnv *env, jobject obj, «$jnitype» value) { «$name» *_obj = «$name»_ptr(env, obj); || choose { - when "../enum[@name=$type]" + when "$jnitype = 'jint'" |> _obj->«$cname» = («$ctype») (int) value; otherwise { choose { diff --git a/src/gen_java_Message.ysl2 b/src/gen_java_Message.ysl2 index 16334ca..eeeafc7 100644 --- a/src/gen_java_Message.ysl2 +++ b/src/gen_java_Message.ysl2 @@ -219,7 +219,7 @@ tstylesheet { || - when "../enum[@name=$ctype]" + when "$ctype = 'direction' or $ctype = 'EncFormat'" || private native int _get«$name»(); public «$itype» get«$name»() { diff --git a/src/pEp.yml2 b/src/pEp.yml2 index c335d7c..f946cec 100644 --- a/src/pEp.yml2 +++ b/src/pEp.yml2 @@ -267,25 +267,6 @@ namespace pEp { }; struct message { - enum TextFormat { - plain > 0 - html > 1 - other > 255 - } - - enum direction { - incoming > 0 - outgoing > 1 - } - - enum EncFormat { - none > 0 - inline > 1 - SMIME > 2 - PGPMIME > 3 - PEP > 4 - } - direction dir; string id; string shortmsg;