diff options
author | Kohei Yoshida <kyoshida@novell.com> | 2010-12-21 17:41:33 -0500 |
---|---|---|
committer | Kohei Yoshida <kyoshida@novell.com> | 2010-12-21 17:43:10 -0500 |
commit | c4b7910c120be1c5a8462c20b12734139632a4de (patch) | |
tree | 1eefc53a48d20d59fdafe150d12e7ecd0354e2db /formula/inc | |
parent | c631cf94e468d6f5ced5cacda3600c683c44dca2 (diff) |
Implemented FormulaTokneRef using boost::intrusive_ptr.
Diffstat (limited to 'formula/inc')
-rw-r--r-- | formula/inc/formula/FormulaCompiler.hxx | 2 | ||||
-rw-r--r-- | formula/inc/formula/token.hxx | 18 |
2 files changed, 15 insertions, 5 deletions
diff --git a/formula/inc/formula/FormulaCompiler.hxx b/formula/inc/formula/FormulaCompiler.hxx index 00a97cfc7a5a..eca20bcc4120 100644 --- a/formula/inc/formula/FormulaCompiler.hxx +++ b/formula/inc/formula/FormulaCompiler.hxx @@ -331,7 +331,7 @@ private: static inline void ForceArrayOperator( FormulaTokenRef& rCurr, const FormulaTokenRef& rPrev ) { - if ( rPrev.Is() && rPrev->HasForceArray() && + if ( rPrev && rPrev->HasForceArray() && rCurr->GetType() == svByte && rCurr->GetOpCode() != ocPush && !rCurr->HasForceArray() ) rCurr->SetForceArray( true); diff --git a/formula/inc/formula/token.hxx b/formula/inc/formula/token.hxx index dfabc3f2149e..b29bbf9f0c9c 100644 --- a/formula/inc/formula/token.hxx +++ b/formula/inc/formula/token.hxx @@ -33,11 +33,12 @@ #include <string.h> #include <vector> #include "formula/opcode.hxx" -#include "formula/intruref.hxx" #include <tools/mempool.hxx> #include "formula/IFunctionDescription.hxx" #include "formula/formuladllapi.h" +#include <boost/intrusive_ptr.hpp> + namespace formula { @@ -85,9 +86,8 @@ typedef StackVarEnum StackVar; class FormulaToken; -typedef SimpleIntrusiveReference< class FormulaToken > FormulaTokenRef; -typedef SimpleIntrusiveReference< const class FormulaToken > FormulaConstTokenRef; - +typedef ::boost::intrusive_ptr<FormulaToken> FormulaTokenRef; +typedef ::boost::intrusive_ptr<const FormulaToken> FormulaConstTokenRef; class FORMULA_DLLPUBLIC FormulaToken : public IFormulaToken { @@ -179,6 +179,16 @@ public: { return GetStrLenBytes( rStr.Len() ); } }; +inline void intrusive_ptr_add_ref(const FormulaToken* p) +{ + p->IncRef(); +} + +inline void intrusive_ptr_release(const FormulaToken* p) +{ + p->DecRef(); +} + class FORMULA_DLLPUBLIC FormulaByteToken : public FormulaToken { private: |