You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
95 lines
2.1 KiB
95 lines
2.1 KiB
/***************************************************************************
|
|
begin : Die Sep 16 2003
|
|
copyright : (C) 2003 by Jeroen Wijnhout
|
|
email : wijnhout@science.uva.nl
|
|
***************************************************************************/
|
|
|
|
/***************************************************************************
|
|
* *
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
* it under the terms of the GNU General Public License as published by *
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
* (at your option) any later version. *
|
|
* *
|
|
***************************************************************************/
|
|
|
|
#include "outputfilter.h"
|
|
|
|
#include <tqfile.h>
|
|
#include <tqregexp.h>
|
|
#include <tqfileinfo.h>
|
|
|
|
#include "kiledebug.h"
|
|
#include <ktextedit.h>
|
|
#include <tdelocale.h>
|
|
|
|
#include "kiletool_enums.h"
|
|
|
|
using namespace std;
|
|
|
|
OutputFilter::OutputFilter() :
|
|
m_log(TQString())
|
|
{
|
|
}
|
|
|
|
OutputFilter::~ OutputFilter()
|
|
{
|
|
}
|
|
|
|
short OutputFilter::parseLine(const TQString & /*strLine*/, short /*dwCookie*/)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
|
|
bool OutputFilter::OnTerminate()
|
|
{
|
|
return true;
|
|
}
|
|
|
|
void OutputFilter::setSource(const TQString &src)
|
|
{
|
|
m_source = src;
|
|
m_srcPath = TQFileInfo(src).dirPath();
|
|
}
|
|
|
|
bool OutputFilter::Run(const TQString & logfile)
|
|
{
|
|
short sCookie = 0;
|
|
TQString s;
|
|
TQFile f(logfile);
|
|
|
|
m_log = TQString();
|
|
m_nOutputLines = 0;
|
|
|
|
if ( f.open(IO_ReadOnly) )
|
|
{
|
|
TQTextStream t( &f );
|
|
while ( !t.eof() )
|
|
{
|
|
// KILE_DEBUG() << "line " << m_nOutputLines << endl;
|
|
s = t.readLine() + '\n';
|
|
sCookie = parseLine(s.stripWhiteSpace(), sCookie);
|
|
++m_nOutputLines;
|
|
|
|
m_log += s;
|
|
}
|
|
f.close();
|
|
}
|
|
else
|
|
{
|
|
emit(problem(KileTool::Warning, i18n("Cannot open log file; did you run LaTeX?")));
|
|
return false;
|
|
}
|
|
|
|
return OnTerminate();
|
|
}
|
|
|
|
|
|
int OutputFilter::GetCurrentOutputLine() const
|
|
{
|
|
return m_nOutputLines;
|
|
}
|
|
|
|
#include "outputfilter.moc"
|