Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

RecursivePass1 Class Reference

RecursivePass1 : simply validate use statements in a requirements file and echo those that really need to be handled. More...

Inheritance diagram for RecursivePass1

Inheritance graph
[legend]
Collaboration diagram for RecursivePass1:

Collaboration graph
[legend]
List of all members.

Public Methods

void begin ()
void filter (const cmt_string& line)
const cmt_stringresult () const
 At the first pass, we simply accumulate the not-yet handled use statements. More...


Private Attributes

cmt_string m_result
bool m_first

Detailed Description

RecursivePass1 : simply validate use statements in a requirements file and echo those that really need to be handled.

Definition at line 87 of file cmt_cvs.cxx.


Member Function Documentation

void RecursivePass1::begin ( ) [virtual]
 

Reimplemented from Awk.

Definition at line 1634 of file cmt_cvs.cxx.

01635 {
01636   m_first = true;
01637   m_result = "";
01638 }

void RecursivePass1::filter ( const cmt_string & line ) [virtual]
 

Reimplemented from Awk.

Definition at line 1640 of file cmt_cvs.cxx.

01641 {
01642     //if (CmtSystem::testenv ("CMTTESTAWK")) cout << "RecursivePass1::filter" << endl;
01643 
01644   if (line.find ("use CMT") != cmt_string::npos) return;
01645   if (line.find ("use cmt") != cmt_string::npos) return;
01646   
01647   History& h = History::instance ();
01648   
01649   if (h.is_installed (line)) return;
01650   
01651   CmtSystem::cmt_string_vector words;
01652   
01653   CmtSystem::split (line, " \t", words);
01654 
01655   enum
01656   {
01657     need_package,
01658     need_version,
01659     need_path,
01660     no_need
01661   } state = need_package;
01662 
01663   cmt_string package;
01664   cmt_string version;
01665   cmt_string path;
01666 
01667   for (int i = 1; i < words.size (); i++)
01668     {
01669       const cmt_string& s = words[i];
01670 
01671       if (s[0] == '-') continue;
01672 
01673       switch (state)
01674         {
01675           case need_package:
01676             package = s;
01677             state = need_version;
01678             break;
01679           case need_version:
01680             version = s;
01681             state = need_path;
01682             break;
01683           case need_path:
01684             path = s;
01685             state = no_need;
01686             break;
01687         }
01688     }
01689   
01690   if (version.find ("*") != cmt_string::npos)
01691     {
01692         /*
01693       cout << "# ================= Package " << package 
01694            << " version " << version << " " << path 
01695            << " has wild cards and will not be considered." << endl;
01696         */
01697       return;
01698     }
01699 
01705   m_result += line;
01706   m_result += "\n";
01707   
01708   if (m_first)
01709     {
01710       m_first = false;
01711       cout << "  # --> now propagate cmt checkout to :" << endl;
01712     }
01713   
01714   cout << "  #     " << package << " " << version << " " << path << endl;
01715 }

const cmt_string & RecursivePass1::result ( ) const
 

At the first pass, we simply accumulate the not-yet handled use statements.

Definition at line 1717 of file cmt_cvs.cxx.

01718 {
01719   return (m_result);
01720 }


Member Data Documentation

bool RecursivePass1::m_first [private]
 

Definition at line 97 of file cmt_cvs.cxx.

cmt_string RecursivePass1::m_result [private]
 

Definition at line 96 of file cmt_cvs.cxx.


The documentation for this class was generated from the following file:
Generated at Thu May 16 16:27:57 2002 for CMT by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000