public static Struct forwardDecl(SimpleIdentifier name, Type type) { Struct s = new Struct(); s.setForwardDeclaration(true); s.setTag(name); s.setType(type); return s; }
private Struct parseClasse(Node classe, com.ochafik.lang.jnaerator.parser.Struct.Type type, SourceFile sf) throws XPathExpressionException { Struct cs = new Struct(); cs.setType(type); String name = XMLUtils.getAttribute(classe, "name"); if (result.config.verbose) { System.out.println("Parsing class " + name); } cs.setTag(ident(name)); for (Node method : XPathUtils.findNodesIterableByXPath("method", classe)) { // String mname = XMLUtils.getAttribute(method, "selector"); try { // if ((name.equals("NSScriptClassDescription") || name.equals("NSObject")) && mname.contains("classCode")) // name.toString(); cs.addDeclaration(parseFunction(Type.ObjCMethod, method, sf)); } catch (Exception ex) { ex.printStackTrace(); } } sf.addDeclaration(new TaggedTypeRefDeclaration(cs)); return cs; }
private Struct parseClasse(Node classe, com.ochafik.lang.jnaerator.parser.Struct.Type type, SourceFile sf) throws XPathExpressionException { Struct cs = new Struct(); cs.setType(type); String name = XMLUtils.getAttribute(classe, "name"); if (result.config.verbose) { System.out.println("Parsing class " + name); } cs.setTag(ident(name)); for (Node method : XPathUtils.findNodesIterableByXPath("method", classe)) { // String mname = XMLUtils.getAttribute(method, "selector"); try { // if ((name.equals("NSScriptClassDescription") || name.equals("NSObject")) && mname.contains("classCode")) // name.toString(); cs.addDeclaration(parseFunction(Type.ObjCMethod, method, sf)); } catch (Exception ex) { ex.printStackTrace(); } } sf.addDeclaration(new TaggedTypeRefDeclaration(cs)); return cs; }
private void parseClasses(String framework, Node signatures, SourceFile sf) throws XPathExpressionException { for (Node classe : XMLUtils.getChildrenByName(signatures, "class")) { Struct cs = parseClasse(classe, Struct.Type.ObjCClass, sf); if (cs == null) { continue; } if (!"NSObject".equals(String.valueOf(cs.getTag().toString()))) { cs.setParents(typeRef(ident("NSObject"))); } // cs.accept(result); } for (Node classe : XMLUtils.getChildrenByName(signatures, "informal_protocol")) { Struct cs = parseClasse(classe, Struct.Type.ObjCClass, sf); if (cs == null) { continue; } cs.setCategoryName(cs.getTag() == null ? null : cs.getTag().toString()); cs.setTag(ident("NSObject")); // cs.accept(result); } }
private void parseClasses(String framework, Node signatures, SourceFile sf) throws XPathExpressionException { for (Node classe : XMLUtils.getChildrenByName(signatures, "class")) { Struct cs = parseClasse(classe, Struct.Type.ObjCClass, sf); if (cs == null) { continue; } if (!"NSObject".equals(String.valueOf(cs.getTag().toString()))) { cs.setParents(typeRef(ident("NSObject"))); } // cs.accept(result); } for (Node classe : XMLUtils.getChildrenByName(signatures, "informal_protocol")) { Struct cs = parseClasse(classe, Struct.Type.ObjCClass, sf); if (cs == null) { continue; } cs.setCategoryName(cs.getTag() == null ? null : cs.getTag().toString()); cs.setTag(ident("NSObject")); // cs.accept(result); } }
interf.addToCommentBefore("Wrapper around the OpenCL program " + name); interf.addModifiers(ModifierType.Public); interf.setTag(ident(name)); interf.addParent(ident(CLAbstractUserProgram.class)); interf.setType(Struct.Type.JavaClass);
type.setTag(ident((tagName!=null?tagName.getText():null)));
Struct publicStaticClass(Identifier name, Identifier parentName, Struct.Type type, Element toCloneCommentsFrom, Identifier... interfaces) { Struct cl = new Struct(); cl.setType(type); cl.setTag(name); if (parentName != null) { cl.setParents(typeRef(parentName)); } if (type == Struct.Type.JavaInterface) { for (Identifier inter : interfaces) { cl.addParent(typeRef(inter)); } } else { for (Identifier inter : interfaces) { cl.addProtocol(typeRef(inter)); } } if (!result.config.noComments) { cl.importComments(toCloneCommentsFrom, getFileCommentContent(toCloneCommentsFrom)); } cl.addModifiers(ModifierType.Public, ModifierType.Static); return cl; }
Struct publicStaticClass(Identifier name, Identifier parentName, Struct.Type type, Element toCloneCommentsFrom, Identifier... interfaces) { Struct cl = new Struct(); cl.setType(type); cl.setTag(name); if (parentName != null) { cl.setParents(typeRef(parentName)); } if (type == Struct.Type.JavaInterface) { for (Identifier inter : interfaces) { cl.addParent(typeRef(inter)); } } else { for (Identifier inter : interfaces) { cl.addProtocol(typeRef(inter)); } } if (!result.config.noComments) { cl.importComments(toCloneCommentsFrom, getFileCommentContent(toCloneCommentsFrom)); } cl.addModifiers(ModifierType.Public, ModifierType.Static); return cl; }
Struct publicStaticClass(Identifier name, Identifier parentName, Struct.Type type, Element toCloneCommentsFrom, Identifier... interfaces) { Struct cl = new Struct(); cl.setType(type); cl.setTag(name); if (parentName != null) { cl.setParents(typeRef(parentName)); } if (type == Struct.Type.JavaInterface) { for (Identifier inter : interfaces) { cl.addParent(typeRef(inter)); } } else { for (Identifier inter : interfaces) { cl.addProtocol(typeRef(inter)); } } if (!result.config.noComments) { cl.importComments(toCloneCommentsFrom, getFileCommentContent(toCloneCommentsFrom)); } cl.addModifiers(ModifierType.Public, ModifierType.Static); return cl; }
Struct publicStaticClass(Identifier name, Identifier parentName, Struct.Type type, Element toCloneCommentsFrom, Identifier... interfaces) { Struct cl = new Struct(); cl.setType(type); cl.setTag(name); if (parentName != null) { cl.setParents(typeRef(parentName)); } if (type == Struct.Type.JavaInterface) { for (Identifier inter : interfaces) { cl.addParent(typeRef(inter)); } } else { for (Identifier inter : interfaces) { cl.addProtocol(typeRef(inter)); } } if (!result.config.noComments) { cl.importComments(toCloneCommentsFrom, getFileCommentContent(toCloneCommentsFrom)); } cl.addModifiers(ModifierType.Public, ModifierType.Static); return cl; }
result.declarationsConverter.getFileCommentContent(result.config.libraryProjectSources.get(library), null)); implementations.addModifiers(ModifierType.Public); implementations.setTag(implementationsSimpleClassName); implementations.addParent(ident(config.runtime.libraryClass, expr(typeRef(implementationsSimpleClassName)))); if (declarationsFullClassName != null) { result.declarationsConverter.getFileCommentContent(result.config.libraryProjectSources.get(library), null)); declarations.addModifiers(ModifierType.Public); declarations.setTag(declarationsSimpleClassName.clone()); declarations.setResolvedJavaIdentifier(declarationsFullClassName); } else {
result.declarationsConverter.getFileCommentContent(result.config.libraryProjectSources.get(library), null)); implementations.addModifiers(ModifierType.Public); implementations.setTag(implementationsSimpleClassName); implementations.addParent(ident(config.runtime.libraryClass, expr(typeRef(implementationsSimpleClassName)))); if (declarationsFullClassName != null) { result.declarationsConverter.getFileCommentContent(result.config.libraryProjectSources.get(library), null)); declarations.addModifiers(ModifierType.Public); declarations.setTag(declarationsSimpleClassName.clone()); declarations.setResolvedJavaIdentifier(declarationsFullClassName); } else {
type.setTag(ident((tagName!=null?tagName.getText():null)));
configureCallbackStruct(callbackStruct); callbackStruct.setTag(ident(chosenName)); if (!result.config.noComments) { callbackStruct.addToCommentBefore(comel.getCommentBefore(), comel.getCommentAfter(), getFileCommentContent(comel));
configureCallbackStruct(callbackStruct); callbackStruct.setTag(ident(chosenName)); if (!result.config.noComments) { callbackStruct.addToCommentBefore(comel.getCommentBefore(), comel.getCommentAfter(), getFileCommentContent(comel));
instanceStruct.setTag(isCategory ? ident(in.getCategoryName()) : in.getTag().clone()); if (isProtocol || isCategory) { instanceStruct.setType(Type.JavaInterface); classStruct.setTag(ident(classClassName)); classStruct.setType(Struct.Type.JavaClass); classStruct.addModifiers(ModifierType.Public, ModifierType.Static, ModifierType.Abstract); structThatReceivesStaticMethods = classInterfaceStruct = new Struct(); classInterfaceStruct.setType(Struct.Type.JavaInterface); classInterfaceStruct.setTag(ident(classInterfaceNameInCategoriesAndProtocols)); classInterfaceStruct.addParent(ident(ObjCClass.class)); classStruct.addProtocol(ident(classInterfaceNameInCategoriesAndProtocols));
instanceStruct.setTag(isCategory ? ident(in.getCategoryName()) : in.getTag().clone()); if (isProtocol || isCategory) { instanceStruct.setType(Type.JavaInterface); classStruct.setTag(ident(classClassName)); classStruct.setType(Struct.Type.JavaClass); classStruct.addModifiers(ModifierType.Public, ModifierType.Static, ModifierType.Abstract); structThatReceivesStaticMethods = classInterfaceStruct = new Struct(); classInterfaceStruct.setType(Struct.Type.JavaInterface); classInterfaceStruct.setTag(ident(classInterfaceNameInCategoriesAndProtocols)); classInterfaceStruct.addParent(ident(ObjCClass.class)); classStruct.addProtocol(ident(classInterfaceNameInCategoriesAndProtocols));
librariesHub.addModifiers(ModifierType.Public, ModifierType.Abstract); Identifier hubName = result.getHubFullClassName(); librariesHub.setTag(hubName.resolveLastSimpleIdentifier()); hubOut = result.classOutputter.getClassSourceWriter(hubName.toString()); hubOut.println("package " + hubName.resolveAllButLastIdentifier() + ";"); interf.setTag(simpleLibraryClassName);
librariesHub.addModifiers(ModifierType.Public, ModifierType.Abstract); Identifier hubName = result.getHubFullClassName(); librariesHub.setTag(hubName.resolveLastSimpleIdentifier()); hubOut = result.classOutputter.getClassSourceWriter(hubName.toString()); hubOut.println("package " + hubName.resolveAllButLastIdentifier() + ";"); interf.setTag(simpleLibraryClassName);