FEATURE: (contracted in prokde35)
[kdepim.git] / libkdepim / collectingprocess.h
blob3e00626b390732a7879cdfed2896a420313bee71
1 /* -*- mode: C++ -*-
2 collectingprocess.h
4 This file is part of libkdepim.
5 Copyright (c) 2004 Ingo Kloecker <kloecker@kde.org>
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License as
9 published by the Free Software Foundation; either version 2 of the
10 License, or (at your option) any later version.
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 In addition, as a special exception, the copyright holders give
22 permission to link the code of this program with any edition of
23 the Qt library by Trolltech AS, Norway (or with modified versions
24 of Qt that use the same license as Qt), and distribute linked
25 combinations including the two. You must obey the GNU General
26 Public License in all respects for all of the code used other than
27 Qt. If you modify this file, you may extend this exception to
28 your version of the file, but you are not obligated to do so. If
29 you do not wish to do so, delete this exception statement from
30 your version.
33 #ifndef __KPIM_COLLECTINGPROCESS_H__
34 #define __KPIM_COLLECTINGPROCESS_H__
36 #include <k3process.h>
37 #include <kdepim_export.h>
39 namespace KPIM {
41 /**
42 * @short An output collecting K3Process class.
44 * This class simplifies the usage of K3Process by collecting all output
45 * (stdout/stderr) of the process.
47 * @author Ingo Kloecker <kloecker@kde.org>
49 class KDEPIM_EXPORT CollectingProcess : public K3Process {
50 Q_OBJECT
51 public:
52 CollectingProcess( QObject * parent = 0, const char * name = 0 );
53 ~CollectingProcess();
55 /** Starts the process in NotifyOnExit mode and writes in to stdin of
56 the process.
58 bool start( RunMode runmode, Communication comm );
60 /** Returns the contents of the stdout buffer and clears it afterwards. */
61 QByteArray collectedStdout();
62 /** Returns the contents of the stderr buffer and clears it afterwards. */
63 QByteArray collectedStderr();
65 private slots:
66 void slotReceivedStdout( K3Process *, char *, int );
67 void slotReceivedStderr( K3Process *, char *, int );
69 private:
70 class Private;
71 Private * d;
75 } // namespace KPIM
77 #endif // __KPIM_COLLECTINGPROCESS_H__