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

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

Import all tags

File size: 5.2 KB
Line 
1#ifndef __cmt_use_h__
2#define __cmt_use_h__
3
4#include "cmt_include.h"
5#include "cmt_script.h"
6#include "cmt_pattern.h"
7
8class Use
9{
10public:
11  typedef cmt_vector<Use> UseVector;
12  typedef cmt_vector<Use*> UsePtrVector;
13
14  static Use* action (const CmtSystem::cmt_string_vector& words, Use* use);
15  static Use* find (const cmt_string& package,
16                    const cmt_string& version = "",
17                    const cmt_string& path = "");
18  static int find_index (const cmt_string& package, 
19                         const cmt_string& version, 
20                         const cmt_string& path);
21  static void set_auto_imports_state (int use_index,
22                                      cmt_vector<bool>& auto_imports_states);
23  static Use* add (const cmt_string& path,
24                   const cmt_string& package,
25                   const cmt_string& version,
26                   const cmt_string& version_alias,
27                   const cmt_string& path_alias,
28                   Use* context_use,
29                   State specified_auto_imports = Unspecified);
30  static void move (Use* use1);
31  static void reorder (Use* use1, Use* use2);
32  static void select_clients (const cmt_string& package,
33                              const cmt_string& version);
34  static void show_all (bool skip_discarded = false);
35  static void show_all (const cmt_string& prefix, bool skip_discarded = false);
36  static Use& current ();
37  static const Use& const_current ();
38  static UseVector& all_uses ();
39  static UsePtrVector& uses ();
40  static void clear_all ();
41  static void unselect_all ();
42  static void undiscard_all ();
43  static void fill_macro_all (cmt_string& buffer, const cmt_string& suffix);
44
45private:
46  static Use* create (const cmt_string& path,
47                      const cmt_string& package,
48                      const cmt_string& version,
49                      const cmt_string& version_alias,
50                      const cmt_string& path_alias);
51
52public:
53  Use ();
54  Use (const cmt_string& new_package,
55       const cmt_string& new_version,
56       const cmt_string& new_path);
57  ~Use ();
58  void set (const cmt_string& new_package,
59            const cmt_string& new_version,
60            const cmt_string& new_path,
61            const cmt_string& new_version_alias = "",
62            const cmt_string& new_path_alias = "");
63  void author_action (const CmtSystem::cmt_string_vector& words);
64  void manager_action (const CmtSystem::cmt_string_vector& words);
65  bool move_to ();
66  void discard ();
67  void undiscard ();
68  void apply_global_patterns ();
69  void set_include_path (const cmt_string& new_path);
70  void get_full_path (cmt_string& s) const;
71  cmt_string get_full_path () const;
72  void reduce_path (cmt_string& s) const;
73
74  void fill_includes_macro (cmt_string& buffer) const;
75  void fill_macro (cmt_string& buffer, const cmt_string& suffix) const;
76
77  bool get_paths (Use* to, UsePtrVector& list);
78
79  bool located () const;
80
81  void change_path (const cmt_string& path);
82  void set_auto_imports (State new_state);
83  void set_native_version (bool state);
84  bool has_native_version () const;
85
86  cmt_string package;            /* directly read from requirements */
87  cmt_string specified_version;  /* idem                            */
88  cmt_string specified_path;     /* idem                            */
89  cmt_string version_alias;
90  cmt_string path_alias;
91  cmt_string author;             /* idem                            */
92  cmt_string manager;            /* idem                            */
93
94  cmt_string path;               /* expanded path                   */
95  cmt_string version;            /* idem                            */
96  cmt_string real_path;
97  CmtDirStyle style;             /* May be cmt or mgr               */
98
99  cmt_string prefix;             /* upper case copy of package      */
100  ScopeType scope;               /* copy of the current scope       */
101  bool done;                     /* true when requirements file has
102                                    already been read               */
103  bool discarded;                /* discarded by version strategy   */
104  bool selected;                 /* used for recursive access       */
105
106  State auto_imports;
107
108  Include::IncludeVector includes;
109  cmt_string include_path;
110  Script::ScriptVector scripts;
111  ApplyPattern::ApplyPatternVector apply_patterns;
112  IgnorePattern::IgnorePatternVector ignore_patterns;
113
114private:
115  void clear ();
116  int reach_package (const cmt_string& current_path);
117  void select ();
118  void unselect ();
119  bool is_selected ();
120  bool is_client (const cmt_string& package,
121                  const cmt_string& version);
122  void show_sub_uses (bool skip_discarded = false);
123  bool select_alternate ();
124  Use* get_selected_version ();
125
126  static bool need_new (const cmt_string& path,
127                        const cmt_string& package,
128                        const cmt_string& version,
129                        Use** old_use);
130
131  bool m_located;
132  bool m_has_native_version;
133
134  UsePtrVector sub_uses;
135  cmt_vector<ScopeType> sub_use_scopes;
136  cmt_vector<State> sub_use_auto_imports;
137
138  CmtSystem::cmt_string_vector alternate_versions;
139  CmtSystem::cmt_string_vector alternate_paths;
140};
141
142#endif
Note: See TracBrowser for help on using the repository browser.