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_NODE_HXX 25 #define INCLUDED_CONFIGMGR_SOURCE_NODE_HXX 26 27 #include "sal/config.h" 28 29 #include "rtl/ref.hxx" 30 #include "salhelper/simplereferenceobject.hxx" 31 32 #include "nodemap.hxx" 33 34 namespace rtl { class OUString; } 35 36 namespace configmgr { 37 38 /** 39 * Configuration element. 40 * 41 * This class represent either a "node" or a "property" in the words of the 42 * OpenOffice.org Registry Format (OOR). 43 */ 44 class Node: public salhelper::SimpleReferenceObject { 45 public: 46 /// Identifies the type of configuration element. 47 enum Kind { 48 /** Property (<prop> element) 49 * 50 * Identifies instances of PropertyNode. 51 */ 52 KIND_PROPERTY, 53 /** Localized property (<prop> element) 54 * 55 * Identifies instances of LocalizedPropertyNode. 56 */ 57 KIND_LOCALIZED_PROPERTY, 58 /** 59 * Value of a property (<value> element) 60 * 61 * Identifies instances of LocalizedValueNode. 62 */ 63 KIND_LOCALIZED_VALUE, 64 /** Group member node (<node> element) 65 * 66 * Identifies instances of GroupNode. 67 */ 68 KIND_GROUP, 69 /** Set member node (<node> element) 70 * 71 * Identifies instances of SetNode. 72 */ 73 KIND_SET, 74 }; 75 76 virtual Kind kind() const = 0; 77 78 virtual rtl::Reference< Node > clone(bool keepTemplateName) const = 0; 79 80 virtual NodeMap & getMembers(); 81 82 virtual rtl::OUString getTemplateName() const; 83 84 virtual void setMandatory(int layer); 85 86 virtual int getMandatory() const; 87 88 void setLayer(int layer); 89 90 int getLayer() const; 91 92 void setFinalized(int layer); 93 94 int getFinalized() const; 95 96 rtl::Reference< Node > getMember(rtl::OUString const & name); 97 98 protected: 99 explicit Node(int layer); 100 101 Node(const Node & other); 102 103 virtual ~Node(); 104 105 virtual void clear(); 106 107 int layer_; 108 int finalized_; 109 }; 110 111 } 112 113 #endif 114