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 "com/sun/star/uno/Reference.hxx" 28 #include "com/sun/star/uno/RuntimeException.hpp" 29 #include "com/sun/star/uno/XInterface.hpp" 30 #include "osl/diagnose.h" 31 #include "rtl/ref.hxx" 32 #include "rtl/ustring.h" 33 #include "rtl/ustring.hxx" 34 35 #include "data.hxx" 36 #include "node.hxx" 37 #include "nodemap.hxx" 38 39 namespace configmgr { 40 41 namespace { 42 43 namespace css = com::sun::star; 44 45 } 46 getMembers()47NodeMap & Node::getMembers() { 48 OSL_ASSERT(false); 49 throw css::uno::RuntimeException( 50 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("this cannot happen")), 51 css::uno::Reference< css::uno::XInterface >()); 52 } 53 getTemplateName() const54rtl::OUString Node::getTemplateName() const { 55 return rtl::OUString(); 56 } 57 setMandatory(int layer)58void Node::setMandatory(int layer) { 59 (void) layer; // avoid warnings 60 OSL_ASSERT(layer == Data::NO_LAYER); 61 } 62 getMandatory() const63int Node::getMandatory() const { 64 return Data::NO_LAYER; 65 } 66 setLayer(int layer)67void Node::setLayer(int layer) { 68 OSL_ASSERT(layer >= layer_); 69 layer_ = layer; 70 } 71 getLayer() const72int Node::getLayer() const { 73 return layer_; 74 } 75 setFinalized(int layer)76void Node::setFinalized(int layer) { 77 finalized_ = layer; 78 } 79 getFinalized() const80int Node::getFinalized() const { 81 return finalized_; 82 } 83 getMember(rtl::OUString const & name)84rtl::Reference< Node > Node::getMember(rtl::OUString const & name) { 85 NodeMap & members = getMembers(); 86 NodeMap::iterator i(members.find(name)); 87 return i == members.end() ? rtl::Reference< Node >() : i->second; 88 } 89 Node(int layer)90Node::Node(int layer): layer_(layer), finalized_(Data::NO_LAYER) {} 91 Node(const Node & other)92Node::Node(const Node & other): 93 SimpleReferenceObject(), layer_(other.layer_), finalized_(other.finalized_) 94 {} 95 ~Node()96Node::~Node() {} 97 clear()98void Node::clear() {} 99 100 } 101