|
a/src/internfile/mh_execm.h |
|
b/src/internfile/mh_execm.h |
|
... |
|
... |
26 |
*
|
26 |
*
|
27 |
* The command to execute, and its parameters, are stored in the "params"
|
27 |
* The command to execute, and its parameters, are stored in the "params"
|
28 |
* which is built in mimehandler.cpp out of data from the mimeconf file.
|
28 |
* which is built in mimehandler.cpp out of data from the mimeconf file.
|
29 |
*
|
29 |
*
|
30 |
* This version uses persistent filters which can handle multiple requests
|
30 |
* This version uses persistent filters which can handle multiple requests
|
|
|
31 |
* without exiting (both multiple files and multiple documents per file),
|
31 |
* without exiting, with a simple question/response protocol.
|
32 |
* with a simple question/response protocol.
|
32 |
*
|
33 |
*
|
33 |
* The data is exchanged in TLV fashion, in a way that should be
|
34 |
* The data is exchanged in TLV fashion, in a way that should be
|
34 |
* usable in most script languages. The basic unit has one line with a
|
35 |
* usable in most script languages. The basic unit has one line with a
|
35 |
* data type and a count, followed by the data. A 'message' ends with
|
36 |
* data type and a count, followed by the data. A 'message' ends with
|
36 |
* one empty line. A possible exchange:
|
37 |
* one empty line. A possible exchange:
|
|
... |
|
... |
47 |
Mimetype: 10
|
48 |
Mimetype: 10
|
48 |
text/plainData: 10
|
49 |
text/plainData: 10
|
49 |
0123456789
|
50 |
0123456789
|
50 |
<Message ends here because of empty line
|
51 |
<Message ends here because of empty line
|
51 |
*
|
52 |
*
|
52 |
* Until proven otherwise, this format is both extensible and
|
53 |
* This format is both extensible and reasonably easy to parse.
|
53 |
* reasonably easy to parse. While it's more destined for python or
|
54 |
* While it's more destined for python or perl on the script side, it
|
54 |
* perl on the script side, it should even be sort of usable from the shell
|
55 |
* should even be sort of usable from the shell (ie: use dd to read
|
55 |
* (ie: use dd to read the counted data). Most alternatives would need data
|
56 |
* the counted data). Most alternatives would need data encoding in
|
56 |
* encoding in some cases.
|
57 |
* some cases.
|
57 |
*/
|
58 |
*/
|
58 |
class MimeHandlerExecMultiple : public MimeHandlerExec {
|
59 |
class MimeHandlerExecMultiple : public MimeHandlerExec {
|
59 |
/////////
|
60 |
/////////
|
60 |
// Things not reset by "clear()", additionally to those in MimeHandlerExec
|
61 |
// Things not reset by "clear()", additionally to those in MimeHandlerExec
|
61 |
ExecCmd m_cmd;
|
62 |
ExecCmd m_cmd;
|
|
... |
|
... |
69 |
virtual ~MimeHandlerExecMultiple() {}
|
70 |
virtual ~MimeHandlerExecMultiple() {}
|
70 |
virtual bool next_document();
|
71 |
virtual bool next_document();
|
71 |
virtual void clear() {
|
72 |
virtual void clear() {
|
72 |
MimeHandlerExec::clear();
|
73 |
MimeHandlerExec::clear();
|
73 |
}
|
74 |
}
|
|
|
75 |
virtual bool set_document_file(const string &file_path) {
|
|
|
76 |
m_filefirst = true;
|
|
|
77 |
return MimeHandlerExec::set_document_file(file_path);
|
|
|
78 |
}
|
74 |
private:
|
79 |
private:
|
75 |
bool startCmd();
|
80 |
bool startCmd();
|
76 |
bool readDataElement(string& name);
|
81 |
bool readDataElement(string& name, string& data);
|
|
|
82 |
bool m_filefirst;
|
77 |
};
|
83 |
};
|
78 |
|
84 |
|
79 |
#endif /* _MH_EXECM_H_INCLUDED_ */
|
85 |
#endif /* _MH_EXECM_H_INCLUDED_ */
|