1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: c_dealer.cxx,v $
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 ************************************************************************/
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"
60 Distributor::Distributor( ary::cpp::Gate
& io_rAryGate
)
62 aCodeExplorer(io_rAryGate
),
68 pFileEventHandler
= & aCodeExplorer
.FileEventHandler();
69 pDocuDistributor
= & aCodeExplorer
.DocuDistributor();
73 Distributor::AssignPartners( CharacterSource
& io_rSourceText
,
74 const MacroMap
& i_rValidMacros
)
76 aCppPreProcessor
.AssignPartners(aCodeExplorer
, io_rSourceText
, i_rValidMacros
);
79 Distributor::~Distributor()
84 Distributor::StartNewFile( const csv::ploc::Path
& i_file
)
86 const csv::ploc::Root
&
87 root_dir
= i_file
.RootDir();
92 root_path( sl().c_str(), true );
94 root_id
= pGate
->Locations().CheckIn_Root(root_path
).LeId();
96 rFile
= pGate
->Locations().CheckIn_File(
100 pFileEventHandler
->SetCurFile(rFile
);
102 aCodeExplorer
.StartNewFile();
104 csv_assert( pDocuDistributor
!= 0 );
105 aDocuExplorer
.StartNewFile(*pDocuDistributor
);
110 Distributor::Deal_Eol()
112 pFileEventHandler
->Event_IncrLineCount();
116 Distributor::Deal_Eof()
122 Distributor::Deal_Cpp_UnblockMacro( Tok_UnblockMacro
& let_drToken
)
124 aCppPreProcessor
.UnblockMacro(let_drToken
.Text());
129 Distributor::Deal_CppCode( cpp::Token
& let_drToken
)
131 aCppPreProcessor
.Process_Token(let_drToken
);
135 Distributor::Deal_AdcDocu( adoc::Token
& let_drToken
)
137 aDocuExplorer
.Process_Token(let_drToken
);
141 Distributor::AsDistributor()