ENH: encapsulated retrival of path to doxygen documentation

This commit is contained in:
andy
2012-08-16 15:00:36 +01:00
parent 0c081688ee
commit 20d9399d7f
2 changed files with 40 additions and 47 deletions

View File

@ -37,38 +37,47 @@ namespace Foam
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
Foam::fileName Foam::helpType::doxygenPath() const
{
const dictionary& docDict = debug::controlDict().subDict("Documentation");
List<fileName> docDirs(docDict.lookup("doxyDocDirs"));
label dirI = -1;
forAll(docDirs, i)
{
if (isDir(docDirs[i].expand()))
{
dirI = i;
break;
}
}
if (dirI == -1)
{
Info<< "No Doxygen sources found under search paths: "
<< docDirs << endl;
return fileName();
}
return docDirs[dirI];
}
void Foam::helpType::displayDocOptions
(
const string& searchStr,
const bool exactMatch
) const
{
const dictionary& docDict = debug::controlDict().subDict("Documentation");
List<fileName> docDirs(docDict.lookup("doxyDocDirs"));
fileName doxyPath(doxygenPath());
label i = -1;
forAll(docDirs, dirI)
if (!doxyPath.empty())
{
if (isDir(docDirs[dirI].expand()))
{
i = dirI;
break;
}
}
if (i != -1)
{
Info<< "Found doxygen help in " << docDirs[i].c_str() << nl << endl;
string docBrowser = getEnv("FOAM_DOC_BROWSER");
if (docBrowser.empty())
{
docDict.lookup("docBrowser") >> docBrowser;
}
Info<< "Found doxygen help in " << doxyPath.c_str() << nl << endl;
doxygenXmlParser parser
(
docDirs[i]/"../DTAGS",
doxyPath/"../DTAGS",
"tagfile",
searchStr,
exactMatch
@ -76,11 +85,6 @@ void Foam::helpType::displayDocOptions
Info<< "Valid types include:" << nl << SortableList<word>(parser.toc());
}
else
{
Info<< "No Doxygen sources found under search paths: "
<< docDirs << endl;
}
}
@ -91,32 +95,23 @@ void Foam::helpType::displayDoc
const bool exactMatch
) const
{
const dictionary& docDict = debug::controlDict().subDict("Documentation");
List<fileName> docDirs(docDict.lookup("doxyDocDirs"));
fileName doxyPath(doxygenPath());
label i = -1;
forAll(docDirs, dirI)
if (!doxyPath.empty())
{
if (isDir(docDirs[dirI].expand()))
{
i = dirI;
break;
}
}
if (i != -1)
{
Info<< "Found doxygen help in " << docDirs[i].c_str() << nl << endl;
Info<< "Found doxygen help in " << doxyPath.c_str() << nl << endl;
string docBrowser = getEnv("FOAM_DOC_BROWSER");
if (docBrowser.empty())
{
const dictionary& docDict =
debug::controlDict().subDict("Documentation");
docDict.lookup("docBrowser") >> docBrowser;
}
doxygenXmlParser parser
(
docDirs[i]/"../DTAGS",
doxyPath/"../DTAGS",
"tagfile",
searchStr,
exactMatch
@ -131,7 +126,7 @@ void Foam::helpType::displayDoc
{
fileName docFile
(
docDirs[i]/parser.subDict(className).lookup("filename")
doxyPath/parser.subDict(className).lookup("filename")
);
// can use FOAM_DOC_BROWSER='application file://%f' if required
@ -159,11 +154,6 @@ void Foam::helpType::displayDoc
<< exit(FatalError);
}
}
else
{
Info<< "No Doxygen sources found under search paths: "
<< docDirs << endl;
}
}

View File

@ -58,6 +58,9 @@ class helpType
protected:
//- Return file path to the Doxygen sources (if available)
fileName doxygenPath() const;
//- Display the list of documentation options
void displayDocOptions
(