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