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

cmt_use.h

Go to the documentation of this file.
00001 #ifndef __cmt_use_h__
00002 #define __cmt_use_h__
00003 
00004 #include "cmt_include.h"
00005 #include "cmt_script.h"
00006 #include "cmt_pattern.h"
00007 
00008 class Use
00009 {
00010 public:
00011   typedef cmt_vector<Use> UseVector;
00012   typedef cmt_vector<Use*> UsePtrVector;
00013 
00014   static Use* action (const CmtSystem::cmt_string_vector& words, Use* use);
00015   static Use* find (const cmt_string& package,
00016                     const cmt_string& version = "",
00017                     const cmt_string& path = "");
00018   static int find_index (const cmt_string& package, 
00019                          const cmt_string& version, 
00020                          const cmt_string& path);
00021   static void set_auto_imports_state (int use_index,
00022                                       cmt_vector<bool>& auto_imports_states);
00023   static Use* add (const cmt_string& path,
00024                    const cmt_string& package,
00025                    const cmt_string& version,
00026                    const cmt_string& version_alias,
00027                    const cmt_string& path_alias,
00028                    Use* context_use,
00029                    State specified_auto_imports = Unspecified);
00030   static void move (Use* use1);
00031   static void reorder (Use* use1, Use* use2);
00032   static void select_clients (const cmt_string& package,
00033                               const cmt_string& version);
00034   static void show_all (bool skip_discarded = false);
00035   static void show_all (const cmt_string& prefix, bool skip_discarded = false);
00036   static Use& current ();
00037   static const Use& const_current ();
00038   static UseVector& all_uses ();
00039   static UsePtrVector& uses ();
00040   static void clear_all ();
00041   static void unselect_all ();
00042   static void undiscard_all ();
00043   static void fill_macro_all (cmt_string& buffer, const cmt_string& suffix);
00044 
00045 private:
00046   static Use* create (const cmt_string& path,
00047                       const cmt_string& package,
00048                       const cmt_string& version,
00049                       const cmt_string& version_alias,
00050                       const cmt_string& path_alias);
00051 
00052 public:
00053   Use ();
00054   Use (const cmt_string& new_package,
00055        const cmt_string& new_version,
00056        const cmt_string& new_path);
00057   ~Use ();
00058   void set (const cmt_string& new_package,
00059             const cmt_string& new_version,
00060             const cmt_string& new_path,
00061             const cmt_string& new_version_alias = "",
00062             const cmt_string& new_path_alias = "");
00063   void author_action (const CmtSystem::cmt_string_vector& words);
00064   void manager_action (const CmtSystem::cmt_string_vector& words);
00065   bool move_to ();
00066   void discard ();
00067   void undiscard ();
00068   void apply_global_patterns ();
00069   void set_include_path (const cmt_string& new_path);
00070   void get_full_path (cmt_string& s) const;
00071   cmt_string get_full_path () const;
00072   void reduce_path (cmt_string& s) const;
00073 
00074   void fill_includes_macro (cmt_string& buffer) const;
00075   void fill_macro (cmt_string& buffer, const cmt_string& suffix) const;
00076 
00077   bool get_paths (Use* to, UsePtrVector& list);
00078 
00079   bool located () const;
00080 
00081   void change_path (const cmt_string& path);
00082   void set_auto_imports (State new_state);
00083   void set_native_version (bool state);
00084   bool has_native_version () const;
00085 
00086   cmt_string package;            /* directly read from requirements */
00087   cmt_string specified_version;  /* idem                            */
00088   cmt_string specified_path;     /* idem                            */
00089   cmt_string version_alias;
00090   cmt_string path_alias;
00091   cmt_string author;             /* idem                            */
00092   cmt_string manager;            /* idem                            */
00093 
00094   cmt_string path;               /* expanded path                   */
00095   cmt_string version;            /* idem                            */
00096   cmt_string real_path;
00097   CmtDirStyle style;             /* May be cmt or mgr               */
00098 
00099   cmt_string prefix;             /* upper case copy of package      */
00100   ScopeType scope;               /* copy of the current scope       */
00101   bool done;                     /* true when requirements file has
00102                                     already been read               */
00103   bool discarded;                /* discarded by version strategy   */
00104   bool selected;                 /* used for recursive access       */
00105 
00106   State auto_imports;
00107 
00108   Include::IncludeVector includes;
00109   cmt_string include_path;
00110   Script::ScriptVector scripts;
00111   ApplyPattern::ApplyPatternVector apply_patterns;
00112   IgnorePattern::IgnorePatternVector ignore_patterns;
00113 
00114 private:
00115   void clear ();
00116   int reach_package (const cmt_string& current_path);
00117   void select ();
00118   void unselect ();
00119   bool is_selected ();
00120   bool is_client (const cmt_string& package,
00121                   const cmt_string& version);
00122   void show_sub_uses (bool skip_discarded = false);
00123   bool select_alternate ();
00124   Use* get_selected_version ();
00125 
00126   static bool need_new (const cmt_string& path,
00127                         const cmt_string& package,
00128                         const cmt_string& version,
00129                         Use** old_use);
00130 
00131   bool m_located;
00132   bool m_has_native_version;
00133 
00134   UsePtrVector sub_uses;
00135   cmt_vector<ScopeType> sub_use_scopes;
00136   cmt_vector<State> sub_use_auto_imports;
00137 
00138   CmtSystem::cmt_string_vector alternate_versions;
00139   CmtSystem::cmt_string_vector alternate_paths;
00140 };
00141 
00142 #endif

Generated at Mon Jun 10 17:57:50 2002 for CMT by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000