persist_manager.hpp

Go to the documentation of this file.
00001 /* $Id: persist_manager.hpp 52533 2012-01-07 02:35:17Z shadowmaster $ */
00002 /*
00003    Copyright (C) 2010 - 2012 by Jody Northup
00004    Part of the Battle for Wesnoth Project http://www.wesnoth.org/
00005 
00006    This program is free software; you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License as published by
00008    the Free Software Foundation; either version 2 of the License, or
00009    (at your option) any later version.
00010    This program is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY.
00012 
00013    See the COPYING file for more details.
00014 */
00015 
00016 #ifndef PERSIST_MANAGER_HPP_INCLUDED
00017 #define PERSIST_MANAGER_HPP_INCLUDED
00018 
00019 #include "persist_context.hpp"
00020 
00021 class persist_manager {
00022     protected:
00023         typedef std::map<std::string,persist_context *> context_map;
00024 
00025         bool in_transaction_;
00026         context_map contexts_;
00027     public:
00028         bool start_transaction();
00029         bool end_transaction();
00030         bool cancel_transaction();
00031 
00032         persist_manager() : in_transaction_(false),contexts_() {}
00033         virtual ~persist_manager() {
00034             cancel_transaction();
00035             for (context_map::iterator i = contexts_.begin(); i != contexts_.end(); ++i)
00036                 delete (i->second);
00037         }
00038         persist_context &get_context(const std::string &ns);
00039 };
00040 
00041 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Fri May 25 2012 01:03:07 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs