00001 /* libobby - Network text editing library 00002 * Copyright (C) 2005, 2006 0x539 dev group 00003 * 00004 * This program is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU General Public 00006 * License as published by the Free Software Foundation; either 00007 * version 2 of the License, or (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public 00015 * License along with this program; if not, write to the Free 00016 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00017 */ 00018 00019 #ifndef _OBBY_JUPITER_UNDO_HPP_ 00020 #define _OBBY_JUPITER_UNDO_HPP_ 00021 00022 #include <net6/non_copyable.hpp> 00023 #include "ring.hpp" 00024 #include "user.hpp" 00025 #include "operation.hpp" 00026 00027 namespace obby 00028 { 00029 00034 template<typename Document> 00035 class jupiter_undo: private net6::non_copyable 00036 { 00037 public: 00038 typedef Document document_type; 00039 typedef operation<document_type> operation_type; 00040 00041 jupiter_undo(const document_type& doc); 00042 ~jupiter_undo(); 00043 00046 void client_add(const user& client); 00047 00050 void client_remove(const user& client); 00051 00054 void local_op(const operation_type& op, const user* from); 00055 00058 void remote_op(const operation_type& op, const user* from); 00059 00062 bool can_undo(); 00063 00066 std::auto_ptr<operation_type> undo(); 00067 protected: 00068 const document_type& m_doc; 00069 }; 00070 00071 template<typename Document> 00072 jupiter_undo<Document>::jupiter_undo(const document_type& document): 00073 m_doc(document) 00074 { 00075 } 00076 00077 template<typename Document> 00078 jupiter_undo<Document>::~jupiter_undo() 00079 { 00080 } 00081 00082 template<typename Document> 00083 void jupiter_undo<Document>::client_add(const user& client) 00084 { 00085 } 00086 00087 template<typename Document> 00088 void jupiter_undo<Document>::client_remove(const user& client) 00089 { 00090 } 00091 00092 template<typename Document> 00093 void jupiter_undo<Document>::local_op(const operation_type& op, 00094 const user* from) 00095 { 00096 } 00097 00098 template<typename Document> 00099 void jupiter_undo<Document>::remote_op(const operation_type& op, 00100 const user* from) 00101 { 00102 } 00103 00104 template<typename Document> 00105 bool jupiter_undo<Document>::can_undo() 00106 { 00107 return false; 00108 } 00109 00110 template<typename Document> 00111 std::auto_ptr<typename jupiter_undo<Document>::operation_type> 00112 jupiter_undo<Document>::undo() 00113 { 00114 throw std::logic_error( 00115 "obby::jupiter_undo::undo:\n" 00116 "Not implemented!" 00117 ); 00118 } 00119 00120 } // namespace obby 00121 00122 #endif // _OBBY_JUPITER_UNDO_HPP_
1.5.1