#include <cmt_cmtpath_pattern.h>
  Collaboration diagram for CmtPathPattern:
| Public Types | |
| typedef cmt_vector< CmtPathPattern >? | CmtPathPatternVector | 
| typedef cmt_vector< CmtPathPattern * >? | CmtPathPatternPtrVector | 
| Public Methods | |
| ? | CmtPathPattern () | 
| ? | ~CmtPathPattern () | 
| void? | clear () | 
| void? | apply () const | 
| ? | Applies a pattern to all CMTPATH entries. | 
| void? | expand (cmt_string &line, const cmt_string &path, const cmt_string &project) const | 
| Static Public Methods | |
| void? | action (const CmtSystem::cmt_string_vector &words, Use *use) | 
| void? | add (const CmtSystem::cmt_string_vector &words, Use *use) | 
| int? | pattern_number () | 
| ? | Get the number of registered patterns. | 
| CmtPathPattern &? | pattern (int index) | 
| ? | Get the index'th pattern in the database. | 
| void? | clear_all () | 
| CmtPathPatternVector &? | patterns () | 
| void? | apply_all () | 
| ? | Applies all patterns to all CMTPATH item. | 
| void? | show_all () | 
| ? | this is the cmt show cmtpath_patterns command It just shows the cmtpath_pattern declarations. | 
| Public Attributes | |
| cmt_string? | line | 
| Use *? | use | 
| 
 | 
| ? | Definition at line 16 of file cmt_cmtpath_pattern.h. | 
| 
 | 
| ? | Definition at line 15 of file cmt_cmtpath_pattern.h. | 
| 
 | 
| ? | Definition at line 166 of file cmt_cmtpath_pattern.cxx. 00167 {
00168 }
 | 
| 
 | 
| ? | Definition at line 171 of file cmt_cmtpath_pattern.cxx. 00173 {
00174 }
 | 
| 
 | ||||||||||||
| ? | Definition at line 17 of file cmt_cmtpath_pattern.cxx. References add(), Cmt::get_debug(), and cmt_vector< cmt_string >::size(). Referenced by KwdCmtPathPattern::action(). 00018 {
00019   if (words.size () < 1) return;
00020 
00021     //
00022     // expected syntax is:
00023     //
00024     //  cmtpath_pattern any-cmt-statement
00025     //
00026     // where any-cmt-statement may contain the "template"
00027     //
00028     //       | 
| 
 | ||||||||||||
| ? | Definition at line 40 of file cmt_cmtpath_pattern.cxx. References cmt_vector< CmtPathPattern >::add(), clear(), cmt_string::find(), line, cmt_string::npos, patterns(), cmt_vector< cmt_string >::size(), and use. Referenced by action(). 00041 {
00042   static CmtPathPatternVector& CmtPathPatterns = patterns ();
00043 
00044   CmtPathPattern& p = CmtPathPatterns.add ();
00045 
00046   p.clear ();
00047 
00048   p.use  = use;
00049 
00050   int first_word = 1;
00051 
00052     //
00053     // Install the cmt-statement as a vector of words.
00054     //
00055   for (int i = first_word; i < words.size (); i++)
00056     {
00057       bool need_quotes = (i > (first_word + 1));
00058 
00059       cmt_string& s = words[i];
00060 
00061       if (i > first_word) p.line += " ";
00062 
00063       if (s == ";") first_word = i+1;
00064 
00065       if ((s == "\n") | (s == ";"))
00066         {
00067           p.line += "\n  ";
00068         }
00069       else
00070         {
00071           cmt_string sep = "\"";
00072 
00073           if (s.find (sep) != cmt_string::npos)
00074             {
00075               sep = "\'";
00076             }
00077 
00078           if (!need_quotes) sep = "";
00079 
00080           p.line += sep;
00081           p.line += s;
00082           p.line += sep;
00083         }
00084     }
00085 }
 | 
| 
 | 
| ? | Applies a pattern to all CMTPATH entries. Definition at line 224 of file cmt_cmtpath_pattern.cxx. References Use::current(), expand(), cmt_string::find(), Cmt::get_debug(), Use::get_package_name(), line, cmt_string::npos, SyntaxParser::parse_requirements_text(), Project::reverse_broadcast(), and use. Referenced by apply_all(). 00225 {
00226   if (Cmt::get_debug ())
00227     {
00228       cout << "CmtPathPattern::apply> cmtpath_pattern defined in " << use->get_package_name () << endl;
00229     }
00230 
00231   Use& current_use = Use::current ();
00232 
00233   bool is_constant = ((line.find (" | 
| 
 | 
| ? | Applies all patterns to all CMTPATH item. Definition at line 131 of file cmt_cmtpath_pattern.cxx. References apply(), patterns(), and cmt_vector< CmtPathPattern >::size(). Referenced by CmtInstallAreaMgr::config(), and Cmt::set_standard_macros(). 00132 {
00133   static CmtPathPatternVector& CmtPathPatterns = patterns ();
00134 
00135   int i;
00136 
00137   for (i = 0; i < CmtPathPatterns.size (); i++)
00138     {
00139       CmtPathPattern& p = CmtPathPatterns[i];
00140 
00141       p.apply ();
00142     }
00143 }
 | 
| 
 | 
| ? | Definition at line 177 of file cmt_cmtpath_pattern.cxx. Referenced by add(), and clear_all(). | 
| 
 | 
| ? | Definition at line 107 of file cmt_cmtpath_pattern.cxx. References cmt_vector< CmtPathPattern >::clear(), clear(), patterns(), and cmt_vector< CmtPathPattern >::size(). Referenced by Database::clear(). 00108 {
00109   static CmtPathPatternVector& CmtPathPatterns = patterns ();
00110 
00111   for (int i = 0; i < CmtPathPatterns.size (); i++)
00112     {
00113       CmtPathPattern& p = CmtPathPatterns[i];
00114       p.clear ();
00115     }
00116 
00117   CmtPathPatterns.clear ();
00118 }
 | 
| 
 | ||||||||||||||||
| ? | Definition at line 258 of file cmt_cmtpath_pattern.cxx. References cmt_string::c_str(), line, and cmt_string::replace_all(). Referenced by apply(), and CmtPathPatternProjectAction::run(). 00261 {
00262   replacement = line;
00263 
00264   if (replacement != "")
00265     {
00266       // Substitute  | 
| 
 | 
| ? | Get the index'th pattern in the database. Definition at line 100 of file cmt_cmtpath_pattern.cxx. References patterns(). 00101 {
00102   static CmtPathPatternVector& CmtPathPatterns = patterns ();
00103 
00104   return (CmtPathPatterns[index]);
00105 }
 | 
| 
 | 
| ? | Get the number of registered patterns. Definition at line 90 of file cmt_cmtpath_pattern.cxx. References patterns(), and cmt_vector< CmtPathPattern >::size(). 00091 {
00092   static CmtPathPatternVector& CmtPathPatterns = patterns ();
00093 
00094   return (CmtPathPatterns.size ());
00095 }
 | 
| 
 | 
| ? | Definition at line 120 of file cmt_cmtpath_pattern.cxx. References Database::cmtpath_patterns(), and Database::instance(). Referenced by add(), apply_all(), clear_all(), pattern(), pattern_number(), and show_all(). 00121 {
00122   static Database& db = Database::instance ();
00123   static CmtPathPatternVector& CmtPathPatterns = db.cmtpath_patterns ();
00124 
00125   return (CmtPathPatterns);
00126 }
 | 
| 
 | 
| ? | this is the cmt show cmtpath_patterns command It just shows the cmtpath_pattern declarations. Definition at line 149 of file cmt_cmtpath_pattern.cxx. References Use::get_package_name(), line, patterns(), cmt_vector< CmtPathPattern >::size(), use, and Use::version. Referenced by Cmt::do_show_cmtpath_patterns(). 00150 {
00151   static CmtPathPatternVector& CmtPathPatterns = patterns ();
00152 
00153   int i;
00154 
00155   for (i = 0; i < CmtPathPatterns.size (); i++)
00156     {
00157       CmtPathPattern& p = CmtPathPatterns[i];
00158 
00159       cout << "# " << p.use->get_package_name () << " " << p.use->version 
00160            << " adds a cmtpath_pattern as " << endl;
00161       cout << "  " << p.line << endl;
00162     }
00163 }
 | 
| 
 | 
| ? | Definition at line 38 of file cmt_cmtpath_pattern.h. Referenced by add(), apply(), clear(), expand(), and show_all(). | 
| 
 | 
| ? | Definition at line 39 of file cmt_cmtpath_pattern.h. Referenced by add(), apply(), clear(), and show_all(). |