/* * dialog.results.h * BoE * * Created by Celtic Minstrel on 06/06/09. * */ // Functions for allowing the dialog to have a result which can be of any type. // Be sure to call setResult and getResult with the exact same template parameters! // If you don't, bad things could happen. (Especially if you get the result as // a pointer when it was set as an integral type.) // Note however that for non-integral types it's safe to set it as type pointer to X and then // get it as type X or vice versa, since setting it as type X stores the address anyway. template inline void cDialog::setResult(const type& val){ const type* ptr = &val; result = reinterpret_cast(ptr); } template<> inline void cDialog::setResult(const char& val){ result = reinterpret_cast(val); } template<> inline void cDialog::setResult(const signed char& val){ result = reinterpret_cast(val); } template<> inline void cDialog::setResult(const unsigned char& val){ result = reinterpret_cast(val); } template<> inline void cDialog::setResult(const signed short& val){ result = reinterpret_cast(val); } template<> inline void cDialog::setResult(const unsigned short& val){ result = reinterpret_cast(val); } template<> inline void cDialog::setResult(const signed int& val){ result = reinterpret_cast(val); } template<> inline void cDialog::setResult(const unsigned int& val){ result = reinterpret_cast(val); } template<> inline void cDialog::setResult(const signed long& val){ result = reinterpret_cast(val); } template<> inline void cDialog::setResult(const unsigned long& val){ result = reinterpret_cast(val); } template<> inline void cDialog::setResult(const signed long long& val){ result = reinterpret_cast(val); } template<> inline void cDialog::setResult(const unsigned long long& val){ result = reinterpret_cast(val); } template<> inline void cDialog::setResult(const bool& val){ result = reinterpret_cast(val); } template inline type& cDialog::getResult(){ return *reinterpret_cast(result); } template<> inline char& cDialog::getResult(){ return reinterpret_cast(result); } template<> inline signed char& cDialog::getResult(){ return reinterpret_cast(result); } template<> inline unsigned char& cDialog::getResult(){ return reinterpret_cast(result); } template<> inline signed short& cDialog::getResult(){ return reinterpret_cast(result); } template<> inline unsigned short& cDialog::getResult(){ return reinterpret_cast(result); } template<> inline signed int& cDialog::getResult(){ return reinterpret_cast(result); } template<> inline unsigned int& cDialog::getResult(){ return reinterpret_cast(result); } template<> inline signed long& cDialog::getResult(){ return reinterpret_cast(result); } template<> inline unsigned long& cDialog::getResult(){ return reinterpret_cast(result); } template<> inline signed long long& cDialog::getResult(){ return reinterpret_cast(result); } template<> inline unsigned long long& cDialog::getResult(){ return reinterpret_cast(result); } template<> inline bool& cDialog::getResult(){ return reinterpret_cast(result); }