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 #include <precomp.h>
23 #include "tkp_cpp.hxx"
24 
25 // NOT FULLY DECLARED SERVICES
26 #include "cx_c_std.hxx"
27 #include "c_dealer.hxx"
28 
29 
30 namespace cpp {
31 
32 
33 
34 
TokenParser_Cpp(DYN autodoc::TkpDocuContext & let_drDocuContext)35 TokenParser_Cpp::TokenParser_Cpp( DYN autodoc::TkpDocuContext & let_drDocuContext )
36 	:	pBaseContext( new Context_CppStd( let_drDocuContext ) ),
37         pCurContext(0),
38         pDealer(0),
39         pCharacterSource(0)
40 {
41 	SetStartContext();
42 }
43 
~TokenParser_Cpp()44 TokenParser_Cpp::~TokenParser_Cpp()
45 {
46 }
47 
48 void
AssignPartners(CharacterSource & io_rCharacterSource,cpp::Distributor & o_rDealer)49 TokenParser_Cpp::AssignPartners( CharacterSource &   io_rCharacterSource,
50 							     cpp::Distributor &  o_rDealer )
51 {
52     pDealer = &o_rDealer;
53     pBaseContext->AssignDealer(o_rDealer);
54     pCharacterSource = &io_rCharacterSource;
55 }
56 
57 void
StartNewFile(const csv::ploc::Path & i_file)58 TokenParser_Cpp::StartNewFile( const csv::ploc::Path & i_file )
59 {
60     csv_assert(pDealer != 0);
61     pDealer->StartNewFile(i_file);
62 
63     csv_assert(pCharacterSource != 0);
64     Start(*pCharacterSource);
65 }
66 
67 void
SetStartContext()68 TokenParser_Cpp::SetStartContext()
69 {
70 	pCurContext = pBaseContext.Ptr();
71 }
72 
73 void
SetCurrentContext(TkpContext & io_rContext)74 TokenParser_Cpp::SetCurrentContext( TkpContext & io_rContext )
75 {
76 	pCurContext = &io_rContext;
77 }
78 
79 TkpContext &
CurrentContext()80 TokenParser_Cpp::CurrentContext()
81 {
82 	return *pCurContext;
83 }
84 
85 }   // namespace cpp
86 
87