Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

DependencyFilter Class Reference

With this Awk filter, we analyze an existing dependency file. More...

Inheritance diagram for DependencyFilter:

Inheritance graph
[legend]
Collaboration diagram for DependencyFilter:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 DependencyFilter ()
void begin ()
void filter (const cmt_string &line)
void add_source (const cmt_string &file_name)
bool has_source (const cmt_string &file_name) const
cmt_stringget_sources ()

Private Attributes

cmt_string m_sources

Detailed Description

With this Awk filter, we analyze an existing dependency file.

We get the source name in each line The list of sources is maintained in m_sources A source is stored in the form _<suffix> (instead of .)

Definition at line 2530 of file cmt_generators.cxx.


Constructor & Destructor Documentation

DependencyFilter::DependencyFilter  )  [inline]
 

Definition at line 2533 of file cmt_generators.cxx.

02534       {
02535       }


Member Function Documentation

void DependencyFilter::add_source const cmt_string file_name  )  [inline]
 

Definition at line 2558 of file cmt_generators.cxx.

References CmtSystem::basename(), cmt_string::find(), CmtSystem::get_dot_suffix(), CmtSystem::get_suffix(), and m_sources.

Referenced by DependencyGenerator::build().

02559       {
02560         static cmt_string suffix;
02561         static cmt_string name;
02562 
02563         CmtSystem::get_dot_suffix (file_name, suffix);
02564         CmtSystem::basename (file_name, suffix, name);
02565         CmtSystem::get_suffix (file_name, suffix);
02566 
02567         cmt_string s = " ";
02568         s += name;
02569         s += "_";
02570         s += suffix;
02571         s += " ";
02572 
02573         if (m_sources.find (s) == cmt_string::npos)
02574           {
02575             m_sources += s;
02576           }        
02577       }

void DependencyFilter::begin  )  [inline, virtual]
 

Reimplemented from Awk.

Definition at line 2537 of file cmt_generators.cxx.

References m_sources.

02538       {
02539         m_sources = "";
02540       }

void DependencyFilter::filter const cmt_string line  )  [inline, virtual]
 

Reimplemented from Awk.

Definition at line 2542 of file cmt_generators.cxx.

References cmt_string::erase(), cmt_string::find(), and m_sources.

02543       {
02544         int pos = line.find ("_dependencies = ");
02545         if (pos == cmt_string::npos) return;
02546 
02547         cmt_string s = line;
02548         s.erase (pos);
02549 
02550         m_sources += " ";
02551         m_sources += s;
02552         m_sources += " ";
02553 
02554           //pos = s.find_last_of ("_");
02555           //if (pos != cmt_string::npos) s[pos] = "."
02556       }

cmt_string& DependencyFilter::get_sources  )  [inline]
 

Definition at line 2604 of file cmt_generators.cxx.

References m_sources.

02605       {
02606         return (m_sources);
02607       }

bool DependencyFilter::has_source const cmt_string file_name  )  const [inline]
 

Definition at line 2579 of file cmt_generators.cxx.

References CmtSystem::basename(), cmt_string::find(), CmtSystem::get_dot_suffix(), CmtSystem::get_suffix(), and m_sources.

Referenced by DependencyGenerator::build().

02580       {
02581         static cmt_string suffix;
02582         static cmt_string name;
02583 
02584         CmtSystem::get_dot_suffix (file_name, suffix);
02585         CmtSystem::basename (file_name, suffix, name);
02586         CmtSystem::get_suffix (file_name, suffix);
02587 
02588         cmt_string s = " ";
02589         s += name;
02590         s += "_";
02591         s += suffix;
02592         s += " ";
02593 
02594         if (m_sources.find (s) == cmt_string::npos)
02595           {
02596             return (false);
02597           }
02598         else
02599           {
02600             return (true);
02601           }
02602       }


Member Data Documentation

cmt_string DependencyFilter::m_sources [private]
 

Definition at line 2610 of file cmt_generators.cxx.

Referenced by add_source(), begin(), filter(), get_sources(), and has_source().


The documentation for this class was generated from the following file:
Generated on Mon May 2 10:25:36 2005 for CMT by doxygen 1.3.5