directoryviewer.h
Go to the documentation of this file.00001 #ifndef directory_viewer_included
00002 #define directory_viewer_included
00003
00004 #include <cxxtls/cpptagdb.h>
00005 #include <cxxtls/viewermanager.h>
00006 #include <cxxtls/file.h>
00007 #include <portable_io.h>
00008 #include <vector>
00009 #include <list>
00010 #include <set>
00011
00012 namespace cxxtls
00013 {
00014
00020
00021 struct DirectoryViewer
00022 : public ListViewer::policies
00023
00104
00105 {
00106 typedef FileName::sorted_names_t file_name_list;
00107 typedef std::vector<FileName> file_name_vector;
00108 typedef std::vector<std::string> string_vector;
00109 typedef std::vector<FileStatus> file_status_vector;
00110 typedef std::set<FileName> marked_files_set;
00111 typedef CursorWindow::input_event input_event;
00112
00113
00114 size_t marked_line_;
00115 FileName fullname_;
00116 file_status_vector status_;
00117 file_name_vector names_;
00118 marked_files_set marks_;
00119
00120 int vp_width_;
00121
00122 bool user_names_;
00123 bool show_ids_;
00124
00125 bool is_marked(size_t index);
00126 bool is_special(size_t index);
00127
00128 enum sortCode
00129
00132 {
00133 onName=0,
00134 onSize=1,
00135 onTime=2
00136 };
00137
00138 sortCode sortCode_;
00139
00140 void remove_item(size_t index);
00142
00143
00144 DirectoryViewer(std::string const &fullname,
00145 bool show_user_names=false,
00146 bool show_ids=false );
00147
00150
00151
00152 void read_directory();
00158
00159
00160 void display_symbolic_link_file_target(size_t index, ViewerManager *vm);
00164
00165
00166 void generate_row_text();
00167
00169
00170 void generate_row_text(size_t index);
00172
00173
00174 void handle_resize(CursorWindow::row_col const &vp_size);
00178
00179 int etags_first(ViewerManager* vm);
00182
00183 int cpptags_first(ViewerManager* vm);
00186
00187 int cpptagviewer(ViewerManager* vm);
00189
00190 int etags_all(ViewerManager* vm);
00192
00193 int cpptags_all(ViewerManager* vm);
00195
00196 int copy_file(size_t index, ViewerManager* vm, FileName target_filename = "");
00197
00199
00200 int rename_file(size_t index, ViewerManager* vm, FileName target_filename = "");
00201
00203
00204 int copy_files(ViewerManager*vm);
00205
00207
00208 int rename_files(ViewerManager*vm);
00209
00211
00212 int delete_file(size_t index, ViewerManager* vm, bool verify=true);
00213
00217
00218
00219 int change_mode(size_t index, ViewerManager* vm);
00220
00222
00223 void view_file_or_dir(std::string const &dir, ViewerManager* vm, bool is_dir);
00224
00227
00228 void view_dir(size_t index, ViewerManager* vm);
00229
00232
00233 int mark_files_by_pattern(ViewerManager* vm);
00236
00237 int delete_files(ViewerManager* vm);
00238
00240
00241
00242
00243 int handle_event(CursorWindow::input_event const *e,
00244 size_t index,
00245 ViewerManager* vm);
00246
00249
00250
00251 static Viewer* app(ViewerManager*vm, std::string &fullname);
00252
00258
00259 static std::string app_name;
00260
00263
00264 virtual std::auto_ptr< std::list<std::string> > help_text();
00265
00266 std::string const& application_name() const { return app_name; }
00267
00271
00272 std::string description() const { return fullname_; }
00273
00274
00275 virtual bool fetchAllLines(std::list< std::string > &output );
00277
00278 };
00279
00280 }
00281
00282 #endif