xref: /aoo42x/main/autodoc/inc/ary/doc/d_node.hxx (revision 1c78a5d6)
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 ARY_DOC_D_NODE_HXX
25 #define ARY_DOC_D_NODE_HXX
26 
27 // BASE CLASSES
28 #include <cosv/tpl/processor.hxx>
29 // USED SERVICES
30 #include <cosv/tpl/vvector.hxx>
31 #include <ary/doc/d_types4doc.hxx>
32 
33 
34 
35 
36 namespace ary
37 {
38 namespace doc
39 {
40 
41 
42 /** The abstract base class for any type of documentation content.
43 
44     A ->Documentation has as content a hierarchy of Nodes, each can be a
45     different kind of content, like descriptions of single items or structs
46     or lists of Nodes.
47 */
48 class Node : public csv::ConstProcessorClient
49 {
50   public:
51 	// LIFECYCLE
52 	virtual				~Node();
53 
54     // OPERATIONS
55     void                Add_toChain(
56                             DYN Node &          pass_nextNode );
57     // INQUIRY
58     nodetype::id        Type() const;
59     const Node *        Next() const;
60     bool                IsSingle() const;
61     uintt               ListSize() const;
62 
63   protected:
64     explicit            Node(
65                             nodetype::id        i_type);
66   private:
67     // Forbid copies:
68     Node(const Node&);
69     Node & operator=(const Node&);
70 
71     // DATA
72     nodetype::id        nType;
73     Dyn<Node>           pNext;      /// Next ->Node in same list.
74 };
75 
76 typedef csv::VirtualVector<Node>    NodeList;
77 
78 
79 
80 
81 // IMPLEMENTATION
82 inline nodetype::id
Type() const83 Node::Type() const
84 {
85     return nType;
86 }
87 
88 inline const Node *
Next() const89 Node::Next() const
90 {
91     return pNext.Ptr();
92 }
93 
94 inline bool
IsSingle() const95 Node::IsSingle() const
96 {
97     return pNext.operator bool();
98 }
99 
100 
101 
102 
103 }   // namespace doc
104 }   // namespace ary
105 #endif
106