[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[oMetah-devel] ometah/interface itsArgument.cpp ometah.cpp
From: |
Jean-Philippe Aumasson |
Subject: |
[oMetah-devel] ometah/interface itsArgument.cpp ometah.cpp |
Date: |
Thu, 02 Jun 2005 11:42:06 -0400 |
CVSROOT: /cvsroot/ometah
Module name: ometah
Branch:
Changes by: Jean-Philippe Aumasson <address@hidden> 05/06/02 15:42:06
Modified files:
interface : itsArgument.cpp ometah.cpp
Log message:
* added checking of termination flags in itsParser's constructor :
--version and --help. Todo : throw exception and return, showing message to
stdout.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/ometah/ometah/interface/itsArgument.cpp.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/ometah/ometah/interface/ometah.cpp.diff?tr1=1.23&tr2=1.24&r1=text&r2=text
Patches:
Index: ometah/interface/itsArgument.cpp
diff -u ometah/interface/itsArgument.cpp:1.5
ometah/interface/itsArgument.cpp:1.6
--- ometah/interface/itsArgument.cpp:1.5 Thu Jun 2 12:42:47 2005
+++ ometah/interface/itsArgument.cpp Thu Jun 2 15:42:06 2005
@@ -1,5 +1,5 @@
/***************************************************************************
- * $Id: itsArgument.cpp,v 1.5 2005/06/02 12:42:47 jpa Exp $
+ * $Id: itsArgument.cpp,v 1.6 2005/06/02 15:42:06 jpa Exp $
* Copyright : Université Paris 12 Val-de-Marne
* Author : Johann Dréo <address@hidden>
* Author : Jean-Philippe Aumasson <address@hidden>
@@ -83,6 +83,15 @@
{
this->argv = argv;
this->argc = argc;
+
+ // termination flags : if there, don't execute program
+ // following order <=> flags' priorities
+
+ if (this->defArg("-v","--version","check version", false, "", ""))
+ cout << "current version is ..."; // EXCEPTION ! (show version and quit)
+
+ if (this->defArg("-h","--help","show help", false, "", ""))
+ cout << "help infos..."; // EXCEPTIOn (show help instructions and quit)
}
// parse argv searching the given flag, then update the vector with a new
argument
@@ -111,7 +120,7 @@
if ((++i) < this->argv.size())
value = this->argv.at(i);
- else; // EXCEPTION !
+ else; // EXCEPTION ! ( valeur attendue absente )
}
else { // no value associated => arg has boolean value
value = "true";
Index: ometah/interface/ometah.cpp
diff -u ometah/interface/ometah.cpp:1.23 ometah/interface/ometah.cpp:1.24
--- ometah/interface/ometah.cpp:1.23 Thu Jun 2 12:42:47 2005
+++ ometah/interface/ometah.cpp Thu Jun 2 15:42:06 2005
@@ -1,5 +1,5 @@
/***************************************************************************
- * $Id: ometah.cpp,v 1.23 2005/06/02 12:42:47 jpa Exp $
+ * $Id: ometah.cpp,v 1.24 2005/06/02 15:42:06 jpa Exp $
* Copyright : Université Paris 12 Val-de-Marne
* Author : Johann Dréo <address@hidden>
* Author : Jean-Philippe Aumasson <address@hidden>
@@ -40,6 +40,7 @@
itsParser theParser(argc, argumentsVector);
theParser.defArg("-p","--problem","problem name", true, "string",
"Rosenbrock");
+
cout << "\ngetValue : " << theParser.getStringValue("-p") << endl;
- [oMetah-devel] ometah/interface itsArgument.cpp ometah.cpp,
Jean-Philippe Aumasson <=