Main?Page | Class?Hierarchy | Class?List | File?List | Class?Members | File?Members

cmt_symbol.h

Go to the documentation of this file.
00001 //-----------------------------------------------------------
00002 // Copyright Christian Arnault LAL-Orsay CNRS
00003 // 
00004 // See the complete license in cmt_license.txt "http://www.cecill.info". 
00005 //-----------------------------------------------------------
00006 
00007 #ifndef __cmt_symbol_h__
00008 #define __cmt_symbol_h__
00009 
00010 #include "cmt_tag.h"
00011 #include "cmt_use.h"
00012 #include "cmt_map.h"
00013 
00014 class SymbolValue
00015 {
00016 public:
00017   typedef cmt_vector SymbolValueVector;
00018 
00019   SymbolValue ();
00020   ~SymbolValue ();
00021 
00022   Tag* tag;
00023   cmt_string text;         /* A symbol value is created only if */
00024                            /* its text is non empty */
00025   int selected;
00026 };
00027 
00028 class SymbolValueList
00029 {
00030 public:
00031   typedef cmt_vector SymbolValueListVector;
00032 
00033   int select_first (const cmt_string& tag_name = "") const;
00034   int select_last () const;
00035   void show (const Symbol& symbol, const SymbolValue& value, bool& first_definition) const;
00036 
00037   CommandType command_type;
00038   Use* use;
00039   SymbolValue::SymbolValueVector values;
00040   bool is_reflexive;
00041   bool discarded;
00042 };
00043 
00044 class Symbol;
00045 
00046 class ValueBuilder
00047 {
00048 public:
00049   ValueBuilder ();
00050   const cmt_string build_and_display (const Symbol& symbol);
00051 
00052   virtual const cmt_string build (const Symbol& symbol,
00053                                   const cmt_string& tag_name = "") = 0;
00054   virtual const cmt_string clean (const Symbol& symbol,
00055                                   const cmt_string& tag_name = "") = 0;
00056  protected:
00057   bool m_display_it;
00058 };
00059 
00060 class Symbol
00061 {
00062 public:
00063   typedef cmt_vector SymbolVector;
00064   typedef cmt_map SymbolMap;
00065 
00066   typedef enum
00067     {
00068       SymbolUndefined,
00069       SymbolAction,
00070       SymbolAlias,
00071       SymbolMacro,
00072       SymbolSetupScript,
00073       SymbolCleanupScript,
00074       SymbolSet,
00075       SymbolPath
00076     } SymbolType;
00077 
00078   static Symbol* create (const cmt_string& name,
00079                          CommandType command,
00080                          Use* use = 0);
00081   
00082   static Symbol* find (const cmt_string& name);
00083   static void action (const CmtSystem::cmt_string_vector& words,
00084                       CommandType command_type,
00085                       Use* use);
00086   static int is_selected (const cmt_string& name);
00087 
00088   static void all_set ();
00089   static void all_print (PrintMode mode);
00090   static void all_print_clean (PrintMode mode);
00091 
00092   static int symbol_number ();
00093   static SymbolVector& symbols ();
00094   static SymbolMap& symbol_map ();
00095   static Symbol& symbol (int index);
00096   static void clear_all ();
00097   static void expand (cmt_string& text);
00098 
00099   static bool check_tag_used (Tag* tag);
00100 
00101 public:
00102   Symbol ();
00103   ~Symbol ();
00104   bool value_is_reflexive (const cmt_string& text) const;
00105   void add_value_to_list (CommandType command_type,
00106                           Use* use,
00107                           Tag* tag,
00108                           const cmt_string& text);
00109 
00110   int print_clean (PrintMode mode);
00111   int print (PrintMode mode);
00112   cmt_string build_macro_value (bool display_it = false) const;
00113   cmt_string clean_macro_value () const;
00114   cmt_string resolve_macro_value (const cmt_string& tag_name = "");
00115   void show_macro (PrintMode mode);
00116 
00117   ValueBuilder* builder;
00118 
00119   cmt_string name;
00120   ScopeType scope;
00121   SymbolType type;
00122 
00123   SymbolValueList::SymbolValueListVector value_lists;
00124 
00125   int selected_value;        /* according to the last selected tag */
00126 };
00127 
00128 #endif

Generated on Mon May 2 10:25:05 2005 for CMT by 1.3.5