#include <cmt_pattern.h>
Collaboration diagram for PatternList:
Public Types |
|
typedef cmt_map< cmt_string, PatternList >? |
PatternListMap |
typedef cmt_vector< PatternList >? | PatternListVector |
Public Methods |
|
? | PatternList () |
? | PatternList (const cmt_string &name) |
? | ~PatternList () |
Pattern::PatternPtrVector &? | get_patterns () |
void? | add_pattern (Pattern *pattern) |
void? | clear () |
Static Public Methods |
|
PatternList *? | find (const cmt_string &name) |
Pattern *? | find_pattern (const cmt_string &name) |
Pattern *? | find (const cmt_string &name, Use *use) |
PatternList *? | add (const cmt_string &name) |
void? | clear_all () |
PatternListMap &? | pattern_list_map () |
PatternListVector &? | pattern_lists () |
void? | apply_all_globals () |
? |
Applies all global patterns to all uses. |
void? | apply_all_globals (Use *use) |
? |
Applies all global patterns to a given Use. |
void? | show_all_patterns () |
? |
Show all patterns. |
void? | show_all_pattern_names () |
? |
Show all pattern names. |
Public Attributes |
|
cmt_string? | m_name |
Pattern::PatternPtrVector? | m_patterns |
|
? |
Definition at line 76 of file cmt_pattern.h. |
|
? |
Definition at line 77 of file cmt_pattern.h. |
|
? |
Definition at line 108 of file cmt_pattern.cxx. 00109 { 00110 } |
|
? |
Definition at line 112 of file cmt_pattern.cxx. 00112 : m_name (name) 00113 { 00114 } |
|
? |
Definition at line 116 of file cmt_pattern.cxx. References clear(). 00117 { 00118 clear (); 00119 } |
|
? |
Definition at line 61 of file cmt_pattern.cxx. References cmt_map< cmt_string, PatternList >::add(), cmt_vector< PatternList >::add(), find(), m_name, pattern_list_map(), and pattern_lists(). Referenced by Pattern::add(). 00062 { 00063 PatternList* list = find (name); 00064 if (list != 0) return (list); 00065 00066 static PatternListVector& vector = pattern_lists (); 00067 00068 PatternList& pl = vector.add (); 00069 pl.m_name = name; 00070 00071 static PatternListMap& map = pattern_list_map (); 00072 map.add (name, pl); 00073 00074 return (&pl); 00075 } |
|
? |
Definition at line 126 of file cmt_pattern.cxx. References m_patterns, cmt_vector< Pattern * >::push_back(), cmt_vector< Pattern * >::size(), and Pattern::use. Referenced by Pattern::add(). 00127 { 00128 for (int i = 0; i < m_patterns.size (); i++) 00129 { 00130 Pattern* p = m_patterns[i]; 00131 if (p->use == pattern->use) 00132 { 00133 m_patterns[i] = pattern; 00134 return; 00135 } 00136 } 00137 00138 m_patterns.push_back (pattern); 00139 } |
|
? |
Applies all global patterns to a given Use. Definition at line 372 of file cmt_pattern.cxx. References Pattern::apply(), IgnorePattern::find(), Use::get_package_name(), Pattern::global, m_patterns, Pattern::name, pattern_lists(), cmt_vector< Pattern * >::size(), and cmt_vector< PatternList >::size(). 00373 { 00374 if (use->get_package_name () == "CMT") return; 00375 00376 static PatternListVector& PatternLists = pattern_lists (); 00377 00378 int i; 00379 00380 for (i = 0; i < PatternLists.size (); i++) 00381 { 00382 PatternList& pl = PatternLists[i]; 00383 00384 int n = pl.m_patterns.size (); 00385 00386 if (n > 0) 00387 { 00388 Pattern* p = pl.m_patterns[n-1]; 00389 00390 if ((p != 0) && (p->global)) 00391 { 00392 if (p->global) 00393 { 00394 if (IgnorePattern::find (p->name, use) == 0) p->apply (use); 00395 } 00396 } 00397 } 00398 } 00399 } |
|
? |
Applies all global patterns to all uses. Definition at line 348 of file cmt_pattern.cxx. References Pattern::apply(), Pattern::global, m_patterns, pattern_lists(), cmt_vector< Pattern * >::size(), and cmt_vector< PatternList >::size(). Referenced by Pattern::apply_all_globals(). 00349 { 00350 static PatternListVector& PatternLists = pattern_lists (); 00351 00352 int i; 00353 00354 for (i = 0; i < PatternLists.size (); i++) 00355 { 00356 PatternList& pl = PatternLists[i]; 00357 00358 int n = pl.m_patterns.size (); 00359 00360 if (n > 0) 00361 { 00362 Pattern* p = pl.m_patterns[n-1]; 00363 00364 if ((p != 0) && (p->global)) p->apply (); 00365 } 00366 } 00367 } |
|
? |
Definition at line 141 of file cmt_pattern.cxx. References cmt_vector< Pattern * >::clear(), m_name, and m_patterns. Referenced by clear_all(), and ~PatternList(). 00142 { 00143 m_name = ""; 00144 m_patterns.clear (); 00145 } |
|
? |
Definition at line 77 of file cmt_pattern.cxx. References cmt_map< cmt_string, PatternList >::clear(), cmt_vector< PatternList >::clear(), clear(), pattern_list_map(), pattern_lists(), and cmt_vector< PatternList >::size(). Referenced by Database::clear(). 00078 { 00079 static PatternListVector& vector = pattern_lists (); 00080 static PatternListMap& map = pattern_list_map (); 00081 00082 for (int i = 0; i < vector.size (); i++) 00083 { 00084 PatternList& p = vector[i]; 00085 p.clear (); 00086 } 00087 00088 vector.clear (); 00089 map.clear (); 00090 } |
|
? |
Definition at line 44 of file cmt_pattern.cxx. References find(), get_patterns(), cmt_vector< Pattern * >::size(), and Pattern::use. 00045 { 00046 PatternList* list = find (name); 00047 if (list == 0) return (0); 00048 00049 Pattern::PatternPtrVector& vector = list->get_patterns (); 00050 00051 for (int i = 0; i < vector.size (); i++) 00052 { 00053 Pattern* p = vector[i]; 00054 00055 if (p->use == use) return (p); 00056 } 00057 00058 return (0); 00059 } |
|
? |
Definition at line 22 of file cmt_pattern.cxx. References cmt_map< cmt_string, PatternList >::find(), and pattern_list_map(). Referenced by add(), Pattern::find(), find(), and find_pattern(). 00023 { 00024 static PatternListMap& map = pattern_list_map (); 00025 00026 return (map.find (name)); 00027 } |
|
? |
Definition at line 30 of file cmt_pattern.cxx. References find(), get_patterns(), and cmt_vector< Pattern * >::size(). Referenced by Pattern::find(). 00031 { 00032 PatternList* list = find (name); 00033 if (list == 0) return (0); 00034 00035 Pattern::PatternPtrVector& vector = list->get_patterns (); 00036 00037 if (vector.size () == 0) return (0); 00038 00039 Pattern* p = vector[vector.size () - 1]; 00040 00041 return (p); 00042 } |
|
? |
Definition at line 121 of file cmt_pattern.cxx. Referenced by find(), and find_pattern(). 00122 {
00123 return (m_patterns);
00124 }
|
|
? |
Definition at line 92 of file cmt_pattern.cxx. References Database::instance(), and Database::pattern_list_map(). Referenced by add(), clear_all(), and find(). 00093 { 00094 static Database& db = Database::instance (); 00095 static PatternListMap& map = db.pattern_list_map (); 00096 00097 return (map); 00098 } |
|
? |
Definition at line 100 of file cmt_pattern.cxx. References Database::instance(), and Database::pattern_lists(). Referenced by add(), apply_all_globals(), clear_all(), show_all_pattern_names(), and show_all_patterns(). 00101 { 00102 static Database& db = Database::instance (); 00103 static PatternListVector& vector = db.pattern_lists (); 00104 00105 return (vector); 00106 } |
|
? |
Show all pattern names. Definition at line 427 of file cmt_pattern.cxx. References m_patterns, Pattern::name, pattern_lists(), cmt_vector< Pattern * >::size(), and cmt_vector< PatternList >::size(). Referenced by Pattern::show_all_names(). 00428 { 00429 bool empty = true; 00430 00431 static PatternListVector& PatternLists = pattern_lists (); 00432 00433 int i; 00434 00435 for (i = 0; i < PatternLists.size (); i++) 00436 { 00437 PatternList& pl = PatternLists[i]; 00438 00439 int n = pl.m_patterns.size (); 00440 00441 if (n > 0) 00442 { 00443 Pattern* p = pl.m_patterns[n-1]; 00444 00445 if (p != 0) 00446 { 00447 cout << p->name << " "; 00448 empty = false; 00449 } 00450 } 00451 } 00452 if (!empty) cout << endl; 00453 } |
|
? |
Show all patterns. Definition at line 404 of file cmt_pattern.cxx. References m_patterns, pattern_lists(), Pattern::show(), cmt_vector< Pattern * >::size(), and cmt_vector< PatternList >::size(). Referenced by Pattern::show_all(). 00405 { 00406 static PatternListVector& PatternLists = pattern_lists (); 00407 00408 int i; 00409 00410 for (i = 0; i < PatternLists.size (); i++) 00411 { 00412 PatternList& pl = PatternLists[i]; 00413 00414 int n = pl.m_patterns.size (); 00415 00416 if (n > 0) 00417 { 00418 Pattern* p = pl.m_patterns[n-1]; 00419 00420 if (p != 0) p->show (); 00421 } 00422 } 00423 } |
|
? |
Definition at line 105 of file cmt_pattern.h. |
|
? |
Definition at line 106 of file cmt_pattern.h. Referenced by add_pattern(), apply_all_globals(), clear(), show_all_pattern_names(), and show_all_patterns(). |