diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-03-18 15:15:59 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-03-19 13:40:23 -0400 |
commit | 198a722974790e541dd7a1248fca0a35fbb5b1ec (patch) | |
tree | 1362a524124d578c8b130f75a33bd76c6b0c22b1 /formula/source | |
parent | 2b2c20e131a6c752937705fa13f26cab4474b38f (diff) |
Move GetHash() from FormulaTokenArray to ScTokenArray.
To allow access to reference tokens.
Change-Id: I3e2d2653722005c04b6d26e1a4ddfce0a459ef37
Diffstat (limited to 'formula/source')
-rw-r--r-- | formula/source/core/api/token.cxx | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/formula/source/core/api/token.cxx b/formula/source/core/api/token.cxx index 5a47d2e43934..150be29a7a61 100644 --- a/formula/source/core/api/token.cxx +++ b/formula/source/core/api/token.cxx @@ -685,58 +685,6 @@ FormulaTokenArray* FormulaTokenArray::Clone() const return p; } -size_t FormulaTokenArray::GetHash() const -{ - static OUStringHash aHasher; - - size_t nHash = 1; - OpCode eOp; - StackVar eType; - const FormulaToken* p; - sal_uInt16 n = std::min<sal_uInt16>(nLen, 20); - for (sal_uInt16 i = 0; i < n; ++i) - { - p = pCode[i]; - eOp = p->GetOpCode(); - if (eOp == ocPush) - { - // This is stack variable. Do additional differentiation. - eType = p->GetType(); - switch (eType) - { - case svByte: - { - // Constant value. - sal_uInt8 nVal = p->GetByte(); - nHash += (static_cast<size_t>(nVal) << i); - continue; - } - case svDouble: - { - // Constant value. - double fVal = p->GetDouble(); - nHash += (static_cast<size_t>(fVal) << i); - continue; - } - case svString: - { - // Constant string. - const String& rStr = p->GetString(); - nHash += (aHasher(rStr) << i); - continue; - } - default: - // TODO: Decide later if we should generate hash from references as well. - ; - } - } - - // Use the opcode value in all the other cases. - nHash += (static_cast<size_t>(eOp) << i); - } - return nHash; -} - void FormulaTokenArray::Clear() { if( nRPN ) DelRPN(); |