forked from GitHub/gf-core
added org.grammaticalframework.pgf.Expr.unStr
This commit is contained in:
@@ -1412,6 +1412,19 @@ Java_org_grammaticalframework_pgf_Expr_unMeta(JNIEnv* env, jobject self)
|
||||
return -1;
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL
|
||||
Java_org_grammaticalframework_pgf_Expr_unStr(JNIEnv* env, jobject self)
|
||||
{
|
||||
PgfExpr expr = gu_variant_from_ptr(get_ref(env, self));
|
||||
|
||||
PgfLiteralStr* pstr = pgf_expr_unlit(expr, PGF_LITERAL_STR);
|
||||
if (pstr != NULL) {
|
||||
return gu2j_string(env, pstr->val);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_org_grammaticalframework_pgf_Expr_equals(JNIEnv* env, jobject self, jobject other)
|
||||
{
|
||||
|
||||
@@ -93,6 +93,11 @@ public class Expr implements Serializable {
|
||||
* a meta variable, then it will return the variable's id.
|
||||
* If this is not a meta variable then the result is -1. */
|
||||
public native int unMeta();
|
||||
|
||||
/** If the method is called on an expression which is
|
||||
* a string literal, then it will return the string value.
|
||||
* If this is not a string literal then the result is null. */
|
||||
public native String unStr();
|
||||
|
||||
/** Returns the expression as a string in the GF syntax */
|
||||
public String toString() {
|
||||
|
||||
Reference in New Issue
Block a user