View Javadoc

1   /*
2   	Copyright (c) 2009 Olivier Chafik, All Rights Reserved
3   	
4   	This file is part of JNAerator (http://jnaerator.googlecode.com/).
5   	
6   	JNAerator is free software: you can redistribute it and/or modify
7   	it under the terms of the GNU General Public License as published by
8   	the Free Software Foundation, either version 3 of the License, or
9   	(at your option) any later version.
10  	
11  	JNAerator is distributed in the hope that it will be useful,
12  	but WITHOUT ANY WARRANTY; without even the implied warranty of
13  	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  	GNU General Public License for more details.
15  	
16  	You should have received a copy of the GNU General Public License
17  	along with JNAerator.  If not, see <http://www.gnu.org/licenses/>.
18  */
19  package com.ochafik.admin.visualstudio;
20  import java.io.File;
21  import java.io.FileFilter;
22  
23  /*
24  java -cp ../classes com.ochafik.admin.visualstudio.VisualStudioSolutionAndProjectsParser "C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\VSTest\VSTest.sln"
25  
26  java -cp ../classes;../libraries/antlr-runtime-3.1.jar;../libraries/trove.jar;../libraries/anarres-cpp.jar com.ochafik.lang.jnaerator.JNAerator -project "C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\VSTest\VSTest.sln" "Release|Win32"
27  */
28  
29  public class VisualStudioSolutionAndProjectsParser {
30  	static FileFilter headersFileFilter = new FileFilter() { public boolean accept(File f) {
31  		String name = f.getName();
32  		return name.endsWith(".h") || name.endsWith(".hpp") || name.endsWith(".hxx");
33  	}};
34  	
35  	public static void main(String[] args) {
36  		try {
37  			/*if (args.length == 0) {
38  				args = new String[] {
39  					"/Users/ochafik/Prog/Java/test/SlnAndVCProjs/sln/WholeRisque533.sln"
40  				};
41  			}*/
42  			
43  			long initTime = System.currentTimeMillis();
44  			File solutionFile = new File(args[0]);
45  			
46  			final Solution solution = new Solution(solutionFile);
47  			
48  			solution.parseProjects(headersFileFilter);
49  			
50  			System.out.println("Elapsed Time: " + (System.currentTimeMillis() - initTime) + " ms");
51  			System.out.println("Files Count: " + solution.allFiles.size());
52  			
53  		} catch (Exception ex) {
54  			ex.printStackTrace();
55  		}
56  	}
57  }