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

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

Import all tags

File size: 2.6 KB
Line 
1#ifndef __cmt_symbol_h__
2#define __cmt_symbol_h__
3
4#include "cmt_tag.h"
5#include "cmt_use.h"
6
7class SymbolValue
8{
9public:
10  typedef cmt_vector<SymbolValue> SymbolValueVector;
11
12  SymbolValue ();
13  ~SymbolValue ();
14
15  Tag* tag;
16  cmt_string text;         /* A symbol value is created only if */
17                           /* its text is non empty */
18  int selected;
19};
20
21class SymbolValueList
22{
23public:
24  typedef cmt_vector<SymbolValueList> SymbolValueListVector;
25
26  int select_first (const cmt_string& tag_name = "") const;
27  int select_last () const;
28
29  CommandType command_type;
30  Use* use;
31  SymbolValue::SymbolValueVector values;
32  bool is_reflexive;
33  bool discarded;
34};
35
36class Symbol;
37
38class ValueBuilder
39{
40public:
41  virtual const cmt_string& build (const Symbol& symbol,
42                                   const cmt_string& tag_name = "") = 0;
43  virtual const cmt_string& clean (const Symbol& symbol,
44                                   const cmt_string& tag_name = "") = 0;
45};
46
47class Symbol
48{
49public:
50  typedef cmt_vector<Symbol> SymbolVector;
51
52  static Symbol* create (const cmt_string& name,
53                         CommandType command,
54                         ScopeType scope);
55  static Symbol* find (const cmt_string& name);
56  static void action (const CmtSystem::cmt_string_vector& words,
57                      CommandType command_type,
58                      Use* use);
59  static int is_selected (const cmt_string& name);
60  static void all_print (PrintMode mode);
61  static void all_print_clean (PrintMode mode);
62  static int symbol_number ();
63  static SymbolVector& symbols ();
64  static Symbol& symbol (int index);
65  static void clear_all ();
66  static void expand (cmt_string& text);
67
68public:
69  Symbol ();
70  ~Symbol ();
71  bool value_is_reflexive (const cmt_string& text) const;
72  void add_value_to_list (CommandType command_type,
73                          Use* use,
74                          Tag* tag,
75                          const cmt_string& text);
76
77  int valid (PrintMode mode);
78  int print_clean (int tabs, PrintMode mode);
79  int print (int tabs, PrintMode mode);
80  cmt_string build_macro_value () const;
81  cmt_string clean_macro_value () const;
82  cmt_string resolve_macro_value (const cmt_string& tag_name = "");
83  void show_macro (PrintMode mode);
84
85  ValueBuilder* builder;
86
87  cmt_string name;          /* The original symbol's name */
88  ScopeType scope;          /* copy of the current scope  */
89  CommandType command;      /* symbol's type              */
90
91  SymbolValueList::SymbolValueListVector value_lists;
92
93  int selected_value;        /* according to the last selected tag */
94};
95
96#endif
Note: See TracBrowser for help on using the repository browser.