xref: /aoo42x/main/configmgr/source/data.hxx (revision a2faadff)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef INCLUDED_CONFIGMGR_SOURCE_DATA_HXX
25 #define INCLUDED_CONFIGMGR_SOURCE_DATA_HXX
26 
27 #include "sal/config.h"
28 
29 #include <climits>
30 #include <map>
31 #include <vector>
32 
33 #include "boost/noncopyable.hpp"
34 #include "rtl/ref.hxx"
35 #include "rtl/ustring.hxx"
36 #include "sal/types.h"
37 #include "salhelper/simplereferenceobject.hxx"
38 
39 #include "additions.hxx"
40 #include "modifications.hxx"
41 #include "nodemap.hxx"
42 #include "path.hxx"
43 
44 namespace configmgr {
45 
46 class Node;
47 
48 struct Data: private boost::noncopyable {
49     enum { NO_LAYER = INT_MAX };
50 
51     struct ExtensionXcu: public salhelper::SimpleReferenceObject {
52         int layer;
53         Additions additions;
54     };
55 
56     NodeMap templates;
57 
58     NodeMap components;
59 
60     Modifications modifications;
61 
62     static rtl::OUString createSegment(
63         rtl::OUString const & templateName, rtl::OUString const & name);
64 
65     static sal_Int32 parseSegment(
66         rtl::OUString const & path, sal_Int32 index, rtl::OUString * name,
67         bool * setElement, rtl::OUString * templateName);
68 
69     static rtl::OUString fullTemplateName(
70         rtl::OUString const & component, rtl::OUString const & name);
71 
72     //TODO: better rules under which circumstances a short template name matches
73     static bool equalTemplateNames(
74         rtl::OUString const & shortName, rtl::OUString const & longName);
75 
76     static rtl::Reference< Node > findNode(
77         int layer, NodeMap const & map, rtl::OUString const & name);
78 
79     rtl::Reference< Node > resolvePathRepresentation(
80         rtl::OUString const & pathRepresentation,
81         rtl::OUString * canonicRepresenation, Path * path, int * finalizedLayer)
82         const;
83 
84     rtl::Reference< Node > getTemplate(
85         int layer, rtl::OUString const & fullName) const;
86 
87     Additions * addExtensionXcuAdditions(
88         rtl::OUString const & url, int layer);
89 
90     rtl::Reference< ExtensionXcu > removeExtensionXcuAdditions(
91         rtl::OUString const & url);
92 
93 private:
94     typedef std::map< rtl::OUString, rtl::Reference< ExtensionXcu > >
95         ExtensionXcuAdditions;
96 
97     ExtensionXcuAdditions extensionXcuAdditions_;
98 };
99 
100 }
101 
102 #endif
103