aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/gluegen/structgen/CStructAnnotationProcessor.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-06-16 01:10:46 +0200
committerSven Gothel <[email protected]>2023-06-16 01:10:46 +0200
commit0a9105dd3ebbcf4b98664e50333334bff677031c (patch)
treef88ee400fa386e6f98b1336c2428f8ebcd6a3c72 /src/java/com/jogamp/gluegen/structgen/CStructAnnotationProcessor.java
parentf1678c4ac8b85c85d11b737d08dcfe31b388e021 (diff)
GlueGen Struct [3]: Adopt to CodeUnit Abstraction (replacing plain PrintWriter...)
Diffstat (limited to 'src/java/com/jogamp/gluegen/structgen/CStructAnnotationProcessor.java')
-rw-r--r--src/java/com/jogamp/gluegen/structgen/CStructAnnotationProcessor.java32
1 files changed, 27 insertions, 5 deletions
diff --git a/src/java/com/jogamp/gluegen/structgen/CStructAnnotationProcessor.java b/src/java/com/jogamp/gluegen/structgen/CStructAnnotationProcessor.java
index 45293f8..13bf418 100644
--- a/src/java/com/jogamp/gluegen/structgen/CStructAnnotationProcessor.java
+++ b/src/java/com/jogamp/gluegen/structgen/CStructAnnotationProcessor.java
@@ -28,7 +28,9 @@
package com.jogamp.gluegen.structgen;
import com.jogamp.common.util.PropertyAccess;
+import com.jogamp.gluegen.CCodeUnit;
import com.jogamp.gluegen.GlueGen;
+import com.jogamp.gluegen.JavaCodeUnit;
import com.jogamp.gluegen.JavaEmitter;
import java.io.BufferedReader;
@@ -282,12 +284,10 @@ public class CStructAnnotationProcessor extends AbstractProcessor {
public static class AnnotationProcessorJavaStructEmitter extends JavaEmitter {
- @Override
- protected PrintWriter openFile(final String filename, final String simpleClassName) throws IOException {
-
+ private boolean filter(final String simpleClassName) {
if( generatedStructs.contains(simpleClassName) ) {
System.err.println("skipping -> " + simpleClassName);
- return null;
+ return false;
}
// look for recursive generated structs... keep it DRY
@@ -296,9 +296,31 @@ public class CStructAnnotationProcessor extends AbstractProcessor {
System.err.println("generating -> " + simpleClassName);
generatedStructs.add(simpleClassName);
}
- return super.openFile(filename, simpleClassName);
+ return true;
+ }
+
+ @Override
+ protected CCodeUnit openCUnit(final String filename, final String cUnitName) throws IOException {
+ if( !filter(cUnitName) ) {
+ return null;
+ }
+ return super.openCUnit(filename, cUnitName);
}
+ /**
+ * @param filename the class's full filename to open w/ write access
+ * @param packageName the package name of the class
+ * @param simpleClassName the simple class name, i.e. w/o package name or c-file basename
+ * @param generator informal optional object that is creating this unit, used to be mentioned in a warning message if not null.
+ * @throws IOException
+ */
+ @Override
+ protected JavaCodeUnit openJavaUnit(final String filename, final String packageName, final String simpleClassName) throws IOException {
+ if( !filter(simpleClassName) ) {
+ return null;
+ }
+ return super.openJavaUnit(filename, packageName, simpleClassName);
+ }
}
}