[luabind-cvs] luabind/luabind/luabind object.hpp,1.36.2.1,1.36.2.2
Brought to you by:
arvidn,
daniel_wallin
From: Arvid N. <ar...@us...> - 2006-01-01 16:56:08
|
Update of /cvsroot/luabind/luabind/luabind/luabind In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3191/luabind Modified Files: Tag: luabind_rc_0_7 object.hpp Log Message: added stream operator for ValueWrappers Index: object.hpp =================================================================== RCS file: /cvsroot/luabind/luabind/luabind/luabind/object.hpp,v retrieving revision 1.36.2.1 retrieving revision 1.36.2.2 diff -u -d -r1.36.2.1 -r1.36.2.2 --- object.hpp 30 Dec 2005 16:57:37 -0000 1.36.2.1 +++ object.hpp 1 Jan 2006 16:55:56 -0000 1.36.2.2 @@ -43,6 +43,8 @@ #include <boost/preprocessor/iteration/iterate.hpp> +#include <iosfwd> + namespace luabind { namespace detail @@ -159,10 +161,21 @@ \ return fn(L, -1, -2) != 0; \ } - + LUABIND_BINARY_OP_DEF(==, lua_equal) LUABIND_BINARY_OP_DEF(<, lua_lessthan) + template<class ValueWrapper> + std::ostream& operator<<(std::ostream& os, ValueWrapper const& v) + { + using namespace luabind; + lua_State* interpreter = value_wrapper_traits<ValueWrapper>::interpreter(v); + value_wrapper_traits<ValueWrapper>::unwrap(interpreter, v); + detail::stack_pop pop(interpreter, 1); + return std::operator<<(os, std::string(lua_tostring(interpreter, -1) + , lua_strlen(interpreter, -1))); + } + #undef LUABIND_BINARY_OP_DEF template<class LHS, class RHS> |