Commit c5991281 authored by Tobias Hunger's avatar Tobias Hunger
Browse files

Extend ioutputparser interface to improve testability

parent d7b927f2
......@@ -34,7 +34,6 @@ namespace ProjectExplorer {
IOutputParser::IOutputParser() : m_parser(0)
{
}
IOutputParser::~IOutputParser()
......@@ -57,6 +56,18 @@ void IOutputParser::appendOutputParser(IOutputParser *parser)
this, SLOT(taskAdded(ProjectExplorer::TaskWindow::Task)));
}
IOutputParser *IOutputParser::takeOutputParserChain()
{
IOutputParser *parser = m_parser;
m_parser = 0;
return parser;
}
IOutputParser *IOutputParser::childParser() const
{
return m_parser;
}
void IOutputParser::stdOutput(const QString &line)
{
if (m_parser)
......
......@@ -47,7 +47,15 @@ public:
/// Append a subparser to this parser.
/// IOutputParser will take ownership.
void appendOutputParser(IOutputParser *parser);
virtual void appendOutputParser(IOutputParser *parser);
/// Remove the appended outputparser chain frm this parser.
/// This method transferes ownership of the parser chain to the caller!
IOutputParser *takeOutputParserChain();
/// Return the head of this parsers output parser children
/// IOutputParser keeps ownership!
IOutputParser *childParser() const;
/// Called once for each line if standard output to parse.
virtual void stdOutput(const QString &line);
......
......@@ -40,6 +40,7 @@ class SessionManager;
class IApplicationOutput;
class IOutputParser;
class GlobalConfigManagerInterface;
struct TaskWindow::Task;
namespace Internal {
class CommandQObject;
......@@ -56,5 +57,6 @@ Q_DECLARE_METATYPE(ProjectExplorer::IOutputParser*)
Q_DECLARE_METATYPE(ProjectExplorer::GlobalConfigManagerInterface*)
Q_DECLARE_METATYPE(ProjectExplorer::TaskWindow::Task)
Q_DECLARE_METATYPE(QList<ProjectExplorer::TaskWindow::Task>)
#endif // PROJECTEXPLORERMETATYPEDECLARATIONS_H
......@@ -492,6 +492,7 @@ TaskWindow::TaskWindow()
m_categoriesButton->setMenu(m_categoriesMenu);
qRegisterMetaType<ProjectExplorer::TaskWindow::Task>("ProjectExplorer::TaskWindow::Task");
qRegisterMetaType<QList<ProjectExplorer::TaskWindow::Task> >("QList<ProjectExplorer::TaskWindow::Task>");
updateActions();
}
......
......@@ -71,6 +71,10 @@ public:
const QString &file_, int line_, const QString &category_) :
type(type_), description(description_), file(file_), line(line_), category(category_)
{ }
Task(const Task &source) :
type(source.type), description(source.description), file(source.file),
line(source.line), category(source.category)
{ }
~Task()
{ }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment