Merge branch 'dev' of feistymeow.org:feisty_meow into dev
[feisty_meow.git] / octopi / library / tentacles / recursive_file_copy.h
1 #ifndef RECURSIVE_FILE_COPY_CLASS
2 #define RECURSIVE_FILE_COPY_CLASS
3
4 /*****************************************************************************\
5 *                                                                             *
6 *  Name   : recursive file copy                                               *
7 *  Author : Chris Koeritz                                                     *
8 *                                                                             *
9 *******************************************************************************
10 * Copyright (c) 2005-$now By Author.  This program is free software; you can  *
11 * redistribute it and/or modify it under the terms of the GNU General Public  *
12 * License as published by the Free Software Foundation; either version 2 of   *
13 * the License or (at your option) any later version.  This is online at:      *
14 *     http://www.fsf.org/copyleft/gpl.html                                    *
15 * Please send any updates to: fred@gruntose.com                               *
16 \*****************************************************************************/
17
18 #include <basis/astring.h>
19 #include <basis/contracts.h>
20 #include <filesystem/filename_list.h>
21
22 namespace octopi {
23
24 //! Copies entire hierarchies in the file system from one place to another.
25
26 class recursive_file_copy
27 {
28 public:
29   virtual ~recursive_file_copy();
30
31   DEFINE_CLASS_NAME("recursive_file_copy");
32
33   enum outcomes {
34     OKAY = basis::common::OKAY,
35     BAD_INPUT = basis::common::BAD_INPUT,
36     GARBAGE = basis::common::GARBAGE,
37     NOT_FOUND = basis::common::NOT_FOUND,
38     NONE_READY = basis::common::NONE_READY,
39     FAILURE = basis::common::FAILURE
40   };
41   static const char *outcome_name(const basis::outcome &to_name);
42
43 //hmmm: need an option to specify the logging that we are currently doing in here.
44
45   //! copies a directory hierarchy starting at "source_dir" into "target_dir".
46   /*! the "transfer_mode" is a combination of mode values from the file_transfer_tentacle class,
47   and dictates how the files to copy will be decided.  the "includes" is a list of files that will
48   be included.  if that is an empty array, then all files will be included.  the "source_start"
49   is a subdirectory within the source to start copying at; only items there and below will be
50   included. */
51   static basis::outcome copy_hierarchy(int transfer_mode, const basis::astring &source_dir,
52       const basis::astring &target_dir, const structures::string_array &includes,
53       const basis::astring &source_start = basis::astring::empty_string());
54 };
55
56 } //namespace.
57
58 #endif
59