2002-03-08 13:45:36 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2005-09-07 17:14:39 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2002-03-08 13:45:36 +00:00
|
|
|
*
|
2005-09-07 17:14:39 +00:00
|
|
|
* $RCSfile: c_dealer.cxx,v $
|
2002-03-08 13:45:36 +00:00
|
|
|
*
|
2007-11-02 15:47:59 +00:00
|
|
|
* $Revision: 1.7 $
|
2002-03-08 13:45:36 +00:00
|
|
|
*
|
2007-11-02 15:47:59 +00:00
|
|
|
* last change: $Author: hr $ $Date: 2007-11-02 16:47:59 $
|
2002-03-08 13:45:36 +00:00
|
|
|
*
|
2005-09-07 17:14:39 +00:00
|
|
|
* The Contents of this file are made available subject to
|
|
|
|
* the terms of GNU Lesser General Public License Version 2.1.
|
2002-03-08 13:45:36 +00:00
|
|
|
*
|
|
|
|
*
|
2005-09-07 17:14:39 +00:00
|
|
|
* GNU Lesser General Public License Version 2.1
|
|
|
|
* =============================================
|
|
|
|
* Copyright 2005 by Sun Microsystems, Inc.
|
|
|
|
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
2002-03-08 13:45:36 +00:00
|
|
|
*
|
2005-09-07 17:14:39 +00:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License version 2.1, as published by the Free Software Foundation.
|
2002-03-08 13:45:36 +00:00
|
|
|
*
|
2005-09-07 17:14:39 +00:00
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
2002-03-08 13:45:36 +00:00
|
|
|
*
|
2005-09-07 17:14:39 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
|
|
* MA 02111-1307 USA
|
2002-03-08 13:45:36 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
#include <precomp.h>
|
|
|
|
#include "c_dealer.hxx"
|
|
|
|
|
|
|
|
|
|
|
|
// NOT FULLY DECLARED SERVICES
|
2007-11-02 15:47:59 +00:00
|
|
|
#include <ary/cpp/c_gate.hxx>
|
|
|
|
#include <ary/loc/locp_le.hxx>
|
2002-03-08 13:45:36 +00:00
|
|
|
#include <ary/loc/loc_root.hxx>
|
|
|
|
#include <ary/loc/loc_file.hxx>
|
2007-11-02 15:47:59 +00:00
|
|
|
//#include <ary/docu.hxx>
|
2002-03-08 13:45:36 +00:00
|
|
|
#include <adoc/a_rdocu.hxx>
|
|
|
|
#include "all_toks.hxx"
|
|
|
|
#include "c_rcode.hxx"
|
|
|
|
|
|
|
|
|
|
|
|
namespace ary
|
|
|
|
{
|
2007-11-02 15:47:59 +00:00
|
|
|
namespace loc
|
|
|
|
{
|
|
|
|
class Root;
|
|
|
|
}
|
2002-03-08 13:45:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace cpp
|
|
|
|
{
|
|
|
|
|
2007-11-02 15:47:59 +00:00
|
|
|
Distributor::Distributor( ary::cpp::Gate & io_rAryGate )
|
|
|
|
: aCppPreProcessor(),
|
2002-03-08 13:45:36 +00:00
|
|
|
aCodeExplorer(io_rAryGate),
|
2007-11-02 15:47:59 +00:00
|
|
|
aDocuExplorer(),
|
2002-03-08 13:45:36 +00:00
|
|
|
pGate(&io_rAryGate),
|
|
|
|
pFileEventHandler(0),
|
|
|
|
pDocuDistributor(0)
|
|
|
|
{
|
|
|
|
pFileEventHandler = & aCodeExplorer.FileEventHandler();
|
|
|
|
pDocuDistributor = & aCodeExplorer.DocuDistributor();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Distributor::AssignPartners( CharacterSource & io_rSourceText,
|
|
|
|
const MacroMap & i_rValidMacros )
|
|
|
|
{
|
|
|
|
aCppPreProcessor.AssignPartners(aCodeExplorer, io_rSourceText, i_rValidMacros);
|
|
|
|
}
|
|
|
|
|
|
|
|
Distributor::~Distributor()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2007-11-02 15:47:59 +00:00
|
|
|
Distributor::StartNewFile( const csv::ploc::Path & i_file )
|
2002-03-08 13:45:36 +00:00
|
|
|
{
|
2007-11-02 15:47:59 +00:00
|
|
|
const csv::ploc::Root &
|
|
|
|
root_dir = i_file.RootDir();
|
|
|
|
StreamLock
|
|
|
|
sl(700);
|
|
|
|
root_dir.Get(sl());
|
|
|
|
csv::ploc::Path
|
|
|
|
root_path( sl().c_str(), true );
|
|
|
|
ary::loc::Le_id
|
|
|
|
root_id = pGate->Locations().CheckIn_Root(root_path).LeId();
|
|
|
|
ary::loc::File &
|
|
|
|
rFile = pGate->Locations().CheckIn_File(
|
|
|
|
i_file.File(),
|
|
|
|
i_file.DirChain(),
|
|
|
|
root_id );
|
|
|
|
pFileEventHandler->SetCurFile(rFile);
|
2002-03-08 13:45:36 +00:00
|
|
|
|
|
|
|
aCodeExplorer.StartNewFile();
|
|
|
|
|
|
|
|
csv_assert( pDocuDistributor != 0 );
|
|
|
|
aDocuExplorer.StartNewFile(*pDocuDistributor);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
Distributor::Deal_Eol()
|
|
|
|
{
|
|
|
|
pFileEventHandler->Event_IncrLineCount();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Distributor::Deal_Eof()
|
|
|
|
{
|
|
|
|
// Do nothing yet.
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Distributor::Deal_Cpp_UnblockMacro( Tok_UnblockMacro & let_drToken )
|
|
|
|
{
|
|
|
|
aCppPreProcessor.UnblockMacro(let_drToken.Text());
|
|
|
|
delete &let_drToken;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Distributor::Deal_CppCode( cpp::Token & let_drToken )
|
|
|
|
{
|
|
|
|
aCppPreProcessor.Process_Token(let_drToken);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Distributor::Deal_AdcDocu( adoc::Token & let_drToken )
|
|
|
|
{
|
|
|
|
aDocuExplorer.Process_Token(let_drToken);
|
|
|
|
}
|
|
|
|
|
2002-05-07 17:32:25 +00:00
|
|
|
Distributor *
|
|
|
|
Distributor::AsDistributor()
|
|
|
|
{
|
|
|
|
return this;
|
|
|
|
}
|
2002-03-08 13:45:36 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace cpp
|
|
|
|
|
|
|
|
|