Debian Codegraph @

CodeLite/cl_process.h

raw
1 //////////////////////////////////////////////////////////////////////////////
2 //////////////////////////////////////////////////////////////////////////////
3 //
4 // copyright : (C) 2008 by Eran Ifrah
5 // file name : cl_process.h
6 //
7 // -------------------------------------------------------------------------
8 // A
9 // _____ _ _ _ _
10 // / __ \ | | | | (_) |
11 // | / \/ ___ __| | ___| | _| |_ ___
12 // | | / _ \ / _ |/ _ \ | | | __/ _ )
13 // | \__/\ (_) | (_| | __/ |___| | || __/
14 // \____/\___/ \__,_|\___\_____/_|\__\___|
15 //
16 // F i l e
17 //
18 // This program is free software; you can redistribute it and/or modify
19 // it under the terms of the GNU General Public License as published by
20 // the Free Software Foundation; either version 2 of the License, or
21 // (at your option) any later version.
22 //
23 //////////////////////////////////////////////////////////////////////////////
24 //////////////////////////////////////////////////////////////////////////////
25 #ifndef CODELITE_TAGSPROCESS_H
26 #define CODELITE_TAGSPROCESS_H
27
28 #include "wx/process.h"
29 #include "wx/string.h"
30 #include "codelite_exports.h"
31 #include <wx/utils.h>
32
33 /**
34 * \ingroup CodeLite
35 * \brief this class represents a cross platform process
36 *
37 * \version 1.0
38 * first version
39 *
40 * \date 05-04-2007
41 *
42 * \author Eran
43 */
44 class WXDLLIMPEXP_CL clProcess : public wxProcess
45 {
46 long m_pid;
47 int m_uid;
48 int m_type;
49 wxString m_cmd;
50 bool m_redirect;
51
52 public:
53 /**
54 * Constructs a process object. id is only used in the case you want to use wxWidgets events.
55 * It identifies this object, or another window that will receive the event.
56 */
57 clProcess(int id, const wxString& cmdLine, bool redirect = true);
58
59 virtual ~clProcess();
60
61 /**
62 * \return return the process id
63 */
64 long GetPid();
65
66 /**
67 * \param set the process ID
68 */
69 void SetPid(long pid);
70
71 // int GetId() { return m_id; }
72
73 /**
74 * Kill the process
75 */
76 void Terminate(wxSignal signalNo = wxSIGKILL);
77
78 /**
79 * Start the process
80 * \return the process id
81 */
82 long Start(bool hide = true);
83
84 int GetUid() { return m_uid; }
85 void SetType(int type) { m_type = type; }
86 int GetType() const { return m_type; }
87 void SetCommand(const wxString& cmd) { m_cmd = cmd; }
88 bool HasInput(wxString& input, wxString& errors);
89
90 /**
91 * Read all process output & error
92 * \param input [output]
93 * \param errors [output]
94 * \return
95 */
96 bool ReadAll(wxString& input, wxString& errors);
97
98 /**
99 * Write text to the process
100 * \param text
101 * \return true on success, false otherwise
102 */
103 bool Write(const wxString& text);
104
105 // Getters
106 const bool& GetRedirect() const { return m_redirect; }
107 };
108
109 #endif // CODELITE_TAGSPROCESS_H