summaryrefslogtreecommitdiff
path: root/Ivy/IvyApplication.cxx
diff options
context:
space:
mode:
authorfcolin2007-02-01 12:59:41 +0000
committerfcolin2007-02-01 12:59:41 +0000
commit86f4b157ddaee8993b6e5b9591967a077ff8ff85 (patch)
tree8eca666a263f1fa0128e24066931b6784a9c2296 /Ivy/IvyApplication.cxx
parenta2ad73d7b7c3812434be4d82eb1155dc4e6a6380 (diff)
downloadivy-cplusplus-86f4b157ddaee8993b6e5b9591967a077ff8ff85.zip
ivy-cplusplus-86f4b157ddaee8993b6e5b9591967a077ff8ff85.tar.gz
ivy-cplusplus-86f4b157ddaee8993b6e5b9591967a077ff8ff85.tar.bz2
ivy-cplusplus-86f4b157ddaee8993b6e5b9591967a077ff8ff85.tar.xz
Utilisateur : Fcolin Date : 2/02/01 Heure : 18:30 Archivé dans $/Ivy Commentaire: win CE compile not finished (vss 7)
Diffstat (limited to 'Ivy/IvyApplication.cxx')
-rw-r--r--Ivy/IvyApplication.cxx33
1 files changed, 19 insertions, 14 deletions
diff --git a/Ivy/IvyApplication.cxx b/Ivy/IvyApplication.cxx
index 7d55bf1..cbb3ee6 100644
--- a/Ivy/IvyApplication.cxx
+++ b/Ivy/IvyApplication.cxx
@@ -2,7 +2,12 @@
//
#include "stdafx.h"
-//#include "libIvy.h"
+
+#ifdef _DEBUG
+#define DEBUG_NEW new(__FILE__, __LINE__)
+#define new DEBUG_NEW
+#endif
+
#include "IvyApplication.h"
#include "Regexp.h"
@@ -26,7 +31,7 @@ IvyApplication::IvyApplication(Ivy * bus)
IvyApplication::~IvyApplication()
{
// bus->RemoveApplication( this );
- for ( int i = 0; i < regexp_in.size(); i++)
+ for ( unsigned int i = 0; i < regexp_in.size(); i++)
delete regexp_in[i];
regexp_in.clear();
if ( m_hSocket != INVALID_SOCKET )
@@ -122,25 +127,27 @@ void IvyApplication::OnReceive(char * line)
exp = new Regexp( arg );
if ( !exp->CompiledOK() )
{
- string regerr = exp->GetErrorString();
- string err;
- err = "Error can't compile regexp '"+string(arg)+"' error "+regerr;
+ string err( "Error can't compile regexp '" );
+ err += arg;
+ err += "' error ";
+ err += exp->GetErrorString();
SendMsg( Error, Error, err.c_str() );
TRACE("IvyApplication %s\n",err.c_str());
return;
}
- regexp_in[ id ] = exp ;
+ regexp_in.reserve( id +1 );
+ regexp_in[ id ] = exp;
break;
case DelRegexp:
#ifdef DEBUG
TRACE("Regexp Delete id=%d\n", id);
#endif //DEBUG
- if ( regexp_in.find(id) != regexp_in.end() )
+ if ( regexp_in[id] )
{
exp = regexp_in[ id ];
delete exp;
- regexp_in.erase( id );
+ regexp_in[ id ] = NULL;
}
break;
case StartRegexp:
@@ -252,7 +259,7 @@ void IvyApplication::OnClose(int nErrorCode)
if ( AppConnectedCallbackCalled )
bus->CallApplicationDisconnectedCallback( this );
// bus->RemoveApplication( this );
- for ( int i = 0; i < regexp_in.size(); i++)
+ for ( unsigned int i = 0; i < regexp_in.size(); i++)
delete regexp_in[i];
regexp_in.clear();
Close();
@@ -262,12 +269,10 @@ int IvyApplication::SendMsg(const char *message)
{
int count = 0;
Regexp *exp;
- std::map<int,Regexp*>::iterator iter;
/* send to already connected */
- if ( !regexp_in.empty() )
- for ( iter = regexp_in.begin(); iter != regexp_in.end(); iter++ )
+ for ( unsigned int i = 0; i < regexp_in.size(); i++ )
{
- exp = (*iter).second;
+ exp = regexp_in[i];
if ( exp && exp->Match( message ) )
{
@@ -277,7 +282,7 @@ int IvyApplication::SendMsg(const char *message)
buffer += (*exp)[i];
buffer += ARG_END;
}
- SendMsg( Msg, (*iter).first, buffer.c_str() );
+ SendMsg( Msg, i, buffer.c_str() );
count++;
}
}