My Project
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Static Public Member Functions | Static Public Attributes | List of all members
Htags Struct Reference

#include <htags.h>

Static Public Member Functions

static bool loadFilemap (const QCString &htmldir)
 
static QCString path2URL (const QCString &path)
 
static bool execute (const QCString &htmldir)
 

Static Public Attributes

static bool useHtags = FALSE
 

Detailed Description

This class is a namespace for HTAGS related functions

Definition at line 21 of file htags.h.

Member Function Documentation

bool Htags::execute ( const QCString &  htmldir)
static

constructs command line of htags(1) and executes it.

Return values
TRUEsuccess
FALSEan error has occurred.

Definition at line 37 of file htags.cpp.

References Config_getBool, Config_getList, Config_getString, err(), g_inputDir, portable_system(), portable_sysTimerStart(), and portable_sysTimerStop().

Referenced by generateOutput().

{
static QStrList &inputSource = Config_getList(INPUT);
static bool quiet = Config_getBool(QUIET);
static bool warnings = Config_getBool(WARNINGS);
static QCString htagsOptions = ""; //Config_getString(HTAGS_OPTIONS);
static QCString projectName = Config_getString(PROJECT_NAME);
static QCString projectNumber = Config_getString(PROJECT_NUMBER);
QCString cwd = QDir::currentDirPath().utf8();
if (inputSource.isEmpty())
{
g_inputDir.setPath(cwd);
}
else if (inputSource.count()==1)
{
g_inputDir.setPath(inputSource.first());
if (!g_inputDir.exists())
err("Cannot find directory %s. "
"Check the value of the INPUT tag in the configuration file.\n",
inputSource.first()
);
}
else
{
err("If you use USE_HTAGS then INPUT should specify a single directory.\n");
return FALSE;
}
/*
* Construct command line for htags(1).
*/
QCString commandLine = " -g -s -a -n ";
if (!quiet) commandLine += "-v ";
if (warnings) commandLine += "-w ";
if (!htagsOptions.isEmpty())
{
commandLine += ' ';
commandLine += htagsOptions;
}
if (!projectName.isEmpty())
{
commandLine += "-t \"";
commandLine += projectName;
if (!projectNumber.isEmpty())
{
commandLine += '-';
commandLine += projectNumber;
}
commandLine += "\" ";
}
commandLine += " \"" + htmldir + "\"";
QCString oldDir = QDir::currentDirPath().utf8();
QDir::setCurrent(g_inputDir.absPath());
//printf("CommandLine=[%s]\n",commandLine.data());
bool result=portable_system("htags",commandLine,FALSE)==0;
QDir::setCurrent(oldDir);
return result;
}
bool Htags::loadFilemap ( const QCString &  htmlDir)
static

load filemap and make index.

Parameters
htmlDirof HTML directory generated by htags(1).
Return values
TRUEsuccess
FALSEerror

Definition at line 105 of file htags.cpp.

References err(), and g_symbolDict().

Referenced by generateOutput().

{
QCString fileMapName = htmlDir+"/HTML/FILEMAP";
QFileInfo fi(fileMapName);
/*
* Construct FILEMAP dictionary using QDict.
*
* In FILEMAP, URL includes 'html' suffix but we cut it off according
* to the method of FileDef class.
*
* FILEMAP format:
* <NAME>\t<HREF>.html\n
* QDICT:
* dict[<NAME>] = <HREF>
*/
if (fi.exists() && fi.isReadable())
{
QFile f(fileMapName);
const int maxlen = 8192;
QCString line(maxlen+1);
line.at(maxlen)='\0';
if (f.open(IO_ReadOnly))
{
int len;
while ((len=f.readLine(line.rawData(),maxlen))>0)
{
line.resize(len+1);
//printf("Read line: %s",line.data());
int sep = line.find('\t');
if (sep!=-1)
{
QCString key = line.left(sep).stripWhiteSpace();
QCString value = line.mid(sep+1).stripWhiteSpace();
int ext=value.findRev('.');
if (ext!=-1) value=value.left(ext); // strip extension
g_symbolDict.setAutoDelete(TRUE);
g_symbolDict.insert(key,new QCString(value));
//printf("Key/Value=(%s,%s)\n",key.data(),value.data());
}
}
return TRUE;
}
else
{
err("file %s cannot be opened\n",fileMapName.data());
}
}
return FALSE;
}
QCString Htags::path2URL ( const QCString &  path)
static

convert path name into the url in the hypertext generated by htags.

Parameters
pathpath name
Returns
URL NULL: not found.

Definition at line 159 of file htags.cpp.

References g_inputDir, and g_symbolDict().

Referenced by FileDef::getSourceFileBase().

{
QCString url,symName=path;
QCString dir = g_inputDir.absPath().utf8();
int dl=dir.length();
if ((int)symName.length()>dl+1)
{
symName = symName.mid(dl+1);
}
if (!symName.isEmpty())
{
QCString *result = g_symbolDict[symName];
//printf("path2URL=%s symName=%s result=%p\n",path.data(),symName.data(),result);
if (result)
{
url = "HTML/" + *result;
}
}
return url;
}

Member Data Documentation

bool Htags::useHtags = FALSE
static

Definition at line 23 of file htags.h.

Referenced by generateOutput(), Definition::getSourceAnchor(), and FileDef::getSourceFileBase().


The documentation for this struct was generated from the following files: