Update of /cvsroot/objecthandler/ObjectHandler/ohxl
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv26478/ohxl
Modified Files:
conversions.cpp conversions.hpp
Log Message:
new function ohPack()
Index: conversions.cpp
===================================================================
RCS file: /cvsroot/objecthandler/ObjectHandler/ohxl/conversions.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** conversions.cpp 1 Jun 2006 13:25:53 -0000 1.4
--- conversions.cpp 14 Jun 2006 13:15:25 -0000 1.5
***************
*** 51,57 ****
throw Exception("stringToXloper: error calling new");
xString.xltype = xltypeStr | xlbitDLLFree;
if (len)
strncpy(xString.val.str + 1, value.c_str(), len);
- xString.val.str[0] = len;
}
--- 51,57 ----
throw Exception("stringToXloper: error calling new");
xString.xltype = xltypeStr | xlbitDLLFree;
+ xString.val.str[0] = len;
if (len)
strncpy(xString.val.str + 1, value.c_str(), len);
}
***************
*** 295,298 ****
--- 295,327 ----
}
+ void operToOper(OPER *xTarget, const OPER *xSource) {
+ if (xSource->xltype == xltypeNum) {
+ xTarget->xltype = xltypeNum;
+ xTarget->val.num = xSource->val.num;
+ return;
+ } else if (xSource->xltype == xltypeStr) {
+ int len = xSource->val.str[0];
+ xTarget->val.str = new char[ len + 1 ];
+ if (!xTarget->val.str)
+ throw Exception("operToOper: error calling new");
+ xTarget->xltype = xltypeStr | xlbitDLLFree;
+ xTarget->val.str[0] = len;
+ if (len)
+ strncpy(xTarget->val.str + 1, xSource->val.str + 1, len);
+ return;
+ } else if (xSource->xltype == xltypeErr) {
+ xTarget->xltype = xltypeErr;
+ xTarget->val.err = xSource->val.err;
+ return;
+ } else if (xSource->xltype == xltypeNil) {
+ xTarget->xltype = xltypeNil;
+ return;
+ } else {
+ std::ostringstream msg;
+ msg << "operToOper: unexpected OPER type: " << xSource->xltype;
+ throw Exception(msg.str());
+ }
+ }
+
}
Index: conversions.hpp
===================================================================
RCS file: /cvsroot/objecthandler/ObjectHandler/ohxl/conversions.hpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** conversions.hpp 13 Jun 2006 11:25:10 -0000 1.8
--- conversions.hpp 14 Jun 2006 13:15:25 -0000 1.9
***************
*** 29,32 ****
--- 29,33 ----
DLL_API void stringToChar(char *c, const std::string &s);
+ void operToOper(OPER *xTarget, const OPER *xSource);
// conversions from native C++ datatypes to Excel datatypes
|