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

CmtMountFilterParser Class Reference

Inheritance diagram for CmtMountFilterParser:

Inheritance graph
[legend]
Collaboration diagram for CmtMountFilterParser:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 CmtMountFilterParser ()
void reset ()
bool is_done () const
const cmt_stringget_current_dir () const
void set_prefix (const cmt_string &prefix)
void filter (const cmt_string &line)

Private Attributes

bool m_done
cmt_string m_prefix
cmt_string m_current_dir

Constructor & Destructor Documentation

CmtMountFilterParser::CmtMountFilterParser  )  [inline]
 

Definition at line 660 of file cmt_parser.cxx.

References reset().

00661   {
00662     reset ();
00663   }


Member Function Documentation

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

Reimplemented from Awk.

Definition at line 687 of file cmt_parser.cxx.

References CmtSystem::cmt_string_vector, cmt_string::find(), m_current_dir, m_done, m_prefix, cmt_string::replace(), cmt_vector< T >::size(), CmtSystem::split(), and Awk::stop().

00688   {
00689     //cout << "line=" << line << endl;
00690 
00691     if (m_done) 
00692       {
00693         stop ();
00694         return;
00695       }
00696 
00697     CmtSystem::cmt_string_vector words;
00698 
00699     CmtSystem::split (line, " \t", words);
00700 
00701     int requested = 2;
00702 
00703     if (m_prefix != "")
00704       {
00705         requested++;
00706       }
00707 
00708     if (words.size () < requested) return;
00709 
00710     int n = 0;
00711 
00712     if (m_prefix != "")
00713       {
00714         if (words[n] != m_prefix) return;
00715         n++;
00716       }
00717 
00718     cmt_string& path_name = words[n];
00719     cmt_string& replacement = words[n+1];
00720     
00721     if (m_current_dir.find (path_name) != cmt_string::npos)
00722       {
00723         m_current_dir.replace (path_name, replacement);
00724         m_done = true;
00725         stop ();
00726       }
00727   }

const cmt_string& CmtMountFilterParser::get_current_dir  )  const [inline]
 

Definition at line 677 of file cmt_parser.cxx.

References m_current_dir.

Referenced by Cmt::configure_current_dir().

00678   {
00679     return (m_current_dir);
00680   }

bool CmtMountFilterParser::is_done  )  const [inline]
 

Definition at line 672 of file cmt_parser.cxx.

References m_done.

00673   {
00674     return (m_done);
00675   }

void CmtMountFilterParser::reset  )  [inline]
 

Definition at line 665 of file cmt_parser.cxx.

References m_current_dir, m_done, m_prefix, and CmtSystem::pwd().

Referenced by CmtMountFilterParser().

00666   {
00667     m_current_dir = CmtSystem::pwd ();
00668     m_done = false;
00669     m_prefix = "";
00670   }

void CmtMountFilterParser::set_prefix const cmt_string prefix  )  [inline]
 

Definition at line 682 of file cmt_parser.cxx.

References m_prefix.

Referenced by Cmt::configure_current_dir().

00683   {
00684     m_prefix = prefix;
00685   }


Member Data Documentation

cmt_string CmtMountFilterParser::m_current_dir [private]
 

Definition at line 732 of file cmt_parser.cxx.

Referenced by filter(), get_current_dir(), and reset().

bool CmtMountFilterParser::m_done [private]
 

Definition at line 730 of file cmt_parser.cxx.

Referenced by filter(), is_done(), and reset().

cmt_string CmtMountFilterParser::m_prefix [private]
 

Definition at line 731 of file cmt_parser.cxx.

Referenced by filter(), reset(), and set_prefix().


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