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 ADC_CPP_SDOCDIST_HXX
25 #define ADC_CPP_SDOCDIST_HXX
26 
27 
28 
29 // USED SERVICES
30 	// BASE CLASSES
31 #include "cxt2ary.hxx"
32 #include <ary/info/docstore.hxx>
33 	// COMPONENTS
34 	// PARAMETERS
35 
36 namespace cpp
37 {
38 
39 using ary::Documentation;
40 
41 /** Implementation struct for cpp::ContextForAry.
42 */
43 
44 struct ContextForAry::S_DocuDistributor : public ary::info::DocuStore
45 {
46   public:
S_DocuDistributorcpp::ContextForAry::S_DocuDistributor47                         S_DocuDistributor()     :   pCurRe(0) {}
~S_DocuDistributorcpp::ContextForAry::S_DocuDistributor48                         ~S_DocuDistributor()    {}
49 
Resetcpp::ContextForAry::S_DocuDistributor50     void                Reset()                 { pCurRe = 0; pLastStoredDocu = 0; }
51 
52     void                SetCurrentlyStoredRe(
53                             ary::cpp::CppEntity &
54                                                 io_rRe );
55     void                Event_LineBreak();
56 
57   private:
58     // Interface ary::info::DocuStore
59 	virtual void	 	do_Store2CurFile(
60 							DYN ary::doc::Node& let_drDocu );
61 	virtual void	 	do_Store2CurNamespace(
62 							DYN ary::doc::Node& let_drDocu );
63 
64 	virtual void	 	do_Store2ConnectedDeclaration(
65 							DYN ary::doc::Node& let_drDocu );
66 
67 	virtual void	 	do_Store2Glossary(
68 							DYN ary::doc::Node& let_drDocu,
69 							const String  &	    i_sExplainedTerm );
70 	virtual void	 	do_Store2GlobalTexts(
71 							DYN ary::doc::Node& let_drDocu,
72 							ary::info::GlobalTextId
73 												i_nId );
74     // DATA
75     ary::cpp::CppEntity *
76                         pCurRe;
77     Dyn<ary::doc::Node> pLastStoredDocu;
78 };
79 
80 
81 // IMPLEMENTATION
82 
83 /*  The implementation is in header, though not all inline, because this file
84     is included in cxt2ary.cxx only!
85 */
86 
87 
88 void
89 ContextForAry::
SetCurrentlyStoredRe(ary::cpp::CppEntity & io_rRe)90 S_DocuDistributor::SetCurrentlyStoredRe( ary::cpp::CppEntity & io_rRe )
91 {
92     pCurRe = &io_rRe;
93     if ( pLastStoredDocu )
94         pCurRe->Set_Docu( *pLastStoredDocu.Release() );
95 }
96 
97 inline void
98 ContextForAry::
Event_LineBreak()99 S_DocuDistributor::Event_LineBreak()
100 {
101     pCurRe = 0;
102 }
103 
104 void
105 ContextForAry::
do_Store2CurFile(DYN ary::doc::Node & let_drDocu)106 S_DocuDistributor::do_Store2CurFile( DYN ary::doc::Node & let_drDocu )
107 {
108     // KORR_FUTURE
109     delete &let_drDocu;
110 }
111 
112 void
113 ContextForAry::
do_Store2CurNamespace(DYN ary::doc::Node & let_drDocu)114 S_DocuDistributor::do_Store2CurNamespace( DYN ary::doc::Node & let_drDocu )
115 {
116     // KORR_FUTURE
117     delete &let_drDocu;
118 }
119 
120 void
121 ContextForAry::
do_Store2ConnectedDeclaration(DYN ary::doc::Node & let_drDocu)122 S_DocuDistributor::do_Store2ConnectedDeclaration( DYN ary::doc::Node & let_drDocu )
123 {
124     if ( pCurRe != 0 )
125         pCurRe->Set_Docu(let_drDocu);
126     else
127         pLastStoredDocu = &let_drDocu;
128 }
129 
130 void
131 ContextForAry::
do_Store2Glossary(DYN ary::doc::Node & let_drDocu,const String &)132 S_DocuDistributor::do_Store2Glossary( DYN ary::doc::Node & let_drDocu,
133 							          const String &	       // i_sExplainedTerm
134                                       )
135 {
136     // KORR_FUTURE
137     delete &let_drDocu;
138 }
139 
140 void
141 ContextForAry::
do_Store2GlobalTexts(DYN ary::doc::Node & let_drDocu,ary::info::GlobalTextId)142 S_DocuDistributor::do_Store2GlobalTexts( DYN ary::doc::Node &       let_drDocu,
143 							             ary::info::GlobalTextId    // i_nId
144 							           )
145 {
146     // KORR_FUTURE
147     delete &let_drDocu;
148 }
149 
150 
151 
152 
153 }   // namespace cpp
154 #endif
155