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

cmt_system.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_system_h__
00008 #define __cmt_system_h__
00009 
00010 #include "cmt_std.h"
00011 #include "cmt_string.h"
00012 #include "cmt_vector.h"
00013 #include "cmt_regexp.h"
00014 
00015 class Project;
00016 
00017 class IProjectFactory
00018 {
00019 public:
00020   virtual void reset () = 0;
00021   virtual Project* create_project (const cmt_string& name,
00022                                    const cmt_string& path,
00023                                    const cmt_string& path_source,
00024                                    Project* parent) = 0;
00025 };
00026 
00027 class CmtSystem
00028 {
00029 public:
00030   typedef cmt_vector cmt_string_vector;
00031 
00032   static cmt_string pwd ();
00033   static bool cd (const cmt_string& dir);
00034 
00035   static void basename (const cmt_string& file_name, cmt_string& result);
00036   static void basename (const cmt_string& file_name,
00037                         const cmt_string& suffix,
00038                         cmt_string& result);
00039 
00040   static void dirname (const cmt_string& file_name, cmt_string& result);
00041 
00042   static void name (const cmt_string& file, cmt_string& result);
00043 
00044   static void get_suffix (const cmt_string& file, cmt_string& result);
00045   static void get_dot_suffix (const cmt_string& file, cmt_string& result);
00046   static bool has_prefix (const cmt_string& name);
00047   static bool absolute_path (const cmt_string& name);
00048   static bool has_device (const cmt_string& name);
00049 
00050   static cmt_string current_branch ();
00051 
00055   static bool test_directory (const cmt_string& name);
00059   static bool test_file (const cmt_string& name);
00063   static bool compare_files (const cmt_string& name1,
00064                              const cmt_string& name2);
00070   static bool compare_and_update_files (const cmt_string& name1,
00071                                         const cmt_string& name2);
00072   static int file_size (const cmt_string& name);
00073   static char file_separator ();
00074   static void reduce_file_separators (cmt_string& text);
00075   static char path_separator ();
00076   static char command_separator ();
00077   static const cmt_string& ev_open ();
00078   static const cmt_string& ev_close ();
00079   static bool create_symlink (const cmt_string& oldname,
00080                               const cmt_string& newname);
00081   static bool remove_file (const cmt_string& name);
00082   static bool remove_directory (const cmt_string& name);
00083   static bool mkdir (const cmt_string& name);
00084   static void scan_dir (const cmt_string& dir_name,
00085                         cmt_string_vector& list);
00086   static void scan_dir (const cmt_string& dir_name,
00087                         const cmt_regexp& expression,
00088                         cmt_string_vector& list);
00089   static cmt_string_vector& scan_dir (const cmt_string& dir_name);
00090   static const cmt_string& get_cmt_root ();
00091   static void get_cmt_version (cmt_string& version);
00092   static cmt_string get_cmt_config ();
00093   static cmt_string get_cmt_site ();
00094   static void get_uname (cmt_string& uname);
00095   static void get_hosttype (cmt_string& hosttype);
00096   static cmt_string get_temporary_name ();
00097   
00098   static cmt_string get_home_package ();
00099   static bool is_home_package (const cmt_string& name,
00100                                const cmt_string& version);
00101   
00102   static cmt_string get_user_context_package ();
00103   static bool is_user_context_package (const cmt_string& name,
00104                                        const cmt_string& version);
00105   
00106   static cmt_string get_project_package ();
00107   static bool is_project_package (const cmt_string& name,
00108                                   const cmt_string& version);
00109   
00110   static bool testenv (const cmt_string& name);
00111   static cmt_string getenv (const cmt_string& name);
00112   static bool putenv (const cmt_string& name_value);
00113   static void get_cmt_paths (IProjectFactory& factory,
00114                              const cmt_string& init_text,
00115                              const cmt_string& cmt_user_context,
00116                              const cmt_string& cmt_home);
00117   static int execute (const cmt_string& command);
00118   static int execute (const cmt_string& command, cmt_string& output);
00119   static bool is_package_directory (const cmt_string& name);
00120   static bool is_version_directory (const cmt_string& name);
00121   static bool is_version_directory (const cmt_string& name, int& v, int& r, int& p);
00122   static void split (const cmt_string& text,
00123                      const cmt_string& separators,
00124                      cmt_string_vector& strings);
00125 
00126   static void compress_path (const cmt_string& dir, cmt_string& new_dir);
00127   static void compress_path (cmt_string& dir);
00128 
00129   static cmt_string now ();
00130   static cmt_string user ();
00131 
00132   static void get_cvsroot (cmt_string& cvsroot);
00133 
00134   static bool get_home_directory (cmt_string& dir);
00135 
00136 };
00137 
00138 #endif

Generated on Mon Sep 5 16:30:48 2005 for CMT by 1.3.5