1 /******************************************************************************* 2 * Copyright 2011 See AUTHORS file. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 ******************************************************************************/ 16 17 package com.badlogic.gdx.jnigen.parsing; 18 19 import java.util.ArrayList; 20 21 public interface CMethodParser { parse(String headerFile)22 public CMethodParserResult parse (String headerFile); 23 24 public class CMethodParserResult { 25 final ArrayList<CMethod> methods; 26 CMethodParserResult(ArrayList<CMethod> methods)27 public CMethodParserResult (ArrayList<CMethod> methods) { 28 this.methods = methods; 29 } 30 getMethods()31 public ArrayList<CMethod> getMethods () { 32 return methods; 33 } 34 } 35 36 public static class CMethod { 37 final String returnType; 38 final String head; 39 final String[] argumentTypes; 40 final int startIndex; 41 final int endIndex; 42 CMethod(String returnType, String head, String[] argumentTypes, int startIndex, int endIndex)43 public CMethod (String returnType, String head, String[] argumentTypes, int startIndex, int endIndex) { 44 this.returnType = returnType; 45 this.head = head; 46 this.argumentTypes = argumentTypes; 47 this.startIndex = startIndex; 48 this.endIndex = endIndex; 49 50 for (int i = 0; i < argumentTypes.length; i++) { 51 argumentTypes[i] = argumentTypes[i].trim(); 52 } 53 } 54 getReturnType()55 public String getReturnType () { 56 return returnType; 57 } 58 getHead()59 public String getHead () { 60 return head; 61 } 62 getArgumentTypes()63 public String[] getArgumentTypes () { 64 return argumentTypes; 65 } 66 getStartIndex()67 public int getStartIndex () { 68 return startIndex; 69 } 70 getEndIndex()71 public int getEndIndex () { 72 return endIndex; 73 } 74 } 75 } 76