1994-08-19 07:10:19 +00:00
|
|
|
#ifndef __UTILITY_H
|
|
|
|
#define __UTILITY_H
|
|
|
|
|
2004-11-30 22:02:59 +00:00
|
|
|
#ifndef __STRINGS_H
|
|
|
|
#include <strings.h>
|
1994-08-19 07:10:19 +00:00
|
|
|
#endif
|
|
|
|
|
2012-02-06 12:27:19 +00:00
|
|
|
#ifndef __ARRAY_H
|
|
|
|
#include <array.h>
|
|
|
|
#endif
|
|
|
|
|
2010-08-24 17:53:24 +00:00
|
|
|
#define STRINGIFY(x) #x
|
|
|
|
#define TOSTRING(x) STRINGIFY(x)
|
|
|
|
|
2004-06-29 11:19:05 +00:00
|
|
|
class TPerformance_profiler : public TObject
|
|
|
|
{
|
|
|
|
TString _desc;
|
|
|
|
long _start;
|
|
|
|
bool _trc;
|
|
|
|
|
|
|
|
public:
|
|
|
|
void show() const;
|
|
|
|
|
|
|
|
TPerformance_profiler(const char* desc = "", bool trc = false);
|
|
|
|
~TPerformance_profiler();
|
|
|
|
};
|
1998-02-24 10:37:28 +00:00
|
|
|
|
1994-08-19 07:10:19 +00:00
|
|
|
char* format (const char* fmt, ...);
|
|
|
|
const char* cmd2name(const char* argv0, const char* argv1 = "");
|
|
|
|
int rtoi(const char * roman);
|
|
|
|
const char* itor(int i);
|
2010-10-11 14:39:38 +00:00
|
|
|
bool fcopy(const char* orig, const char* dest, bool append = false, bool advanced = false);
|
1994-08-19 07:10:19 +00:00
|
|
|
bool fexist(const char* file);
|
1997-10-30 16:14:49 +00:00
|
|
|
long fsize(const char* file);
|
2013-05-06 08:50:32 +00:00
|
|
|
bool dexist(const char* file);
|
2012-03-01 14:03:42 +00:00
|
|
|
void log_message(const char* fmt, ...);
|
1995-03-22 09:07:04 +00:00
|
|
|
|
2004-03-12 15:35:52 +00:00
|
|
|
bool make_dir(const char* dir);
|
|
|
|
bool remove_file(const char* file);
|
2014-09-22 13:54:13 +00:00
|
|
|
int remove_files(const char* mask, bool subdirs);
|
|
|
|
int count_files(const char* dir, bool subdirs);
|
1997-10-09 13:31:51 +00:00
|
|
|
int list_files(const char* mask, TString_array& result);
|
1998-03-13 10:44:43 +00:00
|
|
|
bool input_filename(TFilename& file);
|
1998-01-28 09:24:17 +00:00
|
|
|
|
|
|
|
const char* encode(const char* data);
|
|
|
|
const char* decode(const char* data);
|
1996-02-05 19:00:53 +00:00
|
|
|
|
2003-10-07 12:53:38 +00:00
|
|
|
inline bool is_slash(char s) // @parm Carattere da confrontare
|
|
|
|
{ return s == '\\' || s == '/'; }
|
|
|
|
|
|
|
|
inline bool is_not_slash(char s) // @parm Carattere da confrontare
|
|
|
|
{ return s != '\\' && s != '/'; }
|
1994-08-19 07:10:19 +00:00
|
|
|
|
2002-09-13 14:56:23 +00:00
|
|
|
const char* esc(const char* str); // Trasforma le sequenze "\n" nel carattere '\n'
|
|
|
|
const char* unesc(const char* str); // Trasforma i caratteri '\n' nella sequenza "\n"
|
1994-08-19 07:10:19 +00:00
|
|
|
|
2004-06-07 12:50:06 +00:00
|
|
|
istream& eatwhite (istream& i);
|
|
|
|
|
2008-06-19 15:36:49 +00:00
|
|
|
const TString& get_hostname();
|
2006-12-13 16:22:33 +00:00
|
|
|
bool is_power_station();
|
2009-10-20 15:22:22 +00:00
|
|
|
bool is_power_reseller(bool power_user_only = false);
|
2006-12-13 16:22:33 +00:00
|
|
|
long daytime();
|
2008-06-19 15:36:49 +00:00
|
|
|
bool expand_sys_vars(TString& str);
|
2006-12-13 16:22:33 +00:00
|
|
|
|
2010-02-09 10:11:25 +00:00
|
|
|
#endif /* __UTILITY_H */
|