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

Cut Class Reference

Cut : perform a cut-like operation :. More...

Inheritance diagram for Cut:

Inheritance graph
[legend]
Collaboration diagram for Cut:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Cut (int field)
void begin ()
void filter (const cmt_string &line)
const cmt_stringresult () const

Private Attributes

cmt_string m_result
int m_field

Detailed Description

Cut : perform a cut-like operation :.

o collect the 'th field of every line into the m_result internal variable

o the field number is given in the constructor and starts at zero.

o selected fields are accumulated with a space as separator.

Definition at line 57 of file cmt_cvs.cxx.


Constructor & Destructor Documentation

Cut::Cut int  field  ) 
 

Definition at line 2222 of file cmt_cvs.cxx.

References m_field.

02223 {
02224   m_field = field;
02225 }


Member Function Documentation

void Cut::begin  )  [virtual]
 

Reimplemented from Awk.

Definition at line 2227 of file cmt_cvs.cxx.

References m_result.

02228 {
02229     //if (CmtSystem::testenv ("CMTTESTAWK")) cout << "Cut::begin" << endl;
02230   m_result = "";
02231 }

void Cut::filter const cmt_string line  )  [virtual]
 

Reimplemented from Awk.

Definition at line 2233 of file cmt_cvs.cxx.

References CmtSystem::cmt_string_vector, m_field, m_result, cmt_vector< T >::size(), and CmtSystem::split().

02234 {
02235     //if (CmtSystem::testenv ("CMTTESTAWK")) cout << "Cut::filter" << endl;
02236 
02237   static CmtSystem::cmt_string_vector words;
02238   
02239   CmtSystem::split (line, " \t", words);
02240   
02241   if (words.size () <= m_field) return;
02242   
02243   if (m_result != "") m_result += " ";
02244   m_result += words[m_field];
02245 }

const cmt_string & Cut::result  )  const
 

Definition at line 2247 of file cmt_cvs.cxx.

References m_result.

Referenced by CvsImplementation::do_checkout_phase1().

02248 {
02249   return (m_result);
02250 }


Member Data Documentation

int Cut::m_field [private]
 

Definition at line 67 of file cmt_cvs.cxx.

Referenced by Cut(), and filter().

cmt_string Cut::m_result [private]
 

Definition at line 66 of file cmt_cvs.cxx.

Referenced by begin(), filter(), and result().


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