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