X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=include%2Fiundo.h;h=eb1e8681c9c16a7882d240306dc20bff43daafb0;hb=2b9f98b42951a020edb75efa415d00079f25abb3;hp=6719a49751bae945b4516d3521ee97c0a166cfcc;hpb=12b372f89ce109a4db9d510884fbe7d05af79870;p=xonotic%2Fnetradiant.git diff --git a/include/iundo.h b/include/iundo.h index 6719a497..eb1e8681 100644 --- a/include/iundo.h +++ b/include/iundo.h @@ -1,25 +1,25 @@ /* -Copyright (C) 2001-2006, William Joseph. -All Rights Reserved. + Copyright (C) 2001-2006, William Joseph. + All Rights Reserved. -This file is part of GtkRadiant. + This file is part of GtkRadiant. -GtkRadiant is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + GtkRadiant is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -GtkRadiant is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + GtkRadiant is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with GtkRadiant; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ + You should have received a copy of the GNU General Public License + along with GtkRadiant; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ -#if !defined(INCLUDED_IUNDO_H) +#if !defined( INCLUDED_IUNDO_H ) #define INCLUDED_IUNDO_H /// \file @@ -27,55 +27,65 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include #include "generic/constant.h" +#include "generic/callbackfwd.h" class UndoMemento { public: - virtual void release() = 0; +virtual void release() = 0; +virtual ~UndoMemento() { +} }; class Undoable { public: - virtual UndoMemento* exportState() const = 0; - virtual void importState(const UndoMemento* state) = 0; +virtual UndoMemento* exportState() const = 0; +virtual void importState( const UndoMemento* state ) = 0; +virtual ~Undoable() { +} }; class UndoObserver { public: - virtual void save(Undoable* undoable) = 0; +virtual void save( Undoable* undoable ) = 0; +virtual ~UndoObserver() { +} }; -class Callback; - class UndoTracker { public: - virtual void clear() = 0; - virtual void begin() = 0; - virtual void undo() = 0; - virtual void redo() = 0; +virtual void clear() = 0; +virtual void begin() = 0; +virtual void undo() = 0; +virtual void redo() = 0; +virtual ~UndoTracker() { +} }; class UndoSystem { public: - INTEGER_CONSTANT(Version, 1); - STRING_CONSTANT(Name, "undo"); +INTEGER_CONSTANT( Version, 1 ); +STRING_CONSTANT( Name, "undo" ); - virtual UndoObserver* observer(Undoable* undoable) = 0; - virtual void release(Undoable* undoable) = 0; +virtual UndoObserver* observer( Undoable* undoable ) = 0; +virtual void release( Undoable* undoable ) = 0; - virtual std::size_t size() const = 0; - virtual void start() = 0; - virtual void finish(const char* command) = 0; - virtual void undo() = 0; - virtual void redo() = 0; - virtual void clear() = 0; +virtual std::size_t size() const = 0; +virtual void start() = 0; +virtual void finish( const char* command ) = 0; +virtual void undo() = 0; +virtual void redo() = 0; +virtual void clear() = 0; - virtual void trackerAttach(UndoTracker& tracker) = 0; - virtual void trackerDetach(UndoTracker& tracker) = 0; +virtual void trackerAttach( UndoTracker& tracker ) = 0; +virtual void trackerDetach( UndoTracker& tracker ) = 0; + +virtual ~UndoSystem() { +} }; #include "modulesystem.h" @@ -88,23 +98,20 @@ template class GlobalModuleRef; typedef GlobalModuleRef GlobalUndoModuleRef; -inline UndoSystem& GlobalUndoSystem() -{ - return GlobalUndoModule::getTable(); +inline UndoSystem& GlobalUndoSystem(){ + return GlobalUndoModule::getTable(); } class UndoableCommand { - const char* m_command; +const char* m_command; public: - UndoableCommand(const char* command) : m_command(command) - { - GlobalUndoSystem().start(); - } - ~UndoableCommand() - { - GlobalUndoSystem().finish(m_command); - } +UndoableCommand( const char* command ) : m_command( command ){ + GlobalUndoSystem().start(); +} +~UndoableCommand(){ + GlobalUndoSystem().finish( m_command ); +} };