diff options
author | Mathieu Féry <[email protected]> | 2023-07-31 17:22:54 +0200 |
---|---|---|
committer | Mathieu Féry <[email protected]> | 2023-07-31 17:22:54 +0200 |
commit | 380969bbf0b7746ab245b7d7d177243092fb2c34 (patch) | |
tree | 06837bc115fc2735f0aaa91586cf350e942306da /src/java/com/jogamp | |
parent | fe21c87b24842d67df686b7c48fa36ed65a9afc9 (diff) |
feat(generation): Add setter generation for not constant and not opaque compound attribute
Diffstat (limited to 'src/java/com/jogamp')
-rw-r--r-- | src/java/com/jogamp/gluegen/JavaEmitter.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/java/com/jogamp/gluegen/JavaEmitter.java b/src/java/com/jogamp/gluegen/JavaEmitter.java index 576e9bc..ff38fca 100644 --- a/src/java/com/jogamp/gluegen/JavaEmitter.java +++ b/src/java/com/jogamp/gluegen/JavaEmitter.java @@ -1140,6 +1140,20 @@ public class JavaEmitter implements GlueEmitter { field + "\" in type \"" + structCTypeName + "\")", fieldType.getASTLocusTag()); } + if( !immutableField && !fieldType.isConst() ) { + // Setter + generateSetterSignature(javaUnit, MethodAccess.PUBLIC, false, false, fieldName, fieldType, Ownership.Parent, containingJTypeName, CodeGenUtils.capitalizeString(fieldName), null, fieldType.getName(), null, false, false, null, null, null); + javaUnit.emitln(" {"); + javaUnit.emitln(" final ByteBuffer bb = src.getBuffer();"); + javaUnit.emitln(" final int size = "+fieldName+"_size[mdIdx];"); + javaUnit.emitln(" final byte[] content = new byte[size];"); + javaUnit.emitln(" bb.get(content, 0, size);"); + javaUnit.emitln(" accessor.setBytesAt("+fieldName+"_offset[mdIdx], content);"); + javaUnit.emitln(" return this;"); + javaUnit.emitln(" }"); + javaUnit.emitln(); + } + // Getter generateGetterSignature(javaUnit, false, false, fieldName, fieldType, Ownership.Parent, fieldType.getName(), CodeGenUtils.capitalizeString(fieldName), null, false, false, null, null); javaUnit.emitln(" {"); javaUnit.emitln(" return " + fieldType.getName() + ".create( accessor.slice( " + |