Public Member Functions | Private Member Functions | Private Attributes | List of all members
FileName Class Reference

#include <filename.h>

Inheritance diagram for FileName:
FileList QList< FileDef > QGList

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
 
- Public Member Functions inherited from QList< FileDef >
 QList ()
 
 QList (const QList< FileDef > &l)
 
 ~QList ()
 
QList< FileDef > & operator= (const QList< FileDef > &l)
 
bool operator== (const QList< FileDef > &list) const
 
uint count () const
 
bool isEmpty () const
 
bool insert (uint i, const FileDef *d)
 
void inSort (const FileDef *d)
 
void prepend (const FileDef *d)
 
void append (const FileDef *d)
 
bool remove (uint i)
 
bool remove (const FileDef *d)
 
bool removeRef (const FileDef *d)
 
bool removeFirst ()
 
bool removeLast ()
 
FileDeftake (uint i)
 
void clear ()
 
void sort ()
 
int find (const FileDef *d) const
 
int findRef (const FileDef *d) const
 
uint contains (const FileDef *d) const
 
uint containsRef (const FileDef *d) const
 
FileDefat (uint i) const
 
FileDefgetFirst () const
 
FileDefgetLast () const
 
void setAutoDelete (bool enable)
 

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.

22  : FileList()
23 {
25  fName=fn;
26  name=n;
27 }
QCString name
Definition: filename.h:37
FileList()
Definition: filedef.h:242
QAsciiDict< Entry > fn
std::void_t< T > n
QCString fName
Definition: filename.h:38
void setAutoDelete(bool enable)
Definition: qlist.h:99
const bool TRUE
Definition: qglobal.h:371
FileName::~FileName ( )

Definition at line 29 of file filename.cpp.

30 {
31 }

Member Function Documentation

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

Reimplemented from FileList.

Definition at line 103 of file filename.cpp.

104 {
105  return qstricmp(f1->fileName(),f2->fileName());
106 }
int qstricmp(const char *str1, const char *str2)
Definition: qcstring.cpp:567
const char* FileName::fileName ( ) const
inline

Definition at line 31 of file filename.h.

31 { return name; }
QCString name
Definition: filename.h:37
const char* FileName::fullName ( ) const
inline

Definition at line 32 of file filename.h.

32 { return fName; }
QCString fName
Definition: filename.h:38
void FileName::generateDiskNames ( )

Definition at line 34 of file filename.cpp.

35 {
36  //QCString commonPrefix;
37  QListIterator<FileDef> it(*this);
38  FileDef *fd;
39  int count=0;
40  for (;(fd=it.current());++it)
41  {
42  if (!fd->isReference()) count++;
43  }
44  if (count==1)
45  {
46  // skip references
47  for (it.toFirst();(fd=it.current()) && fd->isReference();++it) { }
48  if (fd)
49  {
50  // name if unique, so diskname is simply the name
51  //printf("!!!!!!!! Unique disk name=%s for fd=%s\n",name.data(),fd->diskname.data());
52  fd->m_diskName=name;
53  }
54  }
55  else if (count>1) // multiple occurrences of the same file name
56  {
57  //printf("Multiple occurrences of %s\n",name.data());
58  int i=0,j=0;
59  bool found=FALSE;
60  while (!found) // search for the common prefix of all paths
61  {
62  for (it.toFirst();(fd=it.current()) && fd->isReference();++it) { }
63  if (fd)
64  {
65  char c=fd->m_path.at(i);
66  if (c=='/') j=i; // remember last position of dirname
67  ++it;
68  while ((fd=it.current()) && !found)
69  {
70  if (!fd->isReference())
71  {
72  //printf("i=%d j=%d fd->path=`%s' fd->name=`%s'\n",i,j,fd->path.left(i).data(),fd->name().data());
73  if (i==(int)fd->m_path.length())
74  {
75  //warning("Input file %s found multiple times!\n"
76  // " The generated documentation for this file may not be correct!\n",fd->absFilePath().data());
77  found=TRUE;
78  }
79  else if (fd->m_path[i]!=c)
80  {
81  found=TRUE;
82  }
83  }
84  ++it;
85  }
86  i++;
87  }
88  }
89  for (it.toFirst();(fd=it.current());++it)
90  {
91  //printf("fd->setName(%s)\n",(fd->path.right(fd->path.length()-j-1)+name).data());
92  if (!fd->isReference())
93  {
94  QCString prefix = fd->m_path.right(fd->m_path.length()-j-1);
95  fd->setName(prefix+name);
96  //printf("!!!!!!!! non unique disk name=%s for fd=%s\n",(prefix+name).data(),fd->diskname.data());
97  fd->m_diskName=prefix+name;
98  }
99  }
100  }
101 }
QCString name
Definition: filename.h:37
uint length() const
Definition: qcstring.h:195
virtual void setName(const char *name)
Definition: definition.cpp:396
char & at(uint i) const
Definition: qcstring.h:326
QCString m_path
Definition: filedef.h:220
const bool FALSE
Definition: qglobal.h:370
virtual bool isReference() const
uint count() const
Definition: qlist.h:66
QCString right(uint len) const
Definition: qcstring.cpp:231
const bool TRUE
Definition: qglobal.h:371
QCString m_diskName
Definition: filedef.h:222

Member Data Documentation

QCString FileName::fName
private

Definition at line 38 of file filename.h.

QCString FileName::name
private

Definition at line 37 of file filename.h.


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