Tabnine Logo
Function.setName
Code IndexAdd Tabnine to your IDE (free)

How to use
setName
method
in
com.ochafik.lang.jnaerator.parser.Function

Best Java code snippets using com.ochafik.lang.jnaerator.parser.Function.setName (Showing top 20 results out of 315)

origin: com.nativelibs4java/jnaerator

void addConstructor(Struct s, Function f) {
  Identifier structName = getActualTaggedTypeName(s);
  f.setName(structName);
  s.addDeclaration(f);
}
origin: nativelibs4java/JNAerator

public Function(Type type, Identifier name, TypeRef returnType) {
  setType(type);
  setName(name);
  setValueType(returnType);
}
public Function(Type type, Identifier name, TypeRef returnType, Arg... args) {
origin: nativelibs4java/JNAerator

void addConstructor(Struct s, Function f) {
  Identifier structName = getActualTaggedTypeName(s);
  f.setName(structName);
  s.addDeclaration(f);
}
origin: nativelibs4java/JNAerator

public Function(Type type, Identifier name, TypeRef returnType, List<Arg> args) {
  setType(type);
  setName(name);
  setValueType(returnType);
  setArgs(args);
}
origin: nativelibs4java/JNAerator

public MutableByDeclarator mutateType(MutableByDeclarator type) {
  if (type == null)
    return null;
  type = type.clone();
  if (type instanceof Function) {
    ((Function)type).setName(new Identifier.SimpleIdentifier(getName()));
  }
  ((Element)type).importDetails(this, false);
  return type;
}
@Override
origin: nativelibs4java/JNAerator

private void fillIn(Signatures signatures, Identifier functionName, Function nativeMethod, NL4JConversion returnType, List<NL4JConversion> paramTypes, List<String> paramNames, Identifier varArgType, String varArgName, boolean isCallback, boolean useRawTypes) {
  for (int i = 0, n = paramTypes.size(); i < n; i++) {
    NL4JConversion paramType = paramTypes.get(i);
    String paramName = paramNames.get(i);
    nativeMethod.addArg(paramType.annotateTypedType(new Arg(paramName, paramType.getTypeRef(useRawTypes)), useRawTypes));//.getTypedTypeRef())));
  }
  if (varArgType != null) {
    nativeMethod.addArg(new Arg(varArgName, typeRef(varArgType.clone()))).setVarArg(true);
  }
  if (returnType != null) {
    returnType.annotateTypedType(nativeMethod, useRawTypes);
    nativeMethod.setValueType(returnType.getTypeRef(useRawTypes));
  }
  String natSig = nativeMethod.computeSignature(SignatureType.JavaStyle);
  Identifier javaMethodName = signatures == null ? functionName : signatures.findNextMethodName(natSig, functionName);
  if (!javaMethodName.equals(functionName)) {
    nativeMethod.setName(javaMethodName);
  }
}
origin: com.nativelibs4java/jnaerator

private void fillIn(Signatures signatures, Identifier functionName, Function nativeMethod, NL4JConversion returnType, List<NL4JConversion> paramTypes, List<String> paramNames, Identifier varArgType, String varArgName, boolean isCallback, boolean useRawTypes) {
  for (int i = 0, n = paramTypes.size(); i < n; i++) {
    NL4JConversion paramType = paramTypes.get(i);
    String paramName = paramNames.get(i);
    nativeMethod.addArg(paramType.annotateTypedType(new Arg(paramName, paramType.getTypeRef(useRawTypes)), useRawTypes));//.getTypedTypeRef())));
  }
  if (varArgType != null) {
    nativeMethod.addArg(new Arg(varArgName, typeRef(varArgType.clone()))).setVarArg(true);
  }
  if (returnType != null) {
    returnType.annotateTypedType(nativeMethod, useRawTypes);
    nativeMethod.setValueType(returnType.getTypeRef(useRawTypes));
  }
  String natSig = nativeMethod.computeSignature(SignatureType.JavaStyle);
  Identifier javaMethodName = signatures == null ? functionName : signatures.findNextMethodName(natSig, functionName);
  if (!javaMethodName.equals(functionName)) {
    nativeMethod.setName(javaMethodName);
  }
}
origin: nativelibs4java/JNAerator

@Override
public boolean replaceChild(Element child, Element by) {
  if (child == getBody()) {
    setBody((Statement.Block)by);
    return true;
  }
  if (child == getName()) {
    setName((Identifier)by);
    return true;
  }
  if (replaceChild(args, Arg.class, this, child, by))
    return true;
  if (replaceChild(thrown, TypeRef.class, this, child, by))
    return true;
  if (replaceChild(initializers, FunctionCall.class, this, child, by))
    return true;
  
  return super.replaceChild(child, by);
}

origin: com.nativelibs4java/jnaerator

/**
 * @return true if the functionSignature changed and triggerered
 * revisitation
 */
private boolean chooseNameIfMissing(FunctionSignature functionSignature) {
  Function function = functionSignature.getFunction();
  Element parent = functionSignature.getParentElement();
  if (function != null && (isNull(function.getName()) || parent instanceof VariablesDeclaration || parent instanceof Arg)) {
    String name = null;
    String exact = JNAeratorUtils.getExactTypeDefName(functionSignature);
    if (exact != null) {
      name = exact;
    } else {
      List<String> ownerNames = JNAeratorUtils.guessOwnerName(function);
      if (function.getName() != null) {
        ownerNames.add(function.getName().toString());
      }
      name = chooseName(functionSignature, ownerNames, true);
    }
    if (name != null) {
      function.setName(ident(name));
      function.accept(this);
      return true;
    }
  }
  return false;
}
Map<String, Integer> nextUnnamedId = new LinkedHashMap<String, Integer>();
origin: nativelibs4java/JNAerator

/**
 * @return true if the functionSignature changed and triggerered
 * revisitation
 */
private boolean chooseNameIfMissing(FunctionSignature functionSignature) {
  Function function = functionSignature.getFunction();
  Element parent = functionSignature.getParentElement();
  if (function != null && (isNull(function.getName()) || parent instanceof VariablesDeclaration || parent instanceof Arg)) {
    String name = null;
    String exact = JNAeratorUtils.getExactTypeDefName(functionSignature);
    if (exact != null) {
      name = exact;
    } else {
      List<String> ownerNames = JNAeratorUtils.guessOwnerName(function);
      if (function.getName() != null) {
        ownerNames.add(function.getName().toString());
      }
      name = chooseName(functionSignature, ownerNames, true);
    }
    if (name != null) {
      function.setName(ident(name));
      function.accept(this);
      return true;
    }
  }
  return false;
}
Map<String, Integer> nextUnnamedId = new LinkedHashMap<String, Integer>();
origin: nativelibs4java/JNAerator

createCopy.setCommentBefore("Factory method");
createCopy.addToCommentBefore("@see #" + meth.computeSignature(SignatureType.JavaStyle));
createCopy.setName(ident("create" + name.substring("init".length())));
createCopy.addModifiers(ModifierType.Public, ModifierType.Static);
createCopy.reorganizeModifiers();
origin: com.nativelibs4java/jnaerator

createCopy.setCommentBefore("Factory method");
createCopy.addToCommentBefore("@see #" + meth.computeSignature(SignatureType.JavaStyle));
createCopy.setName(ident("create" + name.substring("init".length())));
createCopy.addModifiers(ModifierType.Public, ModifierType.Static);
createCopy.reorganizeModifiers();
origin: nativelibs4java/JNAerator

Function createCastMethod(Identifier name, Identifier classId, boolean isStatic) {
  Function m = new Function();
  m.setType(Function.Type.JavaMethod);
  m.addModifiers(ModifierType.Public);
  m.setName(ident("as" + (isStatic ? "Static_" : "_") + name));
  m.setValueType(typeRef(classId.clone()));
  m.setBody(block(
      new Statement.Return(
      methodCall(
      expr(typeRef(Rococoa.class)),
      MemberRefStyle.Dot,
      "cast",
      varRef("this"),
      result.typeConverter.typeLiteral(typeRef(classId.clone()))))));
  return m;
}
origin: com.nativelibs4java/jnaerator

Function createCastMethod(Identifier name, Identifier classId, boolean isStatic) {
  Function m = new Function();
  m.setType(Function.Type.JavaMethod);
  m.addModifiers(ModifierType.Public);
  m.setName(ident("as" + (isStatic ? "Static_" : "_") + name));
  m.setValueType(typeRef(classId.clone()));
  m.setBody(block(
      new Statement.Return(
      methodCall(
      expr(typeRef(Rococoa.class)),
      MemberRefStyle.Dot,
      "cast",
      varRef("this"),
      result.typeConverter.typeLiteral(typeRef(classId.clone()))))));
  return m;
}
origin: com.nativelibs4java/jnaerator

@Override
public void visitArg(Arg arg) {
  Declarator d = arg.getDeclarator();
  if (d == null) {
    TypeRef tr = arg.getValueType();
    if (tr instanceof TypeRef.Pointer) {
      TypeRef target = ((TypeRef.Pointer)tr).getTarget();
      if (target instanceof TypeRef.FunctionSignature) {
        TypeRef.FunctionSignature fs = (TypeRef.FunctionSignature) target;
        Identifier name = fs.getFunction() == null ? null : fs.getFunction().getName();
        if (name != null) {
          arg.setDeclarator(new DirectDeclarator(name.toString()));
          fs.getFunction().setName(null);
        }
      }
    }
  } else if (!(d instanceof DirectDeclarator)) {
    MutableByDeclarator type = d.mutateType(arg.getValueType());
    if (type instanceof TypeRef) {
      arg.setValueType((TypeRef) type);
      arg.setDeclarator(new DirectDeclarator(d.resolveName(), d.getBits(), arg.getDefaultValue()));
    } else {
      type = null;
    }
  }
  super.visitArg(arg);
}
private static final boolean mutateDeclaratorTypes = true;
origin: nativelibs4java/JNAerator

@Override
public void visitArg(Arg arg) {
  Declarator d = arg.getDeclarator();
  if (d == null) {
    TypeRef tr = arg.getValueType();
    if (tr instanceof TypeRef.Pointer) {
      TypeRef target = ((TypeRef.Pointer)tr).getTarget();
      if (target instanceof TypeRef.FunctionSignature) {
        TypeRef.FunctionSignature fs = (TypeRef.FunctionSignature) target;
        Identifier name = fs.getFunction() == null ? null : fs.getFunction().getName();
        if (name != null) {
          arg.setDeclarator(new DirectDeclarator(name.toString()));
          fs.getFunction().setName(null);
        }
      }
    }
  } else if (!(d instanceof DirectDeclarator)) {
    MutableByDeclarator type = d.mutateType(arg.getValueType());
    if (type instanceof TypeRef) {
      arg.setValueType((TypeRef) type);
      arg.setDeclarator(new DirectDeclarator(d.resolveName(), d.getBits(), arg.getDefaultValue()));
    } else {
      type = null;
    }
  }
  super.visitArg(arg);
}
private static final boolean mutateDeclaratorTypes = true;
origin: nativelibs4java/JNAerator

if (mutatedType instanceof Function) {
  Function f = (Function) mutatedType;
  f.setName(new SimpleIdentifier(vs.resolveName()));
  decl = (Function) mutatedType;
  decl.importDetails(v, false);
origin: com.nativelibs4java/jnaerator

if (mutatedType instanceof Function) {
  Function f = (Function) mutatedType;
  f.setName(new SimpleIdentifier(vs.resolveName()));
  decl = (Function) mutatedType;
  decl.importDetails(v, false);
origin: nativelibs4java/JNAerator

if (arg.getName() == null) {
  arg.setName(origName.toString());
  functionSignature.getFunction().setName(null);
origin: com.nativelibs4java/jnaerator

if (arg.getName() == null) {
  arg.setName(origName.toString());
  functionSignature.getFunction().setName(null);
com.ochafik.lang.jnaerator.parserFunctionsetName

Popular methods of Function

  • <init>
  • addArg
  • addModifiers
  • getModifiers
  • getName
  • getValueType
  • setBody
  • getArgs
  • getAsmName
  • getBody
  • getType
  • importDetails
  • getType,
  • importDetails,
  • setArgs,
  • setCommentBefore,
  • setType,
  • setValueType,
  • accept,
  • addAnnotation,
  • addThrown

Popular in Java

  • Making http requests using okhttp
  • notifyDataSetChanged (ArrayAdapter)
  • requestLocationUpdates (LocationManager)
  • findViewById (Activity)
  • Color (java.awt)
    The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • BitSet (java.util)
    The BitSet class implements abit array [http://en.wikipedia.org/wiki/Bit_array]. Each element is eit
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now