xref: /aoo41x/main/xml2cmp/source/finder/dep_main.cxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #include <iostream>
29 
30 #include "dependy.hxx"
31 
32 
33 int
34 #ifdef WNT
35 _cdecl
36 #endif
37 main( int       argc,
38       char *    argv[] )
39 {
40     if (argc < 2 || *argv[1] == '?')
41     {
42         std::cout << "\nUse:\n"
43              << "srvdepy.exe  <xml-component-descriptions-root-directory>\n"
44              << std::endl;
45         return 0;
46     }
47 
48 
49     DependencyFinder aDependencies;
50 
51     aDependencies.GatherData(argv[1]);
52     char sInput[500] = "";
53     std::vector<Simstr>  aLibs;
54     std::vector<Simstr>  aServs;
55 
56 
57     std::cout
58          << "\nNow you can start to put in Service names.\n"
59          << "Please use correct case, but don't use namespaces.\n"
60          << "Just the Service's own name.\n\n"
61          << "To stop the program, put in a hashmark \"#\" + ENTER.\n"
62          << std::endl;
63 
64 
65 
66     do {
67 
68         sInput[0] = 0;
69         std::cin >> sInput;
70         Simstr sImplService(sInput);
71         if (*sInput != '#')
72         {
73             aLibs.erase( aLibs.begin(), aLibs.end() );
74             aServs.erase( aServs.begin(), aServs.end() );
75 
76             aDependencies.FindNeededServices( aLibs, aServs, sImplService );
77 
78             std::cout << "\n\n\nNeeded libraries: " << std::endl;
79             for ( unsigned i = 0; i < aLibs.size(); ++i )
80         	{
81                 std::cout << "    " << aLibs[i].str() << std::endl;
82         	}
83             std::cout << "\nNeeded services: " << std::endl;
84             for ( unsigned s= 0; s < aServs.size(); ++s )
85         	{
86                 std::cout << "    " << aServs[s].str() << std::endl;
87         	}
88             std::cout << "\n\n" << std::endl;
89         }
90     }   while (*sInput != '#');
91 
92     return 0;
93 }
94 
95 
96