xref: /aoo42x/main/configmgr/source/node.cxx (revision cdf0e10c)
1 /*************************************************************************
2 *
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
6 *
7 * OpenOffice.org - a multi-platform office productivity suite
8 *
9 * This file is part of OpenOffice.org.
10 *
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
14 *
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
20 *
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org.  If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
25 *
26 ************************************************************************/
27 
28 #include "precompiled_configmgr.hxx"
29 #include "sal/config.h"
30 
31 #include "com/sun/star/uno/Reference.hxx"
32 #include "com/sun/star/uno/RuntimeException.hpp"
33 #include "com/sun/star/uno/XInterface.hpp"
34 #include "osl/diagnose.h"
35 #include "rtl/ref.hxx"
36 #include "rtl/ustring.h"
37 #include "rtl/ustring.hxx"
38 
39 #include "data.hxx"
40 #include "node.hxx"
41 #include "nodemap.hxx"
42 
43 namespace configmgr {
44 
45 namespace {
46 
47 namespace css = com::sun::star;
48 
49 }
50 
51 NodeMap & Node::getMembers() {
52     OSL_ASSERT(false);
53     throw css::uno::RuntimeException(
54         rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("this cannot happen")),
55         css::uno::Reference< css::uno::XInterface >());
56 }
57 
58 rtl::OUString Node::getTemplateName() const {
59     return rtl::OUString();
60 }
61 
62 void Node::setMandatory(int layer) {
63     (void) layer; // avoid warnings
64     OSL_ASSERT(layer == Data::NO_LAYER);
65 }
66 
67 int Node::getMandatory() const {
68     return Data::NO_LAYER;
69 }
70 
71 void Node::setLayer(int layer) {
72     OSL_ASSERT(layer >= layer_);
73     layer_ = layer;
74 }
75 
76 int Node::getLayer() const {
77     return layer_;
78 }
79 
80 void Node::setFinalized(int layer) {
81     finalized_ = layer;
82 }
83 
84 int Node::getFinalized() const {
85     return finalized_;
86 }
87 
88 rtl::Reference< Node > Node::getMember(rtl::OUString const & name) {
89     NodeMap & members = getMembers();
90     NodeMap::iterator i(members.find(name));
91     return i == members.end() ? rtl::Reference< Node >() : i->second;
92 }
93 
94 Node::Node(int layer): layer_(layer), finalized_(Data::NO_LAYER) {}
95 
96 Node::Node(const Node & other):
97     SimpleReferenceObject(), layer_(other.layer_), finalized_(other.finalized_)
98 {}
99 
100 Node::~Node() {}
101 
102 void Node::clear() {}
103 
104 }
105