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 #include "precompiled_configmgr.hxx"
25 #include "sal/config.h"
26
27 #include "rtl/ref.hxx"
28 #include "rtl/ustring.hxx"
29
30 #include "data.hxx"
31 #include "groupnode.hxx"
32 #include "node.hxx"
33 #include "nodemap.hxx"
34
35 namespace configmgr {
36
GroupNode(int layer,bool extensible,rtl::OUString const & templateName)37 GroupNode::GroupNode(
38 int layer, bool extensible, rtl::OUString const & templateName):
39 Node(layer), extensible_(extensible), templateName_(templateName),
40 mandatory_(Data::NO_LAYER)
41 {}
42
clone(bool keepTemplateName) const43 rtl::Reference< Node > GroupNode::clone(bool keepTemplateName) const {
44 return new GroupNode(*this, keepTemplateName);
45 }
46
getMembers()47 NodeMap & GroupNode::getMembers() {
48 return members_;
49 }
50
getTemplateName() const51 rtl::OUString GroupNode::getTemplateName() const {
52 return templateName_;
53 }
54
setMandatory(int layer)55 void GroupNode::setMandatory(int layer) {
56 mandatory_ = layer;
57 }
58
getMandatory() const59 int GroupNode::getMandatory() const {
60 return mandatory_;
61 }
62
isExtensible() const63 bool GroupNode::isExtensible() const {
64 return extensible_;
65 }
66
GroupNode(GroupNode const & other,bool keepTemplateName)67 GroupNode::GroupNode(GroupNode const & other, bool keepTemplateName):
68 Node(other), extensible_(other.extensible_), mandatory_(other.mandatory_)
69 {
70 cloneNodeMap(other.members_, &members_);
71 if (keepTemplateName) {
72 templateName_ = other.templateName_;
73 }
74 }
75
~GroupNode()76 GroupNode::~GroupNode() {}
77
kind() const78 Node::Kind GroupNode::kind() const {
79 return KIND_GROUP;
80 }
81
clear()82 void GroupNode::clear() {
83 members_.clear();
84 }
85
86 }
87