summaryrefslogtreecommitdiff
path: root/Ivy/IvyApplication.cxx
diff options
context:
space:
mode:
authorfcolin2007-02-01 12:59:31 +0000
committerfcolin2007-02-01 12:59:31 +0000
commit2e418cb4dd7804abf714cea0fb94903bad70a985 (patch)
tree10cf82bae6f2af71b2387a4056d70e515f62e307 /Ivy/IvyApplication.cxx
parentcb4acfaf1f4b6a1a1fe0ee4722592022893f1d2a (diff)
downloadivy-cplusplus-2e418cb4dd7804abf714cea0fb94903bad70a985.zip
ivy-cplusplus-2e418cb4dd7804abf714cea0fb94903bad70a985.tar.gz
ivy-cplusplus-2e418cb4dd7804abf714cea0fb94903bad70a985.tar.bz2
ivy-cplusplus-2e418cb4dd7804abf714cea0fb94903bad70a985.tar.xz
Utilisateur : Fcolin Date : 20/07/00 Heure : 10:57 Archivé dans $/Ivy (vss 2)
Diffstat (limited to 'Ivy/IvyApplication.cxx')
-rw-r--r--Ivy/IvyApplication.cxx17
1 files changed, 8 insertions, 9 deletions
diff --git a/Ivy/IvyApplication.cxx b/Ivy/IvyApplication.cxx
index 26d0adf..de43bd0 100644
--- a/Ivy/IvyApplication.cxx
+++ b/Ivy/IvyApplication.cxx
@@ -129,20 +129,18 @@ void IvyApplication::OnReceive(char * line)
TRACE("IvyApplication %s\n",err.c_str());
return;
}
- if ( id +1 < regexp_in.size() )
- regexp_in[ id ] = exp ;
- else regexp_in.push_back( exp );
+ regexp_in[ id ] = exp ;
break;
case DelRegexp:
#ifdef DEBUG
TRACE("Regexp Delete id=%d\n", id);
#endif //DEBUG
- if ( id < regexp_in.size() )
+ if ( regexp_in.find(id) != regexp_in.end() )
{
exp = regexp_in[ id ];
delete exp;
- regexp_in[ id ] = NULL ;
+ regexp_in.erase( id );
}
break;
case StartRegexp:
@@ -263,11 +261,12 @@ int IvyApplication::SendMsg(const char *message)
{
int count = 0;
Regexp *exp;
-
+ map<int,Regexp*>::iterator iter;
/* send to already connected */
- for ( int id = 0; id < regexp_in.size(); id++ )
+ if ( !regexp_in.empty() )
+ for ( iter = regexp_in.begin(); iter != regexp_in.end(); iter++ )
{
- exp = regexp_in[ id ];
+ exp = (*iter).second;
if ( exp && exp->Match( message ) )
{
@@ -277,7 +276,7 @@ int IvyApplication::SendMsg(const char *message)
buffer += (*exp)[i];
buffer += ARG_END;
}
- SendMsg( Msg, id, buffer.c_str() );
+ SendMsg( Msg, (*iter).first, buffer.c_str() );
count++;
}
}