Update of /cvsroot/objecthandler/ObjectHandler/ohxl
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17819/ohxl
Modified Files:
callingrange.cpp functioncall.cpp objecthandlerxl.cpp
objecthandlerxl.hpp
Log Message:
add support for member functions returning newly instantiated QuantLibAddin objects
Index: objecthandlerxl.cpp
===================================================================
RCS file: /cvsroot/objecthandler/ObjectHandler/ohxl/objecthandlerxl.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** objecthandlerxl.cpp 28 Jun 2006 14:28:32 -0000 1.9
--- objecthandlerxl.cpp 16 Jul 2006 17:11:19 -0000 1.10
***************
*** 98,103 ****
}
! void ObjectHandlerXL::resetCaller() {
boost::shared_ptr<CallingRange> callingRange = getCallingRange();
if (callingRange)
callingRange->update();
--- 98,107 ----
}
! void ObjectHandlerXL::resetCaller(bool createIfNone) {
boost::shared_ptr<CallingRange> callingRange = getCallingRange();
+ if (!callingRange) {
+ callingRange = boost::shared_ptr<CallingRange>(new CallingRange);
+ callingRanges_[callingRange->getKey()] = callingRange;
+ }
if (callingRange)
callingRange->update();
***************
*** 107,117 ****
std::string instanceName,
const boost::shared_ptr<Object> &object) {
! boost::shared_ptr<CallingRange> callingRange = getCallingRange();
!
! if (!callingRange) {
! callingRange = boost::shared_ptr<CallingRange>(new CallingRange);
! callingRanges_[callingRange->getKey()] = callingRange;
! }
! callingRange->update();
if (instanceName.empty()) {
--- 111,115 ----
std::string instanceName,
const boost::shared_ptr<Object> &object) {
! resetCaller(true);
if (instanceName.empty()) {
***************
*** 120,123 ****
--- 118,122 ----
}
+ boost::shared_ptr<CallingRange> callingRange = getCallingRange();
callingRange->deleteObject(instanceName, object);
checkName(instanceName);
Index: objecthandlerxl.hpp
===================================================================
RCS file: /cvsroot/objecthandler/ObjectHandler/ohxl/objecthandlerxl.hpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** objecthandlerxl.hpp 28 Jun 2006 14:28:32 -0000 1.9
--- objecthandlerxl.hpp 16 Jul 2006 17:11:19 -0000 1.10
***************
*** 65,69 ****
which set the caller's status to "busy".
*/
! virtual void resetCaller();
virtual void dump(std::ostream&);
--- 65,69 ----
which set the caller's status to "busy".
*/
! virtual void resetCaller(bool createIfNone = false);
virtual void dump(std::ostream&);
Index: callingrange.cpp
===================================================================
RCS file: /cvsroot/objecthandler/ObjectHandler/ohxl/callingrange.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** callingrange.cpp 18 Jun 2006 13:41:51 -0000 1.5
--- callingrange.cpp 16 Jul 2006 17:11:18 -0000 1.6
***************
*** 185,189 ****
support for nested formulas e.g. "=qlFunc1(qlFunc2(), SUM(), qlFunc3(), xxx)"
implement the following algorithm:
! - on first call to this formula - mark calling range as "busy" - clear()
- intermediate calls - take no action
- final call - mark calling range as "not busy"
--- 185,189 ----
support for nested formulas e.g. "=qlFunc1(qlFunc2(), SUM(), qlFunc3(), xxx)"
implement the following algorithm:
! - on first call to this formula - mark calling range as "busy" - clearNonPermanent()
- intermediate calls - take no action
- final call - mark calling range as "not busy"
Index: functioncall.cpp
===================================================================
RCS file: /cvsroot/objecthandler/ObjectHandler/ohxl/functioncall.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** functioncall.cpp 14 Jun 2006 15:25:57 -0000 1.7
--- functioncall.cpp 16 Jul 2006 17:11:19 -0000 1.8
***************
*** 71,90 ****
// addins call this function from within their catch()
// so this function must not throw
! try {
! if (address_.empty()) {
! XLOPER xAddress;
! try {
! Excel(xlfGetCell, &xAddress, 2, TempNum(1), getCallerReference());
! operToScalar(address_, xAddress);
! Excel(xlFree, 0, 1, &xAddress);
! } catch (const std::exception &e) {
Excel(xlFree, 0, 1, &xAddress);
! std::ostringstream err;
! err << "FunctionCall::getAddressString(): " << e.what();
! throw Exception(err.str());
! }
}
- } catch (...) {
- address_ = "caller address unknown";
}
return address_;
--- 71,86 ----
// addins call this function from within their catch()
// so this function must not throw
! if (address_.empty()) {
! XLOPER xAddress;
! xAddress.xltype = 0;
! try {
! Excel(xlfGetCell, &xAddress, 2, TempNum(1), getCallerReference());
! operToScalar(address_, xAddress);
! Excel(xlFree, 0, 1, &xAddress);
! } catch (...) {
! if (xAddress.xltype)
Excel(xlFree, 0, 1, &xAddress);
! address_ = "caller address unknown";
}
}
return address_;
|