Skip to content
Snippets Groups Projects
Commit 1b0cf102 authored by Mark Olesen's avatar Mark Olesen
Browse files

testing on fileName Istream construction

parent 066b3158
No related branches found
No related tags found
No related merge requests found
...@@ -66,10 +66,11 @@ int main(int argc, char *argv[]) ...@@ -66,10 +66,11 @@ int main(int argc, char *argv[])
argList::noBanner(); argList::noBanner();
argList::noParallel(); argList::noParallel();
argList::validArgs.insert("fileName .. fileNameN"); argList::validArgs.insert("fileName .. fileNameN");
argList::addOption("istream", "fileName", "test Istream values");
argList args(argc, argv, false, true); argList args(argc, argv, false, true);
if (args.additionalArgs().empty()) if (args.additionalArgs().empty() && args.options().empty())
{ {
args.printUsage(); args.printUsage();
} }
...@@ -95,6 +96,22 @@ int main(int argc, char *argv[]) ...@@ -95,6 +96,22 @@ int main(int argc, char *argv[])
printCleaning(pathName); 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; Info<< "\nEnd\n" << endl;
return 0; return 0;
} }
......
...@@ -22,9 +22,6 @@ License ...@@ -22,9 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
Istream constructor and IOstream operators for fileName.
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "fileName.H" #include "fileName.H"
...@@ -34,21 +31,41 @@ Description ...@@ -34,21 +31,41 @@ Description
Foam::fileName::fileName(Istream& is) Foam::fileName::fileName(Istream& is)
: :
string(is) string()
{ {
stripInvalid(); is >> *this;
} }
Foam::Istream& Foam::operator>>(Istream& is, fileName& fn) 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 // Check state of Istream
is.check("Istream& operator>>(Istream&, fileName&)"); is.check("Istream& operator>>(Istream&, fileName&)");
fn = fName;
return is; return is;
} }
......
...@@ -22,9 +22,6 @@ License ...@@ -22,9 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
Istream constructor and IOstream operators for word.
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "word.H" #include "word.H"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment