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

#include <filename.h>

Inheritance diagram for FileName:
FileList

Public Member Functions

 FileName (const char *fn, const char *name)
 
 ~FileName ()
 
const char * fileName () const
 
const char * fullName () const
 
void generateDiskNames ()
 
- Public Member Functions inherited from FileList
 FileList ()
 
 FileList (const char *path)
 
 ~FileList ()
 
QCString path () const
 

Private Member Functions

int compareValues (const FileDef *item1, const FileDef *item2) const
 

Private Attributes

QCString name
 
QCString fName
 

Detailed Description

Class representing all files with a certain base name

Definition at line 26 of file filename.h.

Constructor & Destructor Documentation

FileName::FileName ( const char *  fn,
const char *  name 
)

Definition at line 22 of file filename.cpp.

References fName, and name.

{
setAutoDelete(TRUE);
fName=fn;
name=n;
}
FileName::~FileName ( )

Definition at line 29 of file filename.cpp.

{
}

Member Function Documentation

int FileName::compareValues ( const FileDef item1,
const FileDef item2 
) const
private

Definition at line 105 of file filename.cpp.

References FileDef::fileName().

{
return qstricmp(f1->fileName(),f2->fileName());
}
const char* FileName::fileName ( ) const
inline

Definition at line 31 of file filename.h.

References name.

Referenced by FileNameList::compareValues().

{ return name; }
const char* FileName::fullName ( ) const
inline

Definition at line 32 of file filename.h.

References fName.

Referenced by FileNameList::compareValues().

{ return fName; }
void FileName::generateDiskNames ( )

Definition at line 34 of file filename.cpp.

References FileDef::getPath(), Definition::isReference(), name, FileList::path(), FileDef::setDiskName(), and Definition::setName().

Referenced by FileNameList::generateDiskNames().

{
//QCString commonPrefix;
QListIterator<FileDef> it(*this);
FileDef *fd;
int count=0;
for (;(fd=it.current());++it)
{
if (!fd->isReference()) count++;
}
if (count==1)
{
// skip references
for (it.toFirst();(fd=it.current()) && fd->isReference();++it) { }
if (fd)
{
// name if unique, so diskname is simply the name
//printf("!!!!!!!! Unique disk name=%s for fd=%s\n",name.data(),fd->diskname.data());
}
}
else if (count>1) // multiple occurrences of the same file name
{
//printf("Multiple occurrences of %s\n",name.data());
int i=0,j=0;
bool found=FALSE;
while (!found) // search for the common prefix of all paths
{
for (it.toFirst();(fd=it.current()) && fd->isReference();++it) { }
if (fd)
{
char c=fd->getPath().at(i);
if (c=='/') j=i; // remember last position of dirname
++it;
while ((fd=it.current()) && !found)
{
QCString path = fd->getPath();
if (!fd->isReference())
{
//printf("i=%d j=%d fd->path=`%s' fd->name=`%s'\n",i,j,fd->path.left(i).data(),fd->name().data());
if (i==(int)path.length())
{
//warning("Input file %s found multiple times!\n"
// " The generated documentation for this file may not be correct!\n",fd->absFilePath().data());
found=TRUE;
}
else if (path[i]!=c)
{
found=TRUE;
}
}
++it;
}
i++;
}
}
for (it.toFirst();(fd=it.current());++it)
{
//printf("fd->setName(%s)\n",(fd->path.right(fd->path.length()-j-1)+name).data());
if (!fd->isReference())
{
QCString path = fd->getPath();
QCString prefix = path.right(path.length()-j-1);
fd->setName(prefix+name);
//printf("!!!!!!!! non unique disk name=%s:%s\n",prefix.data(),name.data());
fd->setDiskName(prefix+name);
}
}
}
}

Member Data Documentation

QCString FileName::fName
private

Definition at line 38 of file filename.h.

Referenced by FileName(), and fullName().

QCString FileName::name
private

Definition at line 37 of file filename.h.

Referenced by FileName(), fileName(), and generateDiskNames().


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