Disk ARchive  2.4.12
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
line_tools.hpp
Go to the documentation of this file.
1 /*********************************************************************/
2 // dar - disk archive - a backup/restoration program
3 // Copyright (C) 2002-2052 Denis Corbin
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 //
19 // to contact the author : http://dar.linux.free.fr/email.html
20 /*********************************************************************/
21 
25 
26 #ifndef LINE_TOOLS_HPP
27 #define LINE_TOOLS_HPP
28 
29 #include "../my_config.h"
30 
31 #include <string>
32 #include "infinint.hpp"
33 #include "tlv_list.hpp"
34 #include "integers.hpp"
35 
36 using namespace libdar;
37 
40 
41 class argc_argv
42 {
43 public:
44  argc_argv(S_I size = 0);
45  argc_argv(const argc_argv & ref) { throw Efeature("argc_argv"); };
46  const argc_argv & operator = (const argc_argv & ref) { throw Efeature("argc_argv"); };
47  ~argc_argv();
48 
49  void resize(S_I size);
50  void set_arg(const std::string & arg, S_I index);
51  void set_arg(generic_file & f, U_I size, S_I index);
52 
53  S_I argc() const { return x_argc; };
54  char* const * argv() const { return x_argv; }; // well the const method is a bit silly, as the call has the possibility to modify what is pointed to by the returned value...
55 
56 private:
57  S_I x_argc;
58  char **x_argv;
59 };
60 
61 extern void line_tools_slice_ownership(const std::string & cmd, std::string & slice_permission, std::string & slice_user_ownership, std::string & slice_group_ownership);
62 extern void line_tools_repeat_param(const std::string & cmd, infinint & repeat_count, infinint & repeat_byte);
63 extern void line_tools_tlv_list2argv(user_interaction & dialog, const tlv_list & list, argc_argv & arg);
64 
66 extern S_I line_tools_reset_getopt();
67 
68 
69 std::string::const_iterator line_tools_find_first_char_out_of_parenth(const std::string & argument, unsigned char to_find);
70 std::string::const_iterator line_tools_find_last_char_out_of_parenth(const std::string & argument, unsigned char to_find);
71 
72 std::string line_tools_expand_user_comment(const std::string & user_comment, S_I argc, char *const argv[]);
73 
75 std::vector<std::string> line_tools_explode_PATH(const char *the_path);
76 
78 std::string line_tools_get_full_path_from_PATH(const std::vector<std::string> & the_path, const char * filename);
79 
81 void line_tools_split_at_first_space(const char *field, std::string & before_space, std::string & after_space);
82 
83 void line_tools_get_min_digits(std::string arg, infinint & num, infinint & ref_num, infinint & aux_num);
84 
91 #if HAVE_GETOPT_LONG
92 #endif
94 extern void line_tools_look_for(const std::vector<char> & arguments,
96  S_I argc,
97  char *const argv[],
98  const char *getopt_string,
99 #if HAVE_GETOPT_LONG
100  const struct option *long_options,
101 #endif
102  std::vector<char> & presence);
103 
104 
110 #if HAVE_GETOPT_LONG
111 #endif
113 extern void line_tools_look_for_jQ(S_I argc,
116  char *const argv[],
117  const char *getopt_string,
118 #if HAVE_GETOPT_LONG
119  const struct option *long_options,
120 #endif
121  bool & j_is_present,
122  bool & Q_is_present);
123 
124 
125 
127 
128 #endif
are defined here basic integer types that tend to be portable
void line_tools_split_at_first_space(const char *field, std::string &before_space, std::string &after_space)
return split at the first space met the string given as first argument, and provide the two splitted ...
void line_tools_look_for(const std::vector< char > &arguments, S_I argc, char *const argv[], const char *getopt_string, std::vector< char > &presence)
std::string line_tools_get_full_path_from_PATH(const std::vector< std::string > &the_path, const char *filename)
return the full path of the given filename (eventually unchanged of pointing to the first file of tha...
This is a pure virtual class that is used by libdar when interaction with the user is required...
S_I line_tools_reset_getopt()
returns the old position of parsing (next argument to parse)
std::vector< std::string > line_tools_explode_PATH(const char *the_path)
split a PATH environement variable string into its components (/usr/lib:/lib => /usr/lib /lib) ...
exception used when a requested feature is not (yet) implemented
Definition: erreurs.hpp:199
switch module to limitint (32 ou 64 bits integers) or infinint
this is the interface class from which all other data transfer classes inherit
List of Generic Type Length Value data structures.
void line_tools_look_for_jQ(S_I argc, char *const argv[], const char *getopt_string, bool &j_is_present, bool &Q_is_present)
the arbitrary large positive integer class