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 INCLUDED_CONFIGMGR_SOURCE_DATA_HXX
21 : #define INCLUDED_CONFIGMGR_SOURCE_DATA_HXX
22 :
23 : #include "sal/config.h"
24 :
25 : #include <climits>
26 : #include <map>
27 : #include <vector>
28 :
29 : #include "boost/noncopyable.hpp"
30 : #include "rtl/ref.hxx"
31 : #include "rtl/ustring.hxx"
32 : #include "sal/types.h"
33 : #include "salhelper/simplereferenceobject.hxx"
34 :
35 : #include "additions.hxx"
36 : #include "modifications.hxx"
37 : #include "nodemap.hxx"
38 : #include "path.hxx"
39 :
40 : namespace configmgr {
41 :
42 : class Node;
43 :
44 32 : struct Data: private boost::noncopyable {
45 : enum { NO_LAYER = INT_MAX };
46 :
47 0 : struct ExtensionXcu: public salhelper::SimpleReferenceObject {
48 : int layer;
49 : Additions additions;
50 : };
51 :
52 : NodeMap templates;
53 :
54 : Modifications modifications;
55 :
56 : static OUString createSegment(
57 : OUString const & templateName, OUString const & name);
58 :
59 : static sal_Int32 parseSegment(
60 : OUString const & path, sal_Int32 index, OUString * name,
61 : bool * setElement, OUString * templateName);
62 :
63 : static OUString fullTemplateName(
64 : OUString const & component, OUString const & name);
65 :
66 : //TODO: better rules under which circumstances a short template name matches
67 : static bool equalTemplateNames(
68 : OUString const & shortName, OUString const & longName);
69 :
70 : static rtl::Reference< Node > findNode(
71 : int layer, NodeMap const & map, OUString const & name);
72 :
73 : Data();
74 :
75 : rtl::Reference< Node > resolvePathRepresentation(
76 : OUString const & pathRepresentation,
77 : OUString * canonicRepresenation, Path * path, int * finalizedLayer)
78 : const;
79 :
80 : rtl::Reference< Node > getTemplate(
81 : int layer, OUString const & fullName) const;
82 :
83 : NodeMap & getComponents() const;
84 :
85 : Additions * addExtensionXcuAdditions(
86 : OUString const & url, int layer);
87 :
88 : rtl::Reference< ExtensionXcu > removeExtensionXcuAdditions(
89 : OUString const & url);
90 :
91 : private:
92 : typedef std::map< OUString, rtl::Reference< ExtensionXcu > >
93 : ExtensionXcuAdditions;
94 :
95 : rtl::Reference< Node > root_;
96 :
97 : ExtensionXcuAdditions extensionXcuAdditions_;
98 : };
99 :
100 : }
101 :
102 : #endif
103 :
104 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|