#include <cmt_cmtpath_pattern.h>
Collaboration diagram for CmtPathPattern:
Public Types | |
typedef cmt_vector< CmtPathPattern > | CmtPathPatternVector |
typedef cmt_vector< CmtPathPattern * > | CmtPathPatternPtrVector |
Public Member Functions | |
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 Member Functions | |
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. Referenced by add(), apply_all(), clear_all(), Database::cmtpath_patterns(), pattern(), pattern_number(), patterns(), and show_all(). |
|
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(), CmtSystem::cmt_string_vector, Cmt::get_debug(), and cmt_vector< T >::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 // <path> 00029 // <project> 00030 // 00031 00032 add (words, use); 00033 00034 if (Cmt::get_debug ()) 00035 { 00036 cout << "CmtPathPattern::action> add " << endl; 00037 } 00038 } |
|
Definition at line 40 of file cmt_cmtpath_pattern.cxx. References cmt_vector< T >::add(), clear(), CmtSystem::cmt_string_vector, CmtPathPatternVector, cmt_string::find(), line, patterns(), cmt_vector< T >::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, 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 ("<path>") == cmt_string::npos) && 00234 (line.find ("<project>") == cmt_string::npos)); 00235 00236 if (is_constant) 00237 { 00238 cmt_string buffer; 00239 00240 expand (buffer, "", ""); 00241 00242 if (Cmt::get_debug ()) 00243 { 00244 cout << "CmtPathPattern::apply> text=[" << buffer << "]" << endl; 00245 } 00246 00247 SyntaxParser::parse_requirements_text (buffer, "", ¤t_use); 00248 buffer = ""; 00249 } 00250 else 00251 { 00252 CmtPathPatternProjectAction pa (*this, current_use); 00253 00254 Project::reverse_broadcast (pa); 00255 } 00256 } |
|
Applies all patterns to all CMTPATH item.
Definition at line 131 of file cmt_cmtpath_pattern.cxx. References apply(), CmtPathPatternVector, patterns(), and cmt_vector< T >::size(). Referenced by CmtInstallAreaMgr::config(), and StandardMacroBuilder::fill_for_install_area().
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< T >::clear(), clear(), CmtPathPatternVector, patterns(), and cmt_vector< T >::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 <path> template from the cmt statement 00267 replacement.replace_all ("<path>", path.c_str ()); 00268 replacement.replace_all ("<project>", project.c_str ()); 00269 } 00270 } |
|
Get the index'th pattern in the database.
Definition at line 100 of file cmt_cmtpath_pattern.cxx. References CmtPathPatternVector, and 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 CmtPathPatternVector, patterns(), and cmt_vector< T >::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(), CmtPathPatternVector, 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 CmtPathPatternVector, Use::get_package_name(), line, patterns(), cmt_vector< T >::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(). |