Update ooo320-m1
[ooovba.git] / autodoc / source / parser / cpp / c_dealer.cxx
bloba9a4605a926a2158f8ec7241d3d49b652523ccf7
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: c_dealer.cxx,v $
10 * $Revision: 1.8 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #include <precomp.h>
32 #include "c_dealer.hxx"
35 // NOT FULLY DECLARED SERVICES
36 #include <ary/cpp/c_gate.hxx>
37 #include <ary/loc/locp_le.hxx>
38 #include <ary/loc/loc_root.hxx>
39 #include <ary/loc/loc_file.hxx>
40 //#include <ary/docu.hxx>
41 #include <adoc/a_rdocu.hxx>
42 #include "all_toks.hxx"
43 #include "c_rcode.hxx"
46 namespace ary
48 namespace loc
50 class Root;
57 namespace cpp
60 Distributor::Distributor( ary::cpp::Gate & io_rAryGate )
61 : aCppPreProcessor(),
62 aCodeExplorer(io_rAryGate),
63 aDocuExplorer(),
64 pGate(&io_rAryGate),
65 pFileEventHandler(0),
66 pDocuDistributor(0)
68 pFileEventHandler = & aCodeExplorer.FileEventHandler();
69 pDocuDistributor = & aCodeExplorer.DocuDistributor();
72 void
73 Distributor::AssignPartners( CharacterSource & io_rSourceText,
74 const MacroMap & i_rValidMacros )
76 aCppPreProcessor.AssignPartners(aCodeExplorer, io_rSourceText, i_rValidMacros);
79 Distributor::~Distributor()
83 void
84 Distributor::StartNewFile( const csv::ploc::Path & i_file )
86 const csv::ploc::Root &
87 root_dir = i_file.RootDir();
88 StreamLock
89 sl(700);
90 root_dir.Get(sl());
91 csv::ploc::Path
92 root_path( sl().c_str(), true );
93 ary::loc::Le_id
94 root_id = pGate->Locations().CheckIn_Root(root_path).LeId();
95 ary::loc::File &
96 rFile = pGate->Locations().CheckIn_File(
97 i_file.File(),
98 i_file.DirChain(),
99 root_id );
100 pFileEventHandler->SetCurFile(rFile);
102 aCodeExplorer.StartNewFile();
104 csv_assert( pDocuDistributor != 0 );
105 aDocuExplorer.StartNewFile(*pDocuDistributor);
109 void
110 Distributor::Deal_Eol()
112 pFileEventHandler->Event_IncrLineCount();
115 void
116 Distributor::Deal_Eof()
118 // Do nothing yet.
121 void
122 Distributor::Deal_Cpp_UnblockMacro( Tok_UnblockMacro & let_drToken )
124 aCppPreProcessor.UnblockMacro(let_drToken.Text());
125 delete &let_drToken;
128 void
129 Distributor::Deal_CppCode( cpp::Token & let_drToken )
131 aCppPreProcessor.Process_Token(let_drToken);
134 void
135 Distributor::Deal_AdcDocu( adoc::Token & let_drToken )
137 aDocuExplorer.Process_Token(let_drToken);
140 Distributor *
141 Distributor::AsDistributor()
143 return this;
150 } // namespace cpp