source: CMT/v1r12p20020606/src/cmt_pattern.h @ 1

Last change on this file since 1 was 1, checked in by arnault, 19 years ago

Import all tags

File size: 2.4 KB
Line 
1#ifndef __cmt_pattern_h__
2#define __cmt_pattern_h__
3
4#include "cmt_parser.h"
5#include "cmt_system.h"
6
7class Use;
8
9class Template
10{
11public:
12        typedef cmt_vector<Template> TemplateVector;
13        cmt_string name;
14        cmt_string value;
15};
16
17class Pattern
18{
19public:
20  typedef cmt_vector<Pattern> PatternVector;
21
22  static void action (const CmtSystem::cmt_string_vector& words, Use* use);
23
24  static Pattern* find (const cmt_string& name);
25  static Pattern* find (const cmt_string& name, Use* use);
26  static void add (const cmt_string& name,
27                   const CmtSystem::cmt_string_vector& words,
28                   int start_index,
29                   bool global,
30                   Use* use);
31
32  static int pattern_number ();
33  static Pattern& pattern (int index);
34  static void clear_all ();
35  static PatternVector& patterns ();
36
37  static void apply_all_globals ();
38  static void apply_all_globals (Use* use);
39  static void show_all_names ();
40  static void show_all ();
41  static void show_all_applied_patterns ();
42  static void show (const cmt_string& name);
43
44public:
45  Pattern ();
46  ~Pattern ();
47
48  void clear ();
49  void apply () const;
50  void apply (Use* constext_use) const;
51  void apply (Use* constext_use,
52              const Template::TemplateVector& templates) const;
53  void expand (Use* constext_use,
54               const Template::TemplateVector& templates,
55               cmt_string& line) const;
56
57  cmt_string name;
58  CmtSystem::cmt_string_vector words;
59  bool global;
60  Use* use;
61};
62
63class ApplyPattern
64{
65public:
66  typedef cmt_vector<ApplyPattern> ApplyPatternVector;
67
68  static void action (const CmtSystem::cmt_string_vector& words,
69                      Use* use);
70
71  static ApplyPattern* add (const cmt_string& name, Use* use);
72
73public:
74  ApplyPattern ();
75  ~ApplyPattern ();
76
77  void show () const;
78  void apply_globals () const;
79  void apply () const;
80
81  cmt_string name;
82  Use* use;
83  cmt_vector<Template> replacements;
84};
85
86class IgnorePattern
87{
88public:
89  typedef cmt_vector<IgnorePattern> IgnorePatternVector;
90
91  static void action (const CmtSystem::cmt_string_vector& words, Use* use);
92
93  static IgnorePattern* find (const cmt_string& name, Use* use);
94  static void add (const cmt_string& name, Use* use);
95
96public:
97  IgnorePattern ();
98  ~IgnorePattern ();
99
100  void show () const;
101
102  cmt_string name;
103  Use* use;
104};
105
106#endif
Note: See TracBrowser for help on using the repository browser.