Disk ARchive  2.4.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
.pc/delete2/tools.hpp
00001 /*********************************************************************/
00002 // dar - disk archive - a backup/restoration program
00003 // Copyright (C) 2002-2052 Denis Corbin
00004 //
00005 // This program is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU General Public License
00007 // as published by the Free Software Foundation; either version 2
00008 // of the License, or (at your option) any later version.
00009 // 
00010 // This program is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 // 
00015 // You should have received a copy of the GNU General Public License
00016 // along with this program; if not, write to the Free Software
00017 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00018 //
00019 // to contact the author : dar.linux@free.fr
00020 /*********************************************************************/
00021 // $Id$
00022 //
00023 /*********************************************************************/
00024 
00025 #ifndef TOOLS_HPP
00026 #define TOOLS_HPP
00027 
00028 #include <string>
00029 #include <vector>
00030 #include "path.hpp"
00031 #include "generic_file.hpp"
00032 #include "tuyau.hpp"
00033 #include "integers.hpp"
00034 
00035 using namespace std;
00036 
00037 extern char *tools_str2charptr(string x);
00038 extern void tools_write_string(generic_file & f, const string & s); 
00039     // add a '\0' at the end
00040 extern void tools_read_string(generic_file & f, string & s); 
00041     // read up to '\0' char
00042 extern void tools_write_string_all(generic_file & f, const string & s); 
00043     // '\0' has no special meaning no '\0' at the end
00044 extern void tools_read_string_size(generic_file & f, string & s, infinint taille); 
00045     // '\0' has no special meaning
00046 extern infinint tools_get_filesize(const path &p);
00047 extern infinint tools_get_extended_size(string s);
00048 extern char *tools_extract_basename(const char *command_name); 
00049 extern void tools_split_path_basename(const char *all, path * &chemin, string & base);
00050 extern void tools_split_path_basename(const string &all, string & chemin, string & base);
00051 extern void tools_open_pipes(const string &input, const string & output, tuyau *&in, tuyau *&out);
00052 extern void tools_blocking_read(int fd, bool mode);
00053 extern string tools_name_of_uid(U_16 uid);
00054 extern string tools_name_of_gid(U_16 gid);
00055 extern string tools_int2str(int x);
00056 extern U_32 tools_str2int(const string & x);
00057 extern string tools_addspacebefore(string s, unsigned int expected_size);
00058 extern string tools_display_date(infinint date);
00059 extern void tools_system(const vector<string> & argvector);
00060 extern void tools_write_vector(generic_file & f, const vector<string> & x);
00061 extern void tools_read_vector(generic_file & f, vector<string> & x);
00062 extern string tools_concat_vector(const string & separator, 
00063                                   const vector<string> & x);
00064 vector<string> operator + (vector<string> a, vector<string> b);
00065 extern bool tools_is_member(const string & val, const vector<string> & liste);
00066 
00067 
00068 template <class T> vector<T> operator +=(vector<T> & a, const vector<T> & b)
00069 {
00070     a = a + b;
00071     return a;
00072 }
00073 extern const char *tools_get_from_env(const char **env, char *clef);
00074 
00075 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines