File: processhandle.h

package info (click to toggle)
actionaz 3.8.0-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 5,608 kB
  • ctags: 6,390
  • sloc: cpp: 44,713; ansic: 82; xml: 17; makefile: 14; sh: 10
file content (74 lines) | stat: -rw-r--r-- 1,492 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*
	Contact : jmgr@jmgr.info
*/

#ifndef PROCESSHANDLE_H
#define PROCESSHANDLE_H

#include "actiontools_global.h"
#include "crossplatform.h"
#include "code/codeclass.h"

#include <QObject>
#include <QScriptValue>
#include <QScriptEngine>

namespace Code
{
	class ACTIONTOOLSSHARED_EXPORT ProcessHandle : public CodeClass
	{
		Q_OBJECT
		Q_ENUMS(KillMode)
		Q_ENUMS(Priority)

	public:
		enum KillMode
		{
			Graceful,
			Forceful,
			GracefulThenForceful
		};
		enum Priority
		{
			AboveNormal,
			BelowNormal,
			High,
			Idle,
			Normal,
			Realtime
		};

		static QScriptValue constructor(QScriptContext *context, QScriptEngine *engine);
		static QScriptValue constructor(int processId, QScriptEngine *engine);
		static int parameter(QScriptContext *context, QScriptEngine *engine);

		static void registerClass(QScriptEngine *scriptEngine);

		ProcessHandle();
		ProcessHandle(const ProcessHandle &other);
		ProcessHandle(int processId);

		ProcessHandle &operator=(ProcessHandle other);
		ProcessHandle &operator=(int processId);

		void swap(ProcessHandle &other);
		void swap(int &processId);

		int processId() const;

	public slots:
		QScriptValue clone() const;
		bool equals(const QScriptValue &other) const;
		QString toString() const;
		int id() const;
		bool kill(KillMode killMode = GracefulThenForceful, int timeout = 3000) const;
		bool isRunning() const;
		QString command() const;
		Priority priority() const;

	private:
		int mProcessId;
	};
}

#endif // PROCESSHANDLE_H