001    /*
002            Copyright (c) 2009 Olivier Chafik, All Rights Reserved
003            
004            This file is part of JNAerator (http://jnaerator.googlecode.com/).
005            
006            JNAerator is free software: you can redistribute it and/or modify
007            it under the terms of the GNU General Public License as published by
008            the Free Software Foundation, either version 3 of the License, or
009            (at your option) any later version.
010            
011            JNAerator is distributed in the hope that it will be useful,
012            but WITHOUT ANY WARRANTY; without even the implied warranty of
013            MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
014            GNU General Public License for more details.
015            
016            You should have received a copy of the GNU General Public License
017            along with JNAerator.  If not, see <http://www.gnu.org/licenses/>.
018    */
019    package com.ochafik.admin.visualstudio;
020    import java.io.File;
021    import java.io.FileFilter;
022    
023    /*
024    java -cp ../classes com.ochafik.admin.visualstudio.VisualStudioSolutionAndProjectsParser "C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\VSTest\VSTest.sln"
025    
026    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"
027    */
028    
029    public class VisualStudioSolutionAndProjectsParser {
030            static FileFilter headersFileFilter = new FileFilter() { public boolean accept(File f) {
031                    String name = f.getName();
032                    return name.endsWith(".h") || name.endsWith(".hpp") || name.endsWith(".hxx");
033            }};
034            
035            public static void main(String[] args) {
036                    try {
037                            /*if (args.length == 0) {
038                                    args = new String[] {
039                                            "/Users/ochafik/Prog/Java/test/SlnAndVCProjs/sln/WholeRisque533.sln"
040                                    };
041                            }*/
042                            
043                            long initTime = System.currentTimeMillis();
044                            File solutionFile = new File(args[0]);
045                            
046                            final Solution solution = new Solution(solutionFile);
047                            
048                            solution.parseProjects(headersFileFilter);
049                            
050                            System.out.println("Elapsed Time: " + (System.currentTimeMillis() - initTime) + " ms");
051                            System.out.println("Files Count: " + solution.allFiles.size());
052                            
053                    } catch (Exception ex) {
054                            ex.printStackTrace();
055                    }
056            }
057    }