fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / autodoc / source / display / inc / toolkit / out_node.hxx
bloba7ee3e227fa6d570d691e05bc434408b226e2dbd
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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
23 namespace output
27 /** @resp
28 Represents a tree of names where each node can have only one parent,
29 but a list of children.
31 @see Position
32 @see Tree
34 class Node
36 public:
37 typedef std::vector< Node* > NodeList;
38 typedef UINT32 relative_id;
40 // LIFECYCLE
41 enum E_NullObject { null_object };
43 Node();
44 explicit Node( E_NullObject );
45 ~Node();
47 // OPERATORS
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); }
54 // OPERATIONS
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()); }
61 // INQUIRY
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.
69 void Get_Path(
70 StreamStr & o_result,
71 intt i_maxDepth = -1
72 ) const;
74 void Get_Chain(
75 StringVector & o_result,
76 intt i_maxDepth = -1
77 ) const;
79 // ACCESS
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.
88 static Node& Null_();
90 private:
91 // Local
92 Node(
93 const String& i_name,
94 Node& i_parent
97 Node* find_Child( const String& i_name );
99 Node& add_Child( const String& i_name );
101 Node& provide_Child(
102 StringVector::const_iterator i_next,
103 StringVector::const_iterator i_end
105 // Data
106 String sName;
107 Node* pParent;
108 NodeList aChildren;
109 intt nDepth;
110 relative_id nNameRoomId;
114 } // namespace output
115 #endif
117 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */