diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-02-24 01:49:02 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-02-24 01:49:02 +0000 |
commit | 5de3dd4762ca33a0f92e79ffa4fe2ff67069d531 (patch) | |
tree | bad482b7afa4cdf47422d60a5dd2c61c7e333b09 /src/languages/externallanguage.h | |
download | ktechlab-5de3dd4762ca33a0f92e79ffa4fe2ff67069d531.tar.gz ktechlab-5de3dd4762ca33a0f92e79ffa4fe2ff67069d531.zip |
Added KDE3 version of ktechlab
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/ktechlab@1095338 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/languages/externallanguage.h')
-rw-r--r-- | src/languages/externallanguage.h | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/src/languages/externallanguage.h b/src/languages/externallanguage.h new file mode 100644 index 0000000..401c2b8 --- /dev/null +++ b/src/languages/externallanguage.h @@ -0,0 +1,97 @@ +/*************************************************************************** + * Copyright (C) 2005 by David Saxton * + * david@bluehaze.org * + * * + * 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. * + ***************************************************************************/ + +#ifndef EXTERNALLANGUAGE_H +#define EXTERNALLANGUAGE_H + +#include "language.h" + +class KProcess; + +/** +Base class for Language support that relies on an external program; so this +class provides functionality for dealing with external processes. + +@author Daniel Clarke +@author David Saxton +*/ +class ExternalLanguage : public Language +{ +Q_OBJECT +public: + ExternalLanguage( ProcessChain *processChain, KTechlab *parent, const QString &name ); + ~ExternalLanguage(); + +protected slots: + void receivedStdout( KProcess *, char * buffer, int buflen ); + void receivedStderr( KProcess *, char * buffer, int buflen ); + void processExited( KProcess * ); + +protected: + /** + * Call this to start the language process. ExternalLanguage will ensure + * that communication et all is properly set up. + * @return true on success, false on error + */ + bool start(); + /** + * @returns whether the string outputted to stdout is an error or not + */ + virtual bool isError( const QString &message ) const = 0; + /** + * @returns whether the string outputted to stderr is fatal (stopped compilation) + */ + virtual bool isStderrOutputFatal( const QString & message ) const { Q_UNUSED(message); return true; } + /** + * @returns whether the string outputted to stdout is a warning or not + */ + virtual bool isWarning( const QString &message ) const = 0; + /** + * Called when the process outputs a (non warning/error) message + */ + virtual void outputtedMessage( const QString &/*message*/ ) {}; + /** + * Called when the process outputs a warning + */ + virtual void outputtedWarning( const QString &/*message*/ ) {}; + /** + * Called when the process outputs an error + */ + virtual void outputtedError( const QString &/*message*/ ) {}; + /** + * Called when the process exits (called before any signals are emitted, + * etc). If you reinherit this function, you should return whether + * everything is OK. + */ + virtual bool processExited( bool successfully ) { return successfully; } + /** + * Call this function if your process could not be started - the process + * will be deleted, and a failure signal emitted. + */ + void processInitFailed(); + /** + * Disconnects and deletes the language's process. + */ + void deleteLanguageProcess(); + /** + * Creates process and makes connections, ready for the derived class to + * add arguments and start the process. + */ + void resetLanguageProcess(); + /** + * Prints out the command used for running the process, with any arguments + * that contain spaces put into quotation marks. + */ + void displayProcessCommand(); + + KProcess * m_languageProcess; +}; + +#endif |