Code

Improve call to callMain()
authorishmal <ishmal@users.sourceforge.net>
Wed, 12 Mar 2008 18:18:39 +0000 (18:18 +0000)
committerishmal <ishmal@users.sourceforge.net>
Wed, 12 Mar 2008 18:18:39 +0000 (18:18 +0000)
src/bind/javabind-private.h
src/bind/javabind.cpp
src/bind/javabind.h

index 9b7b4e9959cafd7b2ed515665ec3e0fdd0476b52..5a810480ba6dfcf51eaf7f07b61fbe4ebc0a9fbd 100644 (file)
@@ -54,7 +54,8 @@ public:
                             const std::vector<Value> &params,
                             Value &retval);
 
-    virtual bool callMain(const String &className);
+    virtual bool callMain(const String &className,
+                             const std::vector<String> &args);
 
     virtual bool isLoaded();
 
index f4905e15349b48a235753a7b92714ede1bdb7860..b03d562ceea3da7807669a1b4805e2f2e6144b12 100644 (file)
@@ -930,11 +930,19 @@ String JavaBinderyImpl::getException()
  * method of a given class
  * 
  * @param className full name of the java class
+ * @args the argument strings to the method 
  * @return true if successful, else false   
  */ 
-bool JavaBinderyImpl::callMain(const String &className)
+bool JavaBinderyImpl::callMain(const String &className,
+                               const std::vector<String> &args)
 {
     std::vector<Value> parms;
+    for (unsigned int i=0 ; i<args.size() ; i++)
+        {
+        Value v;
+        v.setString(args[i]);
+        parms.push_back(v);
+               }
     Value retval;
     return callStatic(Value::BIND_VOID, className, "main",
              "([Ljava/lang/String;)V", parms, retval);
index cd622960b6824b8129a8c3e528dbd16b41a8e34f..c73afa58194dc5d35575648d9845e207a940da5a 100644 (file)
@@ -241,7 +241,8 @@ public:
     /**
      *
      */
-    virtual bool callMain(const String &/*className*/)
+    virtual bool callMain(const String &/*className*/,
+                             const std::vector<String> &/*args*/)
         {
         return false;
         }