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