]> git.mxchange.org Git - simgear.git/commitdiff
cppbind: faster from_nasal for bool and fix VS warning.
authorThomas Geymayer <tomgey@gmail.com>
Sun, 3 Mar 2013 23:30:05 +0000 (00:30 +0100)
committerThomas Geymayer <tomgey@gmail.com>
Sun, 3 Mar 2013 23:30:30 +0000 (00:30 +0100)
simgear/nasal/cppbind/detail/from_nasal_helper.cxx
simgear/nasal/cppbind/detail/from_nasal_helper.hxx
simgear/nasal/cppbind/detail/functor_templates.hxx

index a094e4fb335819c0336f016876ae482e0d392200..2a1651028f446eec269f3d0b7fa9f87c817d1a96 100644 (file)
@@ -81,4 +81,10 @@ namespace nasal
     return String(ref);
   }
 
+  //----------------------------------------------------------------------------
+  bool from_nasal_helper(naContext c, naRef ref, const bool*)
+  {
+    return naTrue(ref) == 1;
+  }
+
 } // namespace nasal
index 865bc8d130f1228896352df9b58f0cb390a3f020..00cca4b5a62317805dc73cfa1d58f76bb9443a0d 100644 (file)
@@ -94,6 +94,14 @@ namespace nasal
    */
   String from_nasal_helper(naContext c, naRef ref, const String*);
 
+  /**
+   * Convert a Nasal object to bool.
+   *
+   * @return true, if ref is string or ref is number != 0
+   *         false, else
+   */
+  bool from_nasal_helper(naContext c, naRef ref, const bool*);
+
   /**
    * Convert a Nasal number to a C++ numeric type
    */
index eeb3600acd6a3c85fb682d024a1f64a6a851b55f..0d827f40ae9d700dcdf61fd5a42648e0fa9f8993 100644 (file)
@@ -37,7 +37,7 @@
         func,
         _1
         BOOST_PP_COMMA_IF(n)
-        BOOST_PP_ENUM(n, SG_GHOST_REQUIRE_ARG,)
+        BOOST_PP_ENUM(n, SG_GHOST_REQUIRE_ARG, 0)
       ))
     );