summaryrefslogtreecommitdiff
path: root/indra/llcommon/llprocess.h
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2012-01-20 20:19:50 -0500
committerNat Goodspeed <nat@lindenlab.com>2012-01-20 20:19:50 -0500
commit6e214960ce203d1d50d7bd6bd04eedee3afd0fa3 (patch)
tree46e020896fd637b860f47d03f57d8f640c7135b3 /indra/llcommon/llprocess.h
parent50d0446dd9378c4fee684ae0770f112b08a81254 (diff)
Define LLProcess::Params; accept create(const LLSDParamAdapter<Params>&).
This allows callers to pass either LLSD formatted as before -- which all callers still do -- or an actual LLProcess::Params block.
Diffstat (limited to 'indra/llcommon/llprocess.h')
-rw-r--r--indra/llcommon/llprocess.h33
1 files changed, 27 insertions, 6 deletions
diff --git a/indra/llcommon/llprocess.h b/indra/llcommon/llprocess.h
index 9a74cfe829..9ea129baf2 100644
--- a/indra/llcommon/llprocess.h
+++ b/indra/llcommon/llprocess.h
@@ -27,6 +27,8 @@
#ifndef LL_LLPROCESS_H
#define LL_LLPROCESS_H
+#include "llinitparam.h"
+#include "llsdparam.h"
#include <boost/shared_ptr.hpp>
#include <boost/noncopyable.hpp>
@@ -35,8 +37,6 @@
#include <windows.h>
#endif
-class LLSD;
-
class LLProcess;
/// LLProcess instances are created on the heap by static factory methods and
/// managed by ref-counted pointers.
@@ -50,17 +50,38 @@ class LL_COMMON_API LLProcess: public boost::noncopyable
{
LOG_CLASS(LLProcess);
public:
+ /// Param block definition
+ struct Params: public LLInitParam::Block<Params>
+ {
+ Params():
+ executable("executable"),
+ args("args"),
+ cwd("cwd"),
+ autokill("autokill", true)
+ {}
+
+ /// pathname of executable
+ Mandatory<std::string> executable;
+ /// zero or more additional command-line arguments
+ Multiple<std::string> args;
+ /// current working directory, if need it changed
+ Optional<std::string> cwd;
+ /// implicitly kill process on destruction of LLProcess object
+ Optional<bool> autokill;
+ };
/**
- * Factory accepting LLSD::Map.
+ * Factory accepting either plain LLSD::Map or Params block.
* MAY RETURN DEFAULT-CONSTRUCTED LLProcessPtr if params invalid!
*
+ * Redundant with Params definition above?
+ *
* executable (required, string): executable pathname
* args (optional, string array): extra command-line arguments
* cwd (optional, string, dft no chdir): change to this directory before executing
* autokill (optional, bool, dft true): implicit kill() on ~LLProcess
*/
- static LLProcessPtr create(const LLSD& params);
+ static LLProcessPtr create(const LLSDParamAdapter<Params>& params);
virtual ~LLProcess();
// isRunning isn't const because, if child isn't running, it clears stored
@@ -96,8 +117,8 @@ public:
private:
/// constructor is private: use create() instead
- LLProcess(const LLSD& params);
- void launch(const LLSD& params);
+ LLProcess(const LLSDParamAdapter<Params>& params);
+ void launch(const LLSDParamAdapter<Params>& params);
id mProcessID;
bool mAutokill;