1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef ADC_DISPLAY_OUT_NODE_HXX
21 #define ADC_DISPLAY_OUT_NODE_HXX
28 Represents a tree of names where each node can have only one parent,
29 but a list of children.
37 typedef std::vector
< Node
* > NodeList
;
38 typedef UINT32 relative_id
;
41 enum E_NullObject
{ null_object
};
44 explicit Node( E_NullObject
);
48 bool operator==( const Node
& i_node
) const
49 { return pParent
== i_node
.pParent AND sName
== i_node
.sName
; }
51 bool operator!=( const Node
& i_node
) const
52 { return NOT
operator==(i_node
); }
55 /// Seek, and if not existent, create.
56 Node
& Provide_Child( const String
& i_name
);
58 /// Seek, and if not existent, create.
59 Node
& Provide_Child( const StringVector
& i_path
)
60 { return provide_Child(i_path
.begin(), i_path
.end()); }
62 intt
Depth() const { return nDepth
; }
64 const String
& Name() const { return sName
; }
66 /// @return Id of a namespace or class etc. this directory represents.
67 relative_id
RelatedNameRoom() const { return nNameRoomId
; }
68 /// @return No delimiter at start, with delimiter at end.
75 StringVector
& o_result
,
80 void Set_RelatedNameRoom( relative_id i_nNameRoomId
)
81 { nNameRoomId
= i_nNameRoomId
; }
83 Node
* Parent() { return pParent
; }
84 Node
* Child( const String
& i_name
)
85 { return find_Child(i_name
); }
87 /// @return a reference to a Node with Depth() == -1.
97 Node
* find_Child( const String
& i_name
);
99 Node
& add_Child( const String
& i_name
);
102 StringVector::const_iterator i_next
,
103 StringVector::const_iterator i_end
110 relative_id nNameRoomId
;
114 } // namespace output
117 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */