xref: /aoo42x/main/configmgr/source/setnode.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_SETNODE_HXX
25 #define INCLUDED_CONFIGMGR_SOURCE_SETNODE_HXX
26 
27 #include "sal/config.h"
28 
29 #include <vector>
30 
31 #include "rtl/ref.hxx"
32 #include "rtl/ustring.hxx"
33 
34 #include "node.hxx"
35 #include "nodemap.hxx"
36 
37 namespace configmgr {
38 
39 class SetNode: public Node {
40 public:
41     SetNode(
42         int layer, rtl::OUString const & defaultTemplateName,
43         rtl::OUString const & templateName);
44 
45     virtual rtl::Reference< Node > clone(bool keepTemplateName) const;
46 
47     virtual NodeMap & getMembers();
48 
49     virtual rtl::OUString getTemplateName() const;
50 
51     virtual void setMandatory(int layer);
52 
53     virtual int getMandatory() const;
54 
55     rtl::OUString const & getDefaultTemplateName() const;
56 
57     std::vector< rtl::OUString > & getAdditionalTemplateNames();
58 
59     bool isValidTemplate(rtl::OUString const & templateName) const;
60 
61 private:
62     SetNode(SetNode const & other, bool keepTemplateName);
63 
64     virtual ~SetNode();
65 
66     virtual Kind kind() const;
67 
68     virtual void clear();
69 
70     rtl::OUString defaultTemplateName_;
71     std::vector< rtl::OUString > additionalTemplateNames_;
72     NodeMap members_;
73     rtl::OUString templateName_;
74         // non-empty iff this node is a template, free node, or set member
75     int mandatory_;
76 };
77 
78 }
79 
80 #endif
81