00001 #ifndef __Package_h__ 00002 #define __Package_h__ 00003 00004 #include "cmt_std.h" 00005 #include "cmt_string.h" 00006 #include "cmt_vector.h" 00007 #include "cmt_system.h" 00008 #include "cmt_awk.h" 00009 00010 class tree_node; 00011 class Package; 00012 00013 class UseScanner : public FAwk 00014 { 00015 public: 00016 00017 UseScanner (const Package& t, Package& s, tree_node& node); 00018 void begin (); 00019 void filter (const cmt_string& line); 00020 void end (); 00021 00022 private: 00023 const Package& tested; // the tested package 00024 Package& scanned; // the package which is to be scanned 00025 tree_node& parent_node; 00026 bool done; 00027 }; 00028 00037 class Package 00038 { 00039 public: 00040 typedef cmt_vectordatabase; 00041 00043 static database& get_database (); 00044 00046 static Package& create (const cmt_string& p, 00047 const cmt_string& v, 00048 const cmt_string& pp, 00049 const cmt_string& a = ""); 00050 00052 Package (); 00053 bool is_unreachable () const; 00054 void set_unreachable (); 00055 bool is_done () const; 00056 void set_done (); 00058 int operator == (const Package& other) const; 00059 int operator != (const Package& other) const; 00060 const cmt_string& get_name () const; 00061 const cmt_string& get_version () const; 00062 const cmt_string& get_path () const; 00063 const cmt_string& get_dot_name () const; 00064 const cmt_string& get_cluster_name () const; 00065 const cmt_string& get_dot_label () const; 00066 cmt_string to_string () const; 00067 void collect_clients (tree_node& node); 00068 void set_node (tree_node* n); 00069 tree_node* get_node () const; 00070 00071 bool has_version_directory () const; 00072 bool auto_imports () const; 00073 bool is_public () const; 00074 00075 void set_has_version_directory (bool state); 00076 void set_auto_imports (bool state); 00077 void set_is_public (bool state); 00078 00083 void check_client (const Package& other, tree_node& node); 00084 00085 void reduce (); 00086 00087 private: 00088 00090 void set (const cmt_string& p, 00091 const cmt_string& v, 00092 const cmt_string& pp, 00093 const cmt_string& a); 00094 00095 private: 00096 cmt_string package; 00097 cmt_string version; 00098 cmt_string path; 00099 cmt_string area; 00100 00101 cmt_string dot_name; // a name for dot objects 00102 cmt_string cluster_name; // a name for dot clusters 00103 cmt_string dot_label; // a label to be displayed within dot boxes 00104 00105 bool unreachable; // package not reachable in the current CMTPATH 00106 bool done; 00107 00108 tree_node* node; 00109 00110 bool m_has_version_directory; 00111 bool m_auto_imports; 00112 bool m_is_public; 00113 }; 00114 00115 #endif 00116