From a8a9de0cd272b7e22d67e932ed868db6861888a5 Mon Sep 17 00:00:00 2001 From: fcolin Date: Thu, 1 Feb 2007 13:00:33 +0000 Subject: Utilisateur : Fcolin Date : 1/06/06 Heure : 16:40 Archivé dans $/Bus/Ivy Commentaire: correction bug du a la separation du module regexp transformation des tables de regexp en table de Hash (vss 33) --- Bus/Ivy/IvyApplication.cxx | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/Bus/Ivy/IvyApplication.cxx b/Bus/Ivy/IvyApplication.cxx index 53341bc..bad4910 100644 --- a/Bus/Ivy/IvyApplication.cxx +++ b/Bus/Ivy/IvyApplication.cxx @@ -51,8 +51,8 @@ IvyApplication::IvyApplication(Ivy * bus) IvyApplication::~IvyApplication() { // bus->RemoveApplication( this ); - for ( unsigned int i = 0; i < regexp_in.size(); i++) - delete regexp_in[i]; + for ( Bindings::iterator iter = regexp_in.begin( ); iter != regexp_in.end( ); iter++ ) + delete iter->second; regexp_in.clear(); if ( m_hSocket != INVALID_SOCKET ) Close(); @@ -164,11 +164,11 @@ void IvyApplication::OnReceive(char * line) return; } - if ( regexp_in.size() < (id + 1) ) + /*if ( regexp_in.size() < (id + 1) ) { regexp_in.resize( id + 1 ); regexp_str_in.resize( id + 1 ); - } + }*/ regexp_in[ id ] = exp; regexp_str_in[ id ] = arg; #ifdef IVY_DEBUG @@ -300,8 +300,8 @@ void IvyApplication::OnClose(int nErrorCode) if ( AppConnectedCallbackCalled ) bus->CallApplicationDisconnectedCallback( this ); - for ( unsigned int i = 0; i < regexp_in.size(); i++) - delete regexp_in[i]; + for ( Bindings::iterator iter = regexp_in.begin( ); iter != regexp_in.end( ); iter++) + delete iter->second; regexp_in.clear(); Close(); //bus->RemoveApplication( this ); @@ -313,9 +313,11 @@ int IvyApplication::SendMsg(const char *message) IvyBinding *exp; /* send to already connected */ - for ( unsigned int i = 0; i < regexp_in.size(); i++ ) + for ( Bindings::iterator iter = regexp_in.begin( ); iter != regexp_in.end( ); iter++ ) { - exp = regexp_in[i]; + exp = iter->second; + if ( !exp ) + continue; int match_count = exp->Exec( message ); if ( match_count > 0 ) { @@ -326,10 +328,10 @@ int IvyApplication::SendMsg(const char *message) for ( int j = 1; j < match_count; j++ ) { exp->Match(message, j, &arglen, &arg); - buffer += arg; + buffer += ivy::string(arg,arglen ); buffer += ARG_END; } - SendMsg( Msg, i, buffer.c_str() ); + SendMsg( Msg, iter->first, buffer.c_str() ); count++; } -- cgit v1.1