Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

cmt_symbol.h

Go to the documentation of this file.
00001 #ifndef __cmt_symbol_h__
00002 #define __cmt_symbol_h__
00003 
00004 #include "cmt_tag.h"
00005 #include "cmt_use.h"
00006 
00007 class SymbolValue
00008 {
00009 public:
00010   typedef cmt_vector<SymbolValue> SymbolValueVector;
00011 
00012   SymbolValue ();
00013   ~SymbolValue ();
00014 
00015   Tag* tag;
00016   cmt_string text;         /* A symbol value is created only if */
00017                            /* its text is non empty */
00018   int selected;
00019 };
00020 
00021 class SymbolValueList
00022 {
00023 public:
00024   typedef cmt_vector<SymbolValueList> SymbolValueListVector;
00025 
00026   int select_first (const cmt_string& tag_name = "") const;
00027   int select_last () const;
00028 
00029   CommandType command_type;
00030   Use* use;
00031   SymbolValue::SymbolValueVector values;
00032   bool is_reflexive;
00033   bool discarded;
00034 };
00035 
00036 class Symbol;
00037 
00038 class ValueBuilder
00039 {
00040 public:
00041   virtual const cmt_string& build (const Symbol& symbol,
00042                                    const cmt_string& tag_name = "") = 0;
00043   virtual const cmt_string& clean (const Symbol& symbol,
00044                                    const cmt_string& tag_name = "") = 0;
00045 };
00046 
00047 class Symbol
00048 {
00049 public:
00050   typedef cmt_vector<Symbol> SymbolVector;
00051 
00052   static Symbol* create (const cmt_string& name,
00053                          CommandType command,
00054                          ScopeType scope);
00055   static Symbol* find (const cmt_string& name);
00056   static void action (const CmtSystem::cmt_string_vector& words,
00057                       CommandType command_type,
00058                       Use* use);
00059   static int is_selected (const cmt_string& name);
00060   static void all_print (PrintMode mode);
00061   static void all_print_clean (PrintMode mode);
00062   static int symbol_number ();
00063   static SymbolVector& symbols ();
00064   static Symbol& symbol (int index);
00065   static void clear_all ();
00066   static void expand (cmt_string& text);
00067 
00068 public:
00069   Symbol ();
00070   ~Symbol ();
00071   bool value_is_reflexive (const cmt_string& text) const;
00072   void add_value_to_list (CommandType command_type,
00073                           Use* use,
00074                           Tag* tag,
00075                           const cmt_string& text);
00076 
00077   int valid (PrintMode mode);
00078   int print_clean (int tabs, PrintMode mode);
00079   int print (int tabs, PrintMode mode);
00080   cmt_string build_macro_value () const;
00081   cmt_string clean_macro_value () const;
00082   cmt_string resolve_macro_value (const cmt_string& tag_name = "");
00083   void show_macro (PrintMode mode);
00084 
00085   ValueBuilder* builder;
00086 
00087   cmt_string name;          /* The original symbol's name */
00088   ScopeType scope;          /* copy of the current scope  */
00089   CommandType command;      /* symbol's type              */
00090 
00091   SymbolValueList::SymbolValueListVector value_lists;
00092 
00093   int selected_value;        /* according to the last selected tag */
00094 };
00095 
00096 #endif

Generated at Thu May 16 16:27:08 2002 for CMT by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000