Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
5 : : * This Source Code Form is subject to the terms of the Mozilla Public
6 : : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
11 : : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : : * contributor license agreements. See the NOTICE file distributed
13 : : * with this work for additional information regarding copyright
14 : : * ownership. The ASF licenses this file to you under the Apache
15 : : * License, Version 2.0 (the "License"); you may not use this file
16 : : * except in compliance with the License. You may obtain a copy of
17 : : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : : */
19 : :
20 : : #ifndef X2C_DEPENDY_HXX
21 : : #define X2C_DEPENDY_HXX
22 : :
23 : :
24 : : #include <vector>
25 : : #include <map>
26 : : #include <set>
27 : : #include <../support/sistr.hxx>
28 : :
29 : : class Service;
30 : : class ServiceInfo;
31 : :
32 : : typedef std::vector< Simstr> StringVector;
33 : : typedef std::vector< ServiceInfo* > List_Implementations;
34 : : typedef std::map< Simstr, Service* > Map_Services;
35 : :
36 : 0 : class Service
37 : : {
38 : : public:
39 : : Service(
40 : : const char * i_sName );
41 : :
42 : : ServiceInfo & AddImplementation(
43 : : const char * i_sLibrary ); /// That is: module-name.
44 : :
45 : : const Simstr & Name() const { return sName; }
46 : 0 : const ServiceInfo & FirstImplementation() const
47 : 0 : { return *aImplementations[0]; }
48 : :
49 : : private:
50 : : Simstr sName;
51 : : List_Implementations
52 : : aImplementations;
53 : : };
54 : :
55 : : class ServiceInfo
56 : : {
57 : : public:
58 : : typedef StringVector List_NeededServices;
59 : :
60 : : ServiceInfo(
61 : : const char * i_sLibrary );
62 : :
63 : : void AddDependency(
64 : : const char * i_sNeededService );
65 : :
66 : 0 : const Simstr & Library() const { return sImplementingLibrary; }
67 : : const List_NeededServices &
68 : 0 : NeededServices() const { return aNeededServices; }
69 : :
70 : :
71 : : private:
72 : : Simstr sImplementingLibrary;
73 : : List_NeededServices aNeededServices;
74 : : };
75 : :
76 : :
77 : : class DependencyFinder
78 : : {
79 : : public:
80 : : DependencyFinder();
81 : : ~DependencyFinder();
82 : :
83 : : void GatherData(
84 : : const char * i_sSearchDirectory );
85 : :
86 : : void FindNeededServices(
87 : : StringVector & o_rLibraries,
88 : : StringVector & o_rServices,
89 : : const Simstr & i_rService );
90 : : private:
91 : : void ReadFile(
92 : : const char * i_sFilename );
93 : : void Add2Result(
94 : : const Service & i_rService );
95 : :
96 : : // Data
97 : : Map_Services aServices;
98 : :
99 : : // Temporary data
100 : : std::set< Simstr > aResult_Libraries;
101 : : std::set< Simstr > aResult_Services;
102 : : };
103 : :
104 : :
105 : :
106 : : #endif
107 : :
108 : :
109 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|