1*78bc99aaSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*78bc99aaSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*78bc99aaSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*78bc99aaSAndrew Rist  * distributed with this work for additional information
6*78bc99aaSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*78bc99aaSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*78bc99aaSAndrew Rist  * "License"); you may not use this file except in compliance
9*78bc99aaSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*78bc99aaSAndrew Rist  *
11*78bc99aaSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*78bc99aaSAndrew Rist  *
13*78bc99aaSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*78bc99aaSAndrew Rist  * software distributed under the License is distributed on an
15*78bc99aaSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*78bc99aaSAndrew Rist  * KIND, either express or implied.  See the License for the
17*78bc99aaSAndrew Rist  * specific language governing permissions and limitations
18*78bc99aaSAndrew Rist  * under the License.
19*78bc99aaSAndrew Rist  *
20*78bc99aaSAndrew Rist  *************************************************************/
21cdf0e10cSrcweir 
22cdf0e10cSrcweir #include <precomp.h>
23cdf0e10cSrcweir #include "tkp_cpp.hxx"
24cdf0e10cSrcweir 
25cdf0e10cSrcweir // NOT FULLY DECLARED SERVICES
26cdf0e10cSrcweir #include "cx_c_std.hxx"
27cdf0e10cSrcweir #include "c_dealer.hxx"
28cdf0e10cSrcweir 
29cdf0e10cSrcweir 
30cdf0e10cSrcweir namespace cpp {
31cdf0e10cSrcweir 
32cdf0e10cSrcweir 
33cdf0e10cSrcweir 
34cdf0e10cSrcweir 
TokenParser_Cpp(DYN autodoc::TkpDocuContext & let_drDocuContext)35cdf0e10cSrcweir TokenParser_Cpp::TokenParser_Cpp( DYN autodoc::TkpDocuContext & let_drDocuContext )
36cdf0e10cSrcweir 	:	pBaseContext( new Context_CppStd( let_drDocuContext ) ),
37cdf0e10cSrcweir         pCurContext(0),
38cdf0e10cSrcweir         pDealer(0),
39cdf0e10cSrcweir         pCharacterSource(0)
40cdf0e10cSrcweir {
41cdf0e10cSrcweir 	SetStartContext();
42cdf0e10cSrcweir }
43cdf0e10cSrcweir 
~TokenParser_Cpp()44cdf0e10cSrcweir TokenParser_Cpp::~TokenParser_Cpp()
45cdf0e10cSrcweir {
46cdf0e10cSrcweir }
47cdf0e10cSrcweir 
48cdf0e10cSrcweir void
AssignPartners(CharacterSource & io_rCharacterSource,cpp::Distributor & o_rDealer)49cdf0e10cSrcweir TokenParser_Cpp::AssignPartners( CharacterSource &   io_rCharacterSource,
50cdf0e10cSrcweir 							     cpp::Distributor &  o_rDealer )
51cdf0e10cSrcweir {
52cdf0e10cSrcweir     pDealer = &o_rDealer;
53cdf0e10cSrcweir     pBaseContext->AssignDealer(o_rDealer);
54cdf0e10cSrcweir     pCharacterSource = &io_rCharacterSource;
55cdf0e10cSrcweir }
56cdf0e10cSrcweir 
57cdf0e10cSrcweir void
StartNewFile(const csv::ploc::Path & i_file)58cdf0e10cSrcweir TokenParser_Cpp::StartNewFile( const csv::ploc::Path & i_file )
59cdf0e10cSrcweir {
60cdf0e10cSrcweir     csv_assert(pDealer != 0);
61cdf0e10cSrcweir     pDealer->StartNewFile(i_file);
62cdf0e10cSrcweir 
63cdf0e10cSrcweir     csv_assert(pCharacterSource != 0);
64cdf0e10cSrcweir     Start(*pCharacterSource);
65cdf0e10cSrcweir }
66cdf0e10cSrcweir 
67cdf0e10cSrcweir void
SetStartContext()68cdf0e10cSrcweir TokenParser_Cpp::SetStartContext()
69cdf0e10cSrcweir {
70cdf0e10cSrcweir 	pCurContext = pBaseContext.Ptr();
71cdf0e10cSrcweir }
72cdf0e10cSrcweir 
73cdf0e10cSrcweir void
SetCurrentContext(TkpContext & io_rContext)74cdf0e10cSrcweir TokenParser_Cpp::SetCurrentContext( TkpContext & io_rContext )
75cdf0e10cSrcweir {
76cdf0e10cSrcweir 	pCurContext = &io_rContext;
77cdf0e10cSrcweir }
78cdf0e10cSrcweir 
79cdf0e10cSrcweir TkpContext &
CurrentContext()80cdf0e10cSrcweir TokenParser_Cpp::CurrentContext()
81cdf0e10cSrcweir {
82cdf0e10cSrcweir 	return *pCurContext;
83cdf0e10cSrcweir }
84cdf0e10cSrcweir 
85cdf0e10cSrcweir }   // namespace cpp
86cdf0e10cSrcweir 
87