cppbind: faster from_nasal for bool and fix VS warning.

This commit is contained in:
Thomas Geymayer 2013-03-04 00:30:05 +01:00
parent fe9caad391
commit 0539aa38e5
3 changed files with 15 additions and 1 deletions

View File

@ -81,4 +81,10 @@ namespace nasal
return String(ref); return String(ref);
} }
//----------------------------------------------------------------------------
bool from_nasal_helper(naContext c, naRef ref, const bool*)
{
return naTrue(ref) == 1;
}
} // namespace nasal } // namespace nasal

View File

@ -94,6 +94,14 @@ namespace nasal
*/ */
String from_nasal_helper(naContext c, naRef ref, const String*); 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 * Convert a Nasal number to a C++ numeric type
*/ */

View File

@ -37,7 +37,7 @@
func, func,
_1 _1
BOOST_PP_COMMA_IF(n) BOOST_PP_COMMA_IF(n)
BOOST_PP_ENUM(n, SG_GHOST_REQUIRE_ARG,) BOOST_PP_ENUM(n, SG_GHOST_REQUIRE_ARG, 0)
)) ))
); );