diff options
author | Eike Rathke <er@openoffice.org> | 2002-09-27 16:19:11 +0000 |
---|---|---|
committer | Eike Rathke <er@openoffice.org> | 2002-09-27 16:19:11 +0000 |
commit | 22b27661a1991f77f0524ed62f0221f4dbda0519 (patch) | |
tree | 2f9d1c4586577f670fac7622688e3fb1a0488550 /sc/inc/token.hxx | |
parent | 4ab8e3923197983eabb82a7b82b288e8faabd7a9 (diff) |
#92320# new ScFAPToken
Diffstat (limited to 'sc/inc/token.hxx')
-rw-r--r-- | sc/inc/token.hxx | 68 |
1 files changed, 45 insertions, 23 deletions
diff --git a/sc/inc/token.hxx b/sc/inc/token.hxx index 21fa5388e3f0..dac076b60fdd 100644 --- a/sc/inc/token.hxx +++ b/sc/inc/token.hxx @@ -2,9 +2,9 @@ * * $RCSfile: token.hxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: er $ $Date: 2001-10-18 08:56:15 $ + * last change: $Author: er $ $Date: 2002-09-27 17:17:43 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -85,6 +85,8 @@ enum StackVarEnum svJump, svExternal, // Byte + String + svFAP, // FormulaAutoPilot only, ever exported + svMissing = 0x70, // 0 or "" svErr // unknown StackType }; @@ -162,6 +164,7 @@ public: virtual short* GetJump() const; virtual const String& GetExternal() const; virtual BYTE* GetUnknown() const; + virtual ScToken* GetFAPOrigToken() const; ScToken* Clone() const; @@ -183,10 +186,34 @@ public: }; +class ScTokenRef +{ + ScToken* p; +public: + inline ScTokenRef() { p = NULL; } + inline ScTokenRef( const ScTokenRef& r ) { if( ( p = r.p ) != NULL ) p->IncRef(); } + inline ScTokenRef( ScToken *t ) { if( ( p = t ) != NULL ) t->IncRef(); } + inline void Clear() { if( p ) p->DecRef(); } + inline ~ScTokenRef() { if( p ) p->DecRef(); } + inline ScTokenRef& operator=( const ScTokenRef& r ) { return *this = r.p; } + inline ScTokenRef& operator=( ScToken* t ) + { if( t ) t->IncRef(); if( p ) p->DecRef(); p = t; return *this; } + inline BOOL Is() const { return p != NULL; } + inline BOOL operator ! () const { return p == NULL; } + inline ScToken* operator&() const { return p; } + inline ScToken* operator->() const { return p; } + inline ScToken& operator*() const { return *p; } + inline operator ScToken*() const { return p; } +}; + + class ScByteToken : public ScToken { private: BYTE nByte; +protected: + ScByteToken( OpCode e, BYTE n, StackVar v ) : + ScToken( e, v ), nByte( n ) {} public: ScByteToken( OpCode e, BYTE n ) : ScToken( e, svByte ), nByte( n ) {} @@ -202,6 +229,22 @@ public: }; +// A special token for the FormulaAutoPilot only. Keeps a reference pointer of +// the token of which it was created for comparison. +class ScFAPToken : public ScByteToken +{ +private: + ScTokenRef pOrigToken; +public: + ScFAPToken( OpCode e, BYTE n, ScToken* p ) : + ScByteToken( e, n, svFAP ), pOrigToken( p ) {} + ScFAPToken( const ScFAPToken& r ) : + ScByteToken( r ), pOrigToken( r.pOrigToken ) {} + virtual ScToken* GetFAPOrigToken() const; + virtual BOOL operator==( const ScToken& rToken ) const; +}; + + class ScDoubleToken : public ScToken { private: @@ -415,27 +458,6 @@ public: }; -class ScTokenRef -{ - ScToken* p; -public: - inline ScTokenRef() { p = NULL; } - inline ScTokenRef( const ScTokenRef& r ) { if( ( p = r.p ) != NULL ) p->IncRef(); } - inline ScTokenRef( ScToken *t ) { if( ( p = t ) != NULL ) t->IncRef(); } - inline void Clear() { if( p ) p->DecRef(); } - inline ~ScTokenRef() { if( p ) p->DecRef(); } - inline ScTokenRef& operator=( const ScTokenRef& r ) { return *this = r.p; } - inline ScTokenRef& operator=( ScToken* t ) - { if( t ) t->IncRef(); if( p ) p->DecRef(); p = t; return *this; } - inline BOOL Is() const { return p != NULL; } - inline BOOL operator ! () const { return p == NULL; } - inline ScToken* operator&() const { return p; } - inline ScToken* operator->() const { return p; } - inline ScToken& operator*() const { return *p; } - inline operator ScToken*() const { return p; } -}; - - // Simplify argument passing to RefUpdate methods with ScSingleRefToken or // ScDoubleRefToken class SingleDoubleRefModifier |