source: CMT/v1r10p20011126/src/cmt_system.h @ 1

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

Import all tags

File size: 4.6 KB
Line 
1#ifndef __cmt_system_h__
2#define __cmt_system_h__
3
4#include "cmt_std.h"
5#include "cmt_string.h"
6#include "cmt_vector.h"
7#include "cmt_regexp.h"
8
9class CmtSystem
10{
11public:
12  typedef cmt_vector<cmt_string> cmt_string_vector;
13
14  static cmt_string pwd ();
15  static bool cd (const cmt_string& dir);
16
17  static void basename (const cmt_string& file_name, cmt_string& result);
18  static void basename (const cmt_string& file_name,
19                        const cmt_string& suffix,
20                        cmt_string& result);
21
22  static void dirname (const cmt_string& file_name, cmt_string& result);
23
24  static void name (const cmt_string& file, cmt_string& result);
25
26  static void get_suffix (const cmt_string& file, cmt_string& result);
27  static void get_dot_suffix (const cmt_string& file, cmt_string& result);
28  static bool has_prefix (const cmt_string& name);
29  static bool absolute_path (const cmt_string& name);
30  static bool has_device (const cmt_string& name);
31
32  static cmt_string current_branch ();
33
34    /**
35     * Implementation of the "test -d" equivalent
36     */
37  static bool test_directory (const cmt_string& name);
38    /**
39     * Implementation of the "test -f" equivalent
40     */
41  static bool test_file (const cmt_string& name);
42    /**
43     * Check if the file "name1" is identical to "name2"
44     */
45  static bool compare_files (const cmt_string& name1,
46                             const cmt_string& name2);
47    /**
48     * Check if the file "name1" is identical to "name2"
49     * if they are identical, "name1" will be simply deleted
50     * otherwise "name1" will be copied to "name2" and deleted afterwards
51     */
52  static bool compare_and_update_files (const cmt_string& name1,
53                                        const cmt_string& name2);
54  static int file_size (const cmt_string& name);
55  static char file_separator ();
56  static char path_separator ();
57  static const cmt_string& ev_open ();
58  static const cmt_string& ev_close ();
59  static bool create_symlink (const cmt_string& oldname,
60                              const cmt_string& newname);
61  static bool remove_file (const cmt_string& name);
62  static bool remove_directory (const cmt_string& name);
63  static bool mkdir (const cmt_string& name);
64  static void scan_dir (const cmt_string& dir_name,
65                        cmt_string_vector& list);
66  static void scan_dir (const cmt_string& dir_name,
67                        const cmt_regexp& expression,
68                        cmt_string_vector& list);
69  static cmt_string_vector& scan_dir (const cmt_string& dir_name);
70  static const cmt_string& get_cmt_root ();
71  static void get_cmt_version (cmt_string& version);
72  static cmt_string get_cmt_config ();
73  static cmt_string get_cmt_site ();
74  static void get_uname (cmt_string& uname);
75  static void get_hosttype (cmt_string& hosttype);
76  static cmt_string get_temporary_name ();
77 
78  static cmt_string get_home_package ();
79  static bool is_home_package (const cmt_string& name,
80                               const cmt_string& version);
81 
82  static cmt_string get_user_context_package ();
83  static bool is_user_context_package (const cmt_string& name,
84                                       const cmt_string& version);
85 
86  static bool testenv (const cmt_string& name);
87  static cmt_string getenv (const cmt_string& name);
88  static void add_cmt_path (const cmt_string& path,
89                            const cmt_string& path_source,
90                            cmt_string_vector& paths,
91                            cmt_string_vector& path_pwds,
92                            cmt_string_vector& path_sources);
93  static void get_cmt_paths (cmt_string_vector& paths,
94                             cmt_string_vector& path_pwds,
95                             cmt_string_vector& path_sources,
96                             const cmt_string& init_text = "");
97  static int execute (const cmt_string& command);
98  static int execute (const cmt_string& command, cmt_string& output);
99  static bool is_package_directory (const cmt_string& name);
100  static bool is_version_directory (const cmt_string& name);
101  static bool is_version_directory (const cmt_string& name, int& v, int& r, int& p);
102  static void split (const cmt_string& text,
103                     const cmt_string& separators,
104                     cmt_string_vector& strings);
105
106  static void compress_path (const cmt_string& dir, cmt_string& new_dir);
107  static void compress_path (cmt_string& dir);
108
109  static cmt_string now ();
110  static cmt_string user ();
111
112  static void get_cvsroot (cmt_string& cvsroot);
113
114};
115
116#endif
Note: See TracBrowser for help on using the repository browser.