1*3a7cf181SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*3a7cf181SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*3a7cf181SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*3a7cf181SAndrew Rist * distributed with this work for additional information 6*3a7cf181SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*3a7cf181SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*3a7cf181SAndrew Rist * "License"); you may not use this file except in compliance 9*3a7cf181SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*3a7cf181SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*3a7cf181SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*3a7cf181SAndrew Rist * software distributed under the License is distributed on an 15*3a7cf181SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*3a7cf181SAndrew Rist * KIND, either express or implied. See the License for the 17*3a7cf181SAndrew Rist * specific language governing permissions and limitations 18*3a7cf181SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*3a7cf181SAndrew Rist *************************************************************/ 21*3a7cf181SAndrew Rist 22*3a7cf181SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #include "precompiled_configmgr.hxx" 25cdf0e10cSrcweir #include "sal/config.h" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include "rtl/ref.hxx" 28cdf0e10cSrcweir #include "rtl/ustring.hxx" 29cdf0e10cSrcweir 30cdf0e10cSrcweir #include "data.hxx" 31cdf0e10cSrcweir #include "groupnode.hxx" 32cdf0e10cSrcweir #include "node.hxx" 33cdf0e10cSrcweir #include "nodemap.hxx" 34cdf0e10cSrcweir 35cdf0e10cSrcweir namespace configmgr { 36cdf0e10cSrcweir 37cdf0e10cSrcweir GroupNode::GroupNode( 38cdf0e10cSrcweir int layer, bool extensible, rtl::OUString const & templateName): 39cdf0e10cSrcweir Node(layer), extensible_(extensible), templateName_(templateName), 40cdf0e10cSrcweir mandatory_(Data::NO_LAYER) 41cdf0e10cSrcweir {} 42cdf0e10cSrcweir 43cdf0e10cSrcweir rtl::Reference< Node > GroupNode::clone(bool keepTemplateName) const { 44cdf0e10cSrcweir return new GroupNode(*this, keepTemplateName); 45cdf0e10cSrcweir } 46cdf0e10cSrcweir 47cdf0e10cSrcweir NodeMap & GroupNode::getMembers() { 48cdf0e10cSrcweir return members_; 49cdf0e10cSrcweir } 50cdf0e10cSrcweir 51cdf0e10cSrcweir rtl::OUString GroupNode::getTemplateName() const { 52cdf0e10cSrcweir return templateName_; 53cdf0e10cSrcweir } 54cdf0e10cSrcweir 55cdf0e10cSrcweir void GroupNode::setMandatory(int layer) { 56cdf0e10cSrcweir mandatory_ = layer; 57cdf0e10cSrcweir } 58cdf0e10cSrcweir 59cdf0e10cSrcweir int GroupNode::getMandatory() const { 60cdf0e10cSrcweir return mandatory_; 61cdf0e10cSrcweir } 62cdf0e10cSrcweir 63cdf0e10cSrcweir bool GroupNode::isExtensible() const { 64cdf0e10cSrcweir return extensible_; 65cdf0e10cSrcweir } 66cdf0e10cSrcweir 67cdf0e10cSrcweir GroupNode::GroupNode(GroupNode const & other, bool keepTemplateName): 68cdf0e10cSrcweir Node(other), extensible_(other.extensible_), mandatory_(other.mandatory_) 69cdf0e10cSrcweir { 70cdf0e10cSrcweir cloneNodeMap(other.members_, &members_); 71cdf0e10cSrcweir if (keepTemplateName) { 72cdf0e10cSrcweir templateName_ = other.templateName_; 73cdf0e10cSrcweir } 74cdf0e10cSrcweir } 75cdf0e10cSrcweir 76cdf0e10cSrcweir GroupNode::~GroupNode() {} 77cdf0e10cSrcweir 78cdf0e10cSrcweir Node::Kind GroupNode::kind() const { 79cdf0e10cSrcweir return KIND_GROUP; 80cdf0e10cSrcweir } 81cdf0e10cSrcweir 82cdf0e10cSrcweir void GroupNode::clear() { 83cdf0e10cSrcweir members_.clear(); 84cdf0e10cSrcweir } 85cdf0e10cSrcweir 86cdf0e10cSrcweir } 87