Update of /cvsroot/objecthandler/ObjectHandler/oh/Conversions
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv15203/oh/Conversions
Modified Files:
coerce.hpp
Log Message:
support for coercion
Index: coerce.hpp
===================================================================
RCS file: /cvsroot/objecthandler/ObjectHandler/oh/Conversions/coerce.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** coerce.hpp 19 Nov 2006 13:08:27 -0000 1.1
--- coerce.hpp 22 Nov 2006 21:37:10 -0000 1.2
***************
*** 36,43 ****
conversion++;
}
! std::ostringstream msg;
! msg << "Unable to coerce value to type "
! << typeid(TypeOut).name();
! throw Exception(msg.str());
}
--- 36,49 ----
conversion++;
}
! OH_FAIL("Unable to coerce value to type "
! << typeid(TypeOut).name());
! }
!
! TypeOut operator()(const TypeIn &in, const TypeOut &defaultValue) {
! if (inputMissing(in)) {
! return defaultValue;
! } else {
! return this->operator()(in);
! }
}
***************
*** 45,48 ****
--- 51,55 ----
typedef bool (*Conversion)(const TypeIn&, TypeOut&);
virtual Conversion *getConversions() = 0;
+ virtual bool inputMissing(const TypeIn&) { return false; }
};
|