"Fossies" - the Fresh Open Source Software Archive

Member "fstransform-0.9.4/fsmove/src/move.hh" (31 Mar 2019, 3471 Bytes) of package /linux/misc/fstransform-0.9.4.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "move.hh" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 0.9.3_vs_0.9.4.

    1 /*
    2  * fstransform - transform a file-system to another file-system type,
    3  *               preserving its contents and without the need for a backup
    4  *
    5  * Copyright (C) 2011-2012 Massimiliano Ghilardi
    6  *
    7  *     This program is free software: you can redistribute it and/or modify
    8  *     it under the terms of the GNU General Public License as published by
    9  *     the Free Software Foundation, either version 3 of the License, or
   10  *     (at your option) any later version.
   11  *
   12  *     This program is distributed in the hope that it will be useful,
   13  *     but WITHOUT ANY WARRANTY; without even the implied warranty of
   14  *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   15  *     GNU General Public License for more details.
   16  *
   17  *     You should have received a copy of the GNU General Public License
   18  *     along with this program.  If not, see <http://www.gnu.org/licenses/>.
   19  *
   20  * move.hh
   21  *
   22  *  Created on: Aug 18, 2011
   23  *      Author: max
   24  */
   25 
   26 #ifndef FSMOVE_MOVE_HH
   27 #define FSMOVE_MOVE_HH
   28 
   29 #include "args.hh"        // for fm_args
   30 #include "fwd.hh"         // for fm_io forward declaration
   31 #include "log.hh"         // for FC_TRACE
   32 
   33 
   34 FT_NAMESPACE_BEGIN
   35 
   36 /**
   37  * class doing the core of recursive move work.
   38  */
   39 class fm_move
   40 {
   41 private:
   42     FT_IO_NS fm_io * this_io;
   43 
   44     /** true if usage() or version() was called. */
   45     bool quit_immediately;
   46 
   47     /** cannot call copy constructor */
   48     fm_move(const fm_move &);
   49 
   50     /** cannot call assignment operator */
   51     const fm_move & operator=(const fm_move &);
   52 
   53     /** display command-line usage to stdout and return 0 */
   54     int usage(const char * program_name);
   55 
   56     /** output version information and return 0 */
   57     int version();
   58 
   59     static int invalid_cmdline(const char * program_name, int err, const char * fmt, ...);
   60 
   61     /** return EISCONN if remapper is initialized, else call quit_io() and return 0 */
   62     int check_is_closed();
   63 
   64     /** return 0 if remapper is initialized, else call quit_io() and return ENOTCONN */
   65     int check_is_open();
   66 
   67     /**
   68      * checks that I/O is open.
   69      * if success, stores a reference to I/O object.
   70      */
   71     int init(FT_IO_NS fm_io & io);
   72 
   73     /** core of recursive move algorithm, actually moves the whole source tree into target */
   74     int move();
   75 
   76     /** show progress status and E.T.A. */
   77     void show_progress();
   78 
   79 public:
   80     /** default constructor */
   81     fm_move();
   82 
   83     /** destructor. calls quit() */
   84     ~fm_move();
   85 
   86     /**
   87      * high-level do-everything method. calls in sequence init(), run() and cleanup().
   88      * return 0 if success, else error.
   89      */
   90     static int main(int argc, char ** argv);
   91 
   92     bool is_initialized() const;
   93 
   94     /**
   95      * parse command line and initialize all subsystems (job, I/O, log...)
   96      * return 0 if success, else error.
   97      *
   98      * implementation: parse command line, fill a fr_args and call init(const fr_args &)
   99      */
  100     int init(int argc, char const* const* argv);
  101 
  102     /**
  103      * initialize all subsystems (job, I/O, log...) using specified arguments
  104      * return 0 if success, else error.
  105      */
  106     int init(const fm_args & args);
  107 
  108     /**
  109      * main recursive move algorithm.
  110      * calls in sequence analyze() and move()
  111      */
  112     int run();
  113 
  114     /**
  115      * performs cleanup. called by destructor, you can also call it explicitly after (or instead of) run().
  116      * closes configured I/O and delete it
  117      */
  118     void quit();
  119 };
  120 
  121 
  122 FT_NAMESPACE_END
  123 
  124 
  125 #endif /* FSMOVE_MOVE_HH */