Commit 1b0cf102 authored by Mark Olesen's avatar Mark Olesen
Browse files

testing on fileName Istream construction

parent 066b3158
......@@ -66,10 +66,11 @@ int main(int argc, char *argv[])
argList::noBanner();
argList::noParallel();
argList::validArgs.insert("fileName .. fileNameN");
argList::addOption("istream", "fileName", "test Istream values");
argList args(argc, argv, false, true);
if (args.additionalArgs().empty())
if (args.additionalArgs().empty() && args.options().empty())
{
args.printUsage();
}
......@@ -95,6 +96,22 @@ int main(int argc, char *argv[])
printCleaning(pathName);
}
if (args.optionFound("istream"))
{
args.optionLookup("istream")() >> pathName;
Info<< nl
<< "-case" << nl
<< "path = " << args.path() << nl
<< "root = " << args.rootPath() << nl
<< "case = " << args.caseName() << nl
<< "FOAM_CASE=" << getEnv("FOAM_CASE") << nl
<< "FOAM_CASENAME=" << getEnv("FOAM_CASENAME") << nl
<< endl;
printCleaning(pathName);
}
Info<< "\nEnd\n" << endl;
return 0;
}
......
......@@ -22,9 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
Istream constructor and IOstream operators for fileName.
\*---------------------------------------------------------------------------*/
#include "fileName.H"
......@@ -34,21 +31,41 @@ Description
Foam::fileName::fileName(Istream& is)
:
string(is)
string()
{
stripInvalid();
is >> *this;
}
Foam::Istream& Foam::operator>>(Istream& is, fileName& fn)
{
fileName fName(is);
token t(is);
if (!t.good())
{
is.setBad();
return is;
}
if (t.isString())
{
fn = t.stringToken();
}
else
{
is.setBad();
FatalIOErrorIn("operator>>(Istream&, fileName&)", is)
<< "wrong token type - expected string, found " << t.info()
<< exit(FatalIOError);
return is;
}
fn.stripInvalid();
// Check state of Istream
is.check("Istream& operator>>(Istream&, fileName&)");
fn = fName;
return is;
}
......
......@@ -22,9 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
Istream constructor and IOstream operators for word.
\*---------------------------------------------------------------------------*/
#include "word.H"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment