1 /* copy_parameters.hh 2 * This file belongs to Worker, a file manager for UN*X/X11. 3 * Copyright (C) 2015 Ralf Hoffmann. 4 * You can contact me at: ralf@boomerangsworld.de 5 * or http://www.boomerangsworld.de/worker 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 2 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, write to the Free Software 19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 20 */ 21 22 #ifndef COPY_PARAMETERS_H 23 #define COPY_PARAMETERS_H 24 25 #include "wdefines.h" 26 27 namespace CopyParams { 28 29 typedef enum { LEAVE_PERMISSIONS_UNMODIFIED, 30 ENSURE_USER_RW_PERMISSION, 31 ENSURE_USER_RW_GROUP_R_PERMISSION, 32 ENSURE_USER_RW_ALL_R_PERMISSION 33 } ensure_mode_t; 34 35 class EnsureFilePermissions { 36 public: 37 EnsureFilePermissions()38 EnsureFilePermissions() : m_val( LEAVE_PERMISSIONS_UNMODIFIED ) {} EnsureFilePermissions(const ensure_mode_t & val)39 EnsureFilePermissions( const ensure_mode_t &val ) : m_val( val ) {} 40 operator ()() const41 const ensure_mode_t &operator()() const 42 { 43 return m_val; 44 } 45 operator ()(const ensure_mode_t & val)46 void operator()( const ensure_mode_t &val ) 47 { 48 m_val = val; 49 } 50 private: 51 ensure_mode_t m_val; 52 }; 53 54 }; 55 56 #endif /* COPY_PARAMETERS_H */ 57