Main Page   Modules   Data Structures   File List   Data Fields   Globals  

user_interaction_specific.hpp

Go to the documentation of this file.
00001 /*
00002  * user_interaction_specific.hpp
00003  * Created on 13 Feb 2005
00004  * Authors:
00005  *    Wesley Leggette <wleggette@kaylix.net>
00006  * 
00007  * 
00008  * 
00009  * libdarc
00010  * 
00011  * 
00012  * This program is free software; you can redistribute it and/or modify
00013  * it under the terms of the GNU General Public License as published by
00014  * the Free Software Foundation; either version 2 of the License, or
00015  * (at your option) any later version.
00016  *
00017  * This program is distributed in the hope that it will be useful,
00018  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  * GNU General Public License for more details.
00021  *
00022  * You should have received a copy of the GNU General Public License
00023  * along with this program; if not, write to the Free Software
00024  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00025  * 
00026  * $Id: user__interaction__specific_8hpp-source.html 708 2005-03-21 12:30:37Z leggwes $
00027  */
00028  
00034 #if LIBDARC_HAVE_LIBDAR_HPP
00035 #include <dar/user_interaction.hpp>
00036 #endif
00037 #include <string>
00038 #include "user_interaction.h"
00039 #include "translations.h"
00040  
00041 #ifndef USER_INTERACTION_SPECIFIC_HPP
00042 #define USER_INTERACTION_SPECIFIC_HPP
00043  
00044 // Ah... This is all C++ code here...
00045  
00046 /* wrapper class for user_interaction object (the later is passed to
00047  * libdar proper) 
00048  */
00049  
00058 namespace libdar
00059 {
00064     class user_interaction_callback_c : public user_interaction
00065     {
00066     public:
00075         user_interaction_callback_c (dar_user_interaction_struct &callbacks);
00076         
00078         void pause(const std::string & message);
00080         void warning(const std::string & message);
00082         std::string get_string(const std::string & message, bool echo);
00083         
00085         void listing(const std::string & flag,
00086             const std::string & perm,
00087             const std::string & uid,
00088             const std::string & gid,
00089             const std::string & size,
00090             const std::string & date,
00091             const std::string & filename,
00092             bool is_dir,
00093             bool has_children);
00094             
00095             
00097         virtual user_interaction *clone() const;
00098             
00099     private:
00100     
00101         dar_warning_callback m_warning;
00102         dar_answer_callback m_answer;
00103         dar_string_callback m_string;
00104         dar_listing_callback m_listing;
00105         
00106         bool is_listing_mode;
00107         
00108         void *context_val;
00109     
00110     };
00111     
00114     class user_interaction_null : public user_interaction
00115     {
00116     public:
00117         user_interaction_null();
00118         
00120         void pause(const std::string & message);
00122         void warning(const std::string & message);
00124         std::string get_string(const std::string & message, bool echo);
00125         
00127         void listing(const std::string & flag,
00128             const std::string & perm,
00129             const std::string & uid,
00130             const std::string & gid,
00131             const std::string & size,
00132             const std::string & date,
00133             const std::string & filename,
00134             bool is_dir,
00135             bool has_children);
00136             
00137             
00139         virtual user_interaction *clone() const;
00140     };
00141     
00142  
00143 } // end of namespace libdar
00144  
00145  
00146  
00147  #endif /* end of USER_INTERACTION_SPECIFIC_HPP */
00148