diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-04-28 15:27:55 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-04-28 15:30:46 -0400 |
commit | 8a421be2b155a24ac673456284652214c72bd645 (patch) | |
tree | 43638f9321857ac911806b0b782abd417e335097 | |
parent | e34afd43bd6cfeeb90eacf315371cb38d0fc2e28 (diff) |
Dump more info from ScTokenArray (for debugging).
Change-Id: I57897c0b3c7f5974f2b9e510f03c91e23e362096
-rw-r--r-- | sc/source/core/tool/token.cxx | 45 |
1 files changed, 43 insertions, 2 deletions
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx index 8bb53c310dea..53444544f14c 100644 --- a/sc/source/core/tool/token.cxx +++ b/sc/source/core/tool/token.cxx @@ -3784,14 +3784,55 @@ void ScTokenArray::WrapReference( const ScAddress& rPos, SCCOL nMaxCol, SCROW nM } #if DEBUG_FORMULA_COMPILER + +namespace { + +void dumpFormulaToken( const FormulaToken& rToken ) +{ + cout << "-- FormulaToken" << endl; + cout << " opcode: " << rToken.GetOpCode() << endl; + cout << " type: " << static_cast<int>(rToken.GetType()) << endl; + switch (rToken.GetType()) + { + case svDouble: + cout << " value: " << rToken.GetDouble() << endl; + break; + case svString: + cout << " string: " + << OUStringToOString(rToken.GetString().getString(), RTL_TEXTENCODING_UTF8).getStr() + << endl; + break; + default: + ; + } +} + +} + void ScTokenArray::Dump() const { + cout << "+++ Normal Tokens +++" << endl; for (sal_uInt16 i = 0; i < nLen; ++i) { - const ScToken* p = dynamic_cast<const ScToken*>(pCode[i]); + const FormulaToken* pToken = pCode[i]; + const ScToken* p = dynamic_cast<const ScToken*>(pToken); + if (!p) + { + dumpFormulaToken(*pToken); + continue; + } + + p->Dump(); + } + + cout << "+++ RPN Tokens +++" << endl; + for (sal_uInt16 i = 0; i < nRPN; ++i) + { + const FormulaToken* pToken = pRPN[i]; + const ScToken* p = dynamic_cast<const ScToken*>(pToken); if (!p) { - cout << "-- (non ScToken)" << endl; + dumpFormulaToken(*pToken); continue; } |