xref: /aoo42x/main/configmgr/source/partial.hxx (revision b597708b)
1a2faadffSAndrew Rist /**************************************************************
2a2faadffSAndrew Rist  *
3a2faadffSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4a2faadffSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5a2faadffSAndrew Rist  * distributed with this work for additional information
6a2faadffSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7a2faadffSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8a2faadffSAndrew Rist  * "License"); you may not use this file except in compliance
9a2faadffSAndrew Rist  * with the License.  You may obtain a copy of the License at
10a2faadffSAndrew Rist  *
11a2faadffSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12a2faadffSAndrew Rist  *
13a2faadffSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14a2faadffSAndrew Rist  * software distributed under the License is distributed on an
15a2faadffSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16a2faadffSAndrew Rist  * KIND, either express or implied.  See the License for the
17a2faadffSAndrew Rist  * specific language governing permissions and limitations
18a2faadffSAndrew Rist  * under the License.
19a2faadffSAndrew Rist  *
20a2faadffSAndrew Rist  *************************************************************/
21a2faadffSAndrew Rist 
22a2faadffSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef INCLUDED_CONFIGMGR_SOURCE_PARTIAL_HXX
25cdf0e10cSrcweir #define INCLUDED_CONFIGMGR_SOURCE_PARTIAL_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "sal/config.h"
28cdf0e10cSrcweir 
29b72581ebSHerbert Dürr #include <boost/unordered_map.hpp> // using the boost container because it explicitly allows recursive types
30cdf0e10cSrcweir #include <set>
31cdf0e10cSrcweir 
32cdf0e10cSrcweir #include "boost/noncopyable.hpp"
33cdf0e10cSrcweir 
34cdf0e10cSrcweir #include "path.hxx"
35b72581ebSHerbert Dürr #include "rtl/ustring.hxx"
36cdf0e10cSrcweir 
37cdf0e10cSrcweir namespace configmgr {
38cdf0e10cSrcweir 
39cdf0e10cSrcweir class Partial: private boost::noncopyable {
40cdf0e10cSrcweir public:
41cdf0e10cSrcweir     enum Containment { CONTAINS_NOT, CONTAINS_SUBNODES, CONTAINS_NODE };
42cdf0e10cSrcweir 
43cdf0e10cSrcweir     Partial(
44cdf0e10cSrcweir         std::set< rtl::OUString > const & includedPaths,
45cdf0e10cSrcweir         std::set< rtl::OUString > const & excludedPaths);
46cdf0e10cSrcweir 
47cdf0e10cSrcweir     ~Partial();
48cdf0e10cSrcweir 
49cdf0e10cSrcweir     Containment contains(Path const & path) const;
50cdf0e10cSrcweir 
51cdf0e10cSrcweir private:
52cdf0e10cSrcweir     struct Node {
53*b597708bSHerbert Dürr         typedef boost::unordered_map< rtl::OUString, Node, rtl::OUStringHash > Children;
54cdf0e10cSrcweir 
Nodeconfigmgr::Partial::Node55cdf0e10cSrcweir         Node(): startInclude(false) {}
clearconfigmgr::Partial::Node56b72581ebSHerbert Dürr         void clear() { startInclude=false; children.clear(); }
57cdf0e10cSrcweir 
58cdf0e10cSrcweir         Children children;
59cdf0e10cSrcweir         bool startInclude;
60cdf0e10cSrcweir     };
61cdf0e10cSrcweir 
62cdf0e10cSrcweir     Node root_;
63cdf0e10cSrcweir };
64cdf0e10cSrcweir 
65cdf0e10cSrcweir }
66cdf0e10cSrcweir 
67cdf0e10cSrcweir #endif
68