Update of /cvsroot/com0com/hub4com/plugins/telnet
In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv32578
Modified Files:
filter.cpp
Log Message:
Added strict option checking
Index: filter.cpp
===================================================================
RCS file: /cvsroot/com0com/hub4com/plugins/telnet/filter.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** filter.cpp 14 Apr 2008 07:32:04 -0000 1.2
--- filter.cpp 20 Aug 2008 10:08:29 -0000 1.3
***************
*** 20,23 ****
--- 20,26 ----
*
* $Log$
+ * Revision 1.3 2008/08/20 10:08:29 vfrolov
+ * Added strict option checking
+ *
* Revision 1.2 2008/04/14 07:32:04 vfrolov
* Renamed option --use-port-module to --use-driver
***************
*** 47,54 ****
}
///////////////////////////////////////////////////////////////
! typedef map<int, TelnetProtocol*> PortsMap;
! typedef pair<int, TelnetProtocol*> PortPair;
!
! class Filter {
public:
Filter(int argc, const char *const argv[]);
--- 50,63 ----
}
///////////////////////////////////////////////////////////////
! class Valid {
! public:
! Valid() : isValid(TRUE) {}
! void Invalidate() { isValid = FALSE; }
! BOOL IsValid() const { return isValid; }
! private:
! BOOL isValid;
! };
! ///////////////////////////////////////////////////////////////
! class Filter : public Valid {
public:
Filter(int argc, const char *const argv[]);
***************
*** 60,63 ****
--- 69,76 ----
HHUB hHub;
string terminalType;
+
+ typedef map<int, TelnetProtocol*> PortsMap;
+ typedef pair<int, TelnetProtocol*> PortPair;
+
PortsMap portsMap;
};
***************
*** 72,75 ****
--- 85,89 ----
if (!pArg) {
cerr << "Unknown option " << *pArgs << endl;
+ Invalidate();
continue;
}
***************
*** 81,84 ****
--- 95,99 ----
} else {
cerr << "Unknown option " << pArg << endl;
+ Invalidate();
}
}
***************
*** 176,180 ****
const char *const argv[])
{
! return (HFILTER)new Filter(argc, argv);
}
///////////////////////////////////////////////////////////////
--- 191,205 ----
const char *const argv[])
{
! Filter *pFilter = new Filter(argc, argv);
!
! if (!pFilter)
! return NULL;
!
! if (!pFilter->IsValid()) {
! delete pFilter;
! return NULL;
! }
!
! return (HFILTER)pFilter;
}
///////////////////////////////////////////////////////////////
|