ENH: add 'report' to trace #includeEntry/#includeIfPresentEntry

- used in "expandDictionary -list" to find which files are included by
  any particular dictionary
This commit is contained in:
Mark Olesen
2011-04-15 13:34:25 +02:00
parent e1137fe8e2
commit c20efb0923
4 changed files with 77 additions and 11 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -39,6 +39,9 @@ const Foam::word Foam::functionEntries::includeEntry::typeName
// might include includeEntry
int Foam::functionEntries::includeEntry::debug(0);
bool Foam::functionEntries::includeEntry::report(false);
namespace Foam
{
namespace functionEntries
@ -89,10 +92,15 @@ bool Foam::functionEntries::includeEntry::execute
Istream& is
)
{
IFstream ifs(includeFileName(is));
const fileName fName(includeFileName(is));
IFstream ifs(fName);
if (ifs)
{
if (Foam::functionEntries::includeEntry::report)
{
Info<< fName << endl;
}
parentDict.read(ifs);
return true;
}
@ -119,10 +127,15 @@ bool Foam::functionEntries::includeEntry::execute
Istream& is
)
{
IFstream ifs(includeFileName(is));
const fileName fName(includeFileName(is));
IFstream ifs(fName);
if (ifs)
{
if (Foam::functionEntries::includeEntry::report)
{
Info<< fName << endl;
}
entry.read(parentDict, ifs);
return true;
}

View File

@ -82,6 +82,12 @@ protected:
public:
// Static data members
//- Report which file is included to stdout
static bool report;
//- Runtime type information
ClassName("include");

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -69,10 +69,15 @@ bool Foam::functionEntries::includeIfPresentEntry::execute
Istream& is
)
{
IFstream ifs(includeFileName(is));
const fileName fName(includeFileName(is));
IFstream ifs(fName);
if (ifs)
{
if (Foam::functionEntries::includeEntry::report)
{
Info<< fName << endl;
}
parentDict.read(ifs);
}
@ -87,10 +92,15 @@ bool Foam::functionEntries::includeIfPresentEntry::execute
Istream& is
)
{
IFstream ifs(includeFileName(is));
const fileName fName(includeFileName(is));
IFstream ifs(fName);
if (ifs)
{
if (Foam::functionEntries::includeEntry::report)
{
Info<< fName << endl;
}
entry.read(parentDict, ifs);
}