summaryrefslogtreecommitdiff
path: root/comIvy
diff options
context:
space:
mode:
authorfcolin2007-02-01 13:13:25 +0000
committerfcolin2007-02-01 13:13:25 +0000
commitef9c20abbfe852cc90c7bbd17c04549f7de3dad3 (patch)
tree8174750ae3f5984fa2a81d1d287802a5d1af325e /comIvy
parentee1d4ac1c341aa9cdecbab89933c0658228d38c4 (diff)
downloadivy-cplusplus-ef9c20abbfe852cc90c7bbd17c04549f7de3dad3.zip
ivy-cplusplus-ef9c20abbfe852cc90c7bbd17c04549f7de3dad3.tar.gz
ivy-cplusplus-ef9c20abbfe852cc90c7bbd17c04549f7de3dad3.tar.bz2
ivy-cplusplus-ef9c20abbfe852cc90c7bbd17c04549f7de3dad3.tar.xz
Utilisateur : Fcolin Date : 7/06/04 Heure : 10:56 Archivé dans $/Bus/comIvy Commentaire: (vss 3)
Diffstat (limited to 'comIvy')
-rw-r--r--comIvy/Expression.cpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/comIvy/Expression.cpp b/comIvy/Expression.cpp
index 9a856a7..9287bae 100644
--- a/comIvy/Expression.cpp
+++ b/comIvy/Expression.cpp
@@ -12,13 +12,28 @@ char * ConvBSTR( BSTR str );
BSTR ConvCSTR( const char *str );
// CExpression
-
+STDMETHODIMP CExpression::Bind(char* regex, CBus* _bus)
+{
+ if ( !_bus ) return E_FAIL;
+ bus = _bus;
+ bus->AddRef();
+ if ( id != -1 )
+ return E_FAIL;
+ if ( bus->bus )
+ id = bus->bus->BindMsg( regex, this );
+ else return E_FAIL;
+ return S_OK;
+}
STDMETHODIMP CExpression::Unbind(void)
{
if ( !bus ) return E_FAIL;
- if ( bus->bus )
+ if ( bus->bus && id != -1 )
+ {
bus->bus->UnbindMsg( id );
+ id = -1;
+ }
+ else return E_FAIL;
bus->Release();
return S_OK;
}
@@ -59,7 +74,8 @@ CExpression::CExpression()
}
CExpression::~CExpression()
{
- Unbind();
+ if ( id != -1 )
+ Unbind();
id = -1;
bus = 0;
ATLTRACE("CExpression destroyed\n");