updated api documentation
[urpo] / www / apidoc / html / urpoprocess_8h_source.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2 <html xmlns="http://www.w3.org/1999/xhtml">
3 <head>
4 <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
5 <title>Urpo: src/urpoprocess.h Source File</title>
6 <link href="tabs.css" rel="stylesheet" type="text/css"/>
7 <link href="doxygen.css" rel="stylesheet" type="text/css"/>
8 </head>
9 <body>
10 <!-- Generated by Doxygen 1.6.3 -->
11 <div class="navigation" id="top">
12   <div class="tabs">
13     <ul>
14       <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
15       <li><a href="annotated.html"><span>Classes</span></a></li>
16       <li class="current"><a href="files.html"><span>Files</span></a></li>
17     </ul>
18   </div>
19   <div class="tabs">
20     <ul>
21       <li><a href="files.html"><span>File&nbsp;List</span></a></li>
22     </ul>
23   </div>
24 <h1>src/urpoprocess.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/**************************************************************************</span>
25 <a name="l00002"></a>00002 <span class="comment"></span>
26 <a name="l00003"></a>00003 <span class="comment">    URPO</span>
27 <a name="l00004"></a>00004 <span class="comment"></span>
28 <a name="l00005"></a>00005 <span class="comment">    Unix Remote Printing Operation</span>
29 <a name="l00006"></a>00006 <span class="comment">    Copyright (c) Arto Hyvättinen 2010</span>
30 <a name="l00007"></a>00007 <span class="comment"></span>
31 <a name="l00008"></a>00008 <span class="comment">    This file is part of URPO.</span>
32 <a name="l00009"></a>00009 <span class="comment"></span>
33 <a name="l00010"></a>00010 <span class="comment">    URPO is free software: you can redistribute it and/or modify</span>
34 <a name="l00011"></a>00011 <span class="comment">    it under the terms of the GNU General Public License as published by</span>
35 <a name="l00012"></a>00012 <span class="comment">    the Free Software Foundation, either version 3 of the License, or</span>
36 <a name="l00013"></a>00013 <span class="comment">    (at your option) any later version.</span>
37 <a name="l00014"></a>00014 <span class="comment"></span>
38 <a name="l00015"></a>00015 <span class="comment">    URPO is distributed in the hope that it will be useful,</span>
39 <a name="l00016"></a>00016 <span class="comment">    but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
40 <a name="l00017"></a>00017 <span class="comment">    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span>
41 <a name="l00018"></a>00018 <span class="comment">    GNU General Public License for more details.</span>
42 <a name="l00019"></a>00019 <span class="comment"></span>
43 <a name="l00020"></a>00020 <span class="comment"></span>
44 <a name="l00021"></a>00021 <span class="comment">**************************************************************************/</span>
45 <a name="l00022"></a>00022 
46 <a name="l00023"></a>00023 <span class="preprocessor">#ifndef URPOPROCESS_H</span>
47 <a name="l00024"></a>00024 <span class="preprocessor"></span><span class="preprocessor">#define URPOPROCESS_H</span>
48 <a name="l00025"></a>00025 <span class="preprocessor"></span>
49 <a name="l00026"></a>00026 <span class="preprocessor">#include &lt;QObject&gt;</span>
50 <a name="l00027"></a>00027 <span class="preprocessor">#include &lt;QStringList&gt;</span>
51 <a name="l00028"></a>00028 <span class="preprocessor">#include &lt;QString&gt;</span>
52 <a name="l00029"></a>00029 <span class="preprocessor">#include &lt;QProcess&gt;</span>
53 <a name="l00030"></a>00030 <span class="keyword">class </span><a class="code" href="class_urpo_connection.html" title="Information about ssh connection (abstract).">UrpoConnection</a>;
54 <a name="l00031"></a>00031 
55 <a name="l00076"></a><a class="code" href="class_urpo_process.html">00076</a> <span class="keyword">class </span><a class="code" href="class_urpo_process.html" title="Process running ssh/scp command.">UrpoProcess</a> : <span class="keyword">public</span> QObject
56 <a name="l00077"></a>00077 {
57 <a name="l00078"></a>00078     Q_OBJECT
58 <a name="l00079"></a>00079 <span class="keyword">public</span>:
59 <a name="l00083"></a>00083     <span class="keyword">explicit</span> <a class="code" href="class_urpo_process.html#ace05eb4301a27d8c20edfc85d28ebdcf">UrpoProcess</a>(QObject* parent = 0);
60 <a name="l00084"></a>00084 
61 <a name="l00085"></a>00085 
62 <a name="l00086"></a><a class="code" href="class_urpo_process.html#a1be26b6dc5a227f88d8fa7be477578a2">00086</a>     <span class="keyword">enum</span> <a class="code" href="class_urpo_process.html#a1be26b6dc5a227f88d8fa7be477578a2">UrpoStatus</a> {
63 <a name="l00087"></a><a class="code" href="class_urpo_process.html#a1be26b6dc5a227f88d8fa7be477578a2ac5894b205772be5c5d2cab467dc4c90d">00087</a>         <a class="code" href="class_urpo_process.html#a1be26b6dc5a227f88d8fa7be477578a2ac5894b205772be5c5d2cab467dc4c90d" title="Ready for connecting.">Ready</a>                = 0,
64 <a name="l00088"></a><a class="code" href="class_urpo_process.html#a1be26b6dc5a227f88d8fa7be477578a2a82cb6930485e0c3b85e341346b2c924d">00088</a>         <a class="code" href="class_urpo_process.html#a1be26b6dc5a227f88d8fa7be477578a2a82cb6930485e0c3b85e341346b2c924d" title="Command running.">Running</a>                   = 1,
65 <a name="l00089"></a><a class="code" href="class_urpo_process.html#a1be26b6dc5a227f88d8fa7be477578a2acaff40cc10b23085fd28e0b757de08b9">00089</a>         <a class="code" href="class_urpo_process.html#a1be26b6dc5a227f88d8fa7be477578a2acaff40cc10b23085fd28e0b757de08b9" title="Command successed.">Successed</a>               = 2,
66 <a name="l00090"></a><a class="code" href="class_urpo_process.html#a1be26b6dc5a227f88d8fa7be477578a2a5e0b84210eb20245a9f3a925297088e2">00090</a>         <a class="code" href="class_urpo_process.html#a1be26b6dc5a227f88d8fa7be477578a2a5e0b84210eb20245a9f3a925297088e2" title="Command failed.">Failed</a>                     = 3
67 <a name="l00091"></a>00091     };
68 <a name="l00092"></a>00092 
69 <a name="l00093"></a><a class="code" href="class_urpo_process.html#a5b17cbee3ba24de244bd011aabac21c9">00093</a>     <span class="keyword">enum</span> <a class="code" href="class_urpo_process.html#a5b17cbee3ba24de244bd011aabac21c9">UrpoError</a> {
70 <a name="l00094"></a><a class="code" href="class_urpo_process.html#a5b17cbee3ba24de244bd011aabac21c9a26e2a92c998579ae82dad85a3d848a7f">00094</a>         <a class="code" href="class_urpo_process.html#a5b17cbee3ba24de244bd011aabac21c9a26e2a92c998579ae82dad85a3d848a7f" title="No errors happends.">NoError</a>                = 0,
71 <a name="l00095"></a><a class="code" href="class_urpo_process.html#a5b17cbee3ba24de244bd011aabac21c9a891ce4a53adb16a45fff88029c8739b6">00095</a>         <a class="code" href="class_urpo_process.html#a5b17cbee3ba24de244bd011aabac21c9a891ce4a53adb16a45fff88029c8739b6" title="Error running process.">ProcessError</a>        = 1,
72 <a name="l00096"></a><a class="code" href="class_urpo_process.html#a5b17cbee3ba24de244bd011aabac21c9a07e7216198891523a8929af6b852e7aa">00096</a>         <a class="code" href="class_urpo_process.html#a5b17cbee3ba24de244bd011aabac21c9a07e7216198891523a8929af6b852e7aa" title="Error connecting host.">ConnectionError</a>     = 2,
73 <a name="l00097"></a><a class="code" href="class_urpo_process.html#a5b17cbee3ba24de244bd011aabac21c9a2de1e6756c01a0fe2f56e3f324f7845f">00097</a>         <a class="code" href="class_urpo_process.html#a5b17cbee3ba24de244bd011aabac21c9a2de1e6756c01a0fe2f56e3f324f7845f" title="Authentication failed.">AuthError</a>           = 3,
74 <a name="l00098"></a><a class="code" href="class_urpo_process.html#a5b17cbee3ba24de244bd011aabac21c9afba71edd7db677a460890436a85e56ce">00098</a>         <a class="code" href="class_urpo_process.html#a5b17cbee3ba24de244bd011aabac21c9afba71edd7db677a460890436a85e56ce" title="Timed out.">Timeout</a>                         = 4,
75 <a name="l00099"></a><a class="code" href="class_urpo_process.html#a5b17cbee3ba24de244bd011aabac21c9a6284f1526b7edf5014aabba519d584ff">00099</a>         <a class="code" href="class_urpo_process.html#a5b17cbee3ba24de244bd011aabac21c9a6284f1526b7edf5014aabba519d584ff" title="User cancelled operation.">Cancelled</a>        = 5
76 <a name="l00100"></a>00100     };
77 <a name="l00101"></a>00101 
78 <a name="l00105"></a>00105     QStringList <a class="code" href="class_urpo_process.html#af1d8cbb3465d62ab7541aac2fef7f963" title="Get output of command.">getOutput</a>();
79 <a name="l00106"></a>00106 
80 <a name="l00114"></a>00114     <span class="keywordtype">void</span> <a class="code" href="class_urpo_process.html#a1bf2519b81fe6d5074db04f9acd38cb0" title="Run command.">start</a>(<span class="keyword">const</span> QString&amp; command);
81 <a name="l00115"></a>00115 
82 <a name="l00121"></a><a class="code" href="class_urpo_process.html#af71059723175a0ee9324a9794eff4cb1">00121</a>     <a class="code" href="class_urpo_process.html#a5b17cbee3ba24de244bd011aabac21c9">UrpoError</a> <a class="code" href="class_urpo_process.html#af71059723175a0ee9324a9794eff4cb1" title="Error of process.">getError</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> error_; }
83 <a name="l00129"></a>00129     QString <a class="code" href="class_urpo_process.html#a5a400d2abb550076c778a6030293e764" title="Error of process (in string).">getErrorString</a>() <span class="keyword">const</span>;
84 <a name="l00130"></a>00130 
85 <a name="l00135"></a><a class="code" href="class_urpo_process.html#a81ca2705b2b20d46a26f19d4a413cbdb">00135</a>     <a class="code" href="class_urpo_process.html#a1be26b6dc5a227f88d8fa7be477578a2">UrpoStatus</a> <a class="code" href="class_urpo_process.html#a81ca2705b2b20d46a26f19d4a413cbdb" title="Process status.">getStatus</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> status_; }
86 <a name="l00136"></a>00136 
87 <a name="l00137"></a>00137 
88 <a name="l00145"></a><a class="code" href="class_urpo_process.html#a0d75a2951e7add2e70c02cd8bf56de3e">00145</a>     <span class="keywordtype">void</span> <a class="code" href="class_urpo_process.html#a0d75a2951e7add2e70c02cd8bf56de3e" title="Send debug message.">sendDebugMessage</a>(QString message) { emit <a class="code" href="class_urpo_process.html#adc31070a303b210a9244213fda1f9939">debugMessage</a>(message); }
89 <a name="l00146"></a>00146 
90 <a name="l00154"></a><a class="code" href="class_urpo_process.html#af3cd19eb0af2b51d6740471a344cbb69">00154</a>     <span class="keywordtype">void</span> <a class="code" href="class_urpo_process.html#af3cd19eb0af2b51d6740471a344cbb69" title="Set timeout.">setTimeout</a>(<span class="keywordtype">int</span> msecs) { timeout_=msecs; }
91 <a name="l00155"></a>00155 
92 <a name="l00159"></a><a class="code" href="class_urpo_process.html#aaa8de6c9a6635cf2433958a60e4cf87f">00159</a>     <span class="keywordtype">int</span> <a class="code" href="class_urpo_process.html#aaa8de6c9a6635cf2433958a60e4cf87f" title="Return timeout.">getTimeout</a>() { <span class="keywordflow">return</span> timeout_; }
93 <a name="l00160"></a>00160 
94 <a name="l00161"></a>00161 signals:
95 <a name="l00168"></a>00168     <span class="keywordtype">void</span> <a class="code" href="class_urpo_process.html#ab1c5d2e4c2bda8d34700b478fd5af1ad" title="Process finished (successed of failed).">finished</a>(<span class="keywordtype">bool</span> success);
96 <a name="l00176"></a>00176     <span class="keywordtype">void</span> <a class="code" href="class_urpo_process.html#adc31070a303b210a9244213fda1f9939">debugMessage</a>(QString message);
97 <a name="l00177"></a>00177 
98 <a name="l00178"></a>00178 <span class="keyword">public</span> slots:
99 <a name="l00182"></a>00182     <span class="keywordtype">void</span> <a class="code" href="class_urpo_process.html#ac4381636ee9e977dfac4d8fe53ddfeaa" title="Cancel process.">terminate</a>();
100 <a name="l00183"></a>00183 
101 <a name="l00185"></a>00185     <span class="keywordtype">void</span> <a class="code" href="class_urpo_process.html#aba6e812efd10c7b466563c171baf7284" title="SSH client has finished.">processFinished</a>(<span class="keywordtype">int</span> exitCode,QProcess::ExitStatus exitStatus);
102 <a name="l00187"></a>00187     <span class="keywordtype">void</span> <a class="code" href="class_urpo_process.html#ab8865ef6fcb92b3fa9228474654065da" title="Timeout during connecting.">timeout</a>();
103 <a name="l00188"></a>00188 
104 <a name="l00189"></a>00189 
105 <a name="l00190"></a>00190 <span class="keyword">protected</span>:
106 <a name="l00191"></a>00191 
107 <a name="l00192"></a>00192 
108 <a name="l00193"></a>00193 <span class="keyword">private</span>:
109 <a name="l00194"></a>00194 
110 <a name="l00195"></a>00195     <span class="keyword">static</span> <span class="keywordtype">int</span> <span class="keyword">const</span> DEFAULTTIMEOUT = 30000;
111 <a name="l00196"></a>00196 
112 <a name="l00197"></a>00197     <span class="keywordtype">void</span> fail(<a class="code" href="class_urpo_process.html#a5b17cbee3ba24de244bd011aabac21c9">UrpoError</a> error);
113 <a name="l00198"></a>00198 
114 <a name="l00199"></a>00199     QStringList output_;
115 <a name="l00200"></a>00200 
116 <a name="l00201"></a>00201     QProcess qprocess_;
117 <a name="l00202"></a>00202 
118 <a name="l00203"></a>00203     <a class="code" href="class_urpo_process.html#a1be26b6dc5a227f88d8fa7be477578a2">UrpoStatus</a> status_;
119 <a name="l00204"></a>00204     <a class="code" href="class_urpo_process.html#a5b17cbee3ba24de244bd011aabac21c9">UrpoError</a> error_;
120 <a name="l00205"></a>00205     <span class="keywordtype">int</span> timeout_;   
121 <a name="l00206"></a>00206 };
122 <a name="l00207"></a>00207 
123 <a name="l00208"></a>00208 <span class="preprocessor">#endif // URPOPROCESS_H</span>
124 </pre></div></div>
125 <hr class="footer"/><address style="text-align: right;"><small>Generated on Mon Sep 27 18:46:05 2010 for Urpo by&nbsp;
126 <a href="http://www.doxygen.org/index.html">
127 <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
128 </body>
129 </html>