source: CMT/v1r12p20020606/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 void reduce_file_separators (cmt_string& text);
57  static char path_separator ();
58  static char command_separator ();
59  static const cmt_string& ev_open ();
60  static const cmt_string& ev_close ();
61  static bool create_symlink (const cmt_string& oldname,
62                              const cmt_string& newname);
63  static bool remove_file (const cmt_string& name);
64  static bool remove_directory (const cmt_string& name);
65  static bool mkdir (const cmt_string& name);
66  static void scan_dir (const cmt_string& dir_name,
67                        cmt_string_vector& list);
68  static void scan_dir (const cmt_string& dir_name,
69                        const cmt_regexp& expression,
70                        cmt_string_vector& list);
71  static cmt_string_vector& scan_dir (const cmt_string& dir_name);
72  static const cmt_string& get_cmt_root ();
73  static void get_cmt_version (cmt_string& version);
74  static cmt_string get_cmt_config ();
75  static cmt_string get_cmt_site ();
76  static void get_uname (cmt_string& uname);
77  static void get_hosttype (cmt_string& hosttype);
78  static cmt_string get_temporary_name ();
79 
80  static cmt_string get_home_package ();
81  static bool is_home_package (const cmt_string& name,
82                               const cmt_string& version);
83 
84  static cmt_string get_user_context_package ();
85  static bool is_user_context_package (const cmt_string& name,
86                                       const cmt_string& version);
87 
88  static bool testenv (const cmt_string& name);
89  static cmt_string getenv (const cmt_string& name);
90  static void add_cmt_path (const cmt_string& path,
91                            const cmt_string& path_source,
92                            cmt_string_vector& paths,
93                            cmt_string_vector& path_pwds,
94                            cmt_string_vector& path_sources);
95  static void get_cmt_paths (cmt_string_vector& paths,
96                             cmt_string_vector& path_pwds,
97                             cmt_string_vector& path_sources,
98                             const cmt_string& init_text = "");
99  static int execute (const cmt_string& command);
100  static int execute (const cmt_string& command, cmt_string& output);
101  static bool is_package_directory (const cmt_string& name);
102  static bool is_version_directory (const cmt_string& name);
103  static bool is_version_directory (const cmt_string& name, int& v, int& r, int& p);
104  static void split (const cmt_string& text,
105                     const cmt_string& separators,
106                     cmt_string_vector& strings);
107
108  static void compress_path (const cmt_string& dir, cmt_string& new_dir);
109  static void compress_path (cmt_string& dir);
110
111  static cmt_string now ();
112  static cmt_string user ();
113
114  static void get_cvsroot (cmt_string& cvsroot);
115
116};
117
118#endif
Note: See TracBrowser for help on using the repository browser.