コード例 #1
0
ファイル: sccint.cpp プロジェクト: stahta01/wxCode_components
bool wxScriptFunctionCINT::Exec(wxScriptVar &ret, wxScriptVar *arg) const
{
	// create the string with the arguments to give to the function
	wxString cmd = GetCallString(arg);

	// exec the function
	G__value returnvalue = G__calc(cmd);

	// for float & double we need special conversion
	if (m_tReturn.GetGenericType() == wxSTG_FLOAT ||
		m_tReturn.GetGenericType() == wxSTG_DOUBLE) {
		
		ret.Set(m_tReturn.GetGenericType(), 
			wxString::Format(wxT("%f"), G__double(returnvalue)));
		return TRUE;
	}

	// for all other types, we just get an int...
	long res = G__int(returnvalue);

	// ... and transform it into the correct value
	ret.Set(m_tReturn.GetGenericType(), res);

	return TRUE;
}
コード例 #2
0
ファイル: cast.hpp プロジェクト: VladyslavKurmaz/cpp-atom
		T cint_cast( G__value const& v )
		{
			return ( reinterpret_cast< T >( G__double( v ) ) );
		}