1 /* 2 * Port for usage with qt-framework and development for kdesvn 3 * Copyright (C) 2005-2009 by Rajko Albrecht (ral@alwins-world.de) 4 * http://kdesvn.alwins-world.de 5 */ 6 /* 7 * ==================================================================== 8 * Copyright (c) 2002-2005 The RapidSvn Group. All rights reserved. 9 * dev@rapidsvn.tigris.org 10 * 11 * This library is free software; you can redistribute it and/or 12 * modify it under the terms of the GNU Lesser General Public 13 * License as published by the Free Software Foundation; either 14 * version 2.1 of the License, or (at your option) any later version. 15 * 16 * This library is distributed in the hope that it will be useful, 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 * Lesser General Public License for more details. 20 * 21 * You should have received a copy of the GNU Lesser General Public 22 * License along with this library (in the file LGPL.txt); if not, 23 * write to the Free Software Foundation, Inc., 51 Franklin St, 24 * Fifth Floor, Boston, MA 02110-1301 USA 25 * 26 * This software consists of voluntary contributions made by many 27 * individuals. For exact contribution history, see the revision 28 * history and logs, available at http://rapidsvn.tigris.org/. 29 * ==================================================================== 30 */ 31 32 #ifndef SVNQT_POOL_H 33 #define SVNQT_POOL_H 34 35 // subversion api 36 #include <svn_pools.h> 37 38 namespace svn 39 { 40 /** 41 * Class for encapsulation of apr/subversion pools 42 */ 43 class Pool 44 { 45 public: 46 /** 47 * creates a subpool new pool to an existing pool 48 * 49 * @param parent NULL -> global pool 50 */ 51 explicit Pool(apr_pool_t *parent = nullptr); 52 Pool &operator=(const Pool &) = delete; 53 Pool(const Pool &) = delete; 54 55 ~Pool(); 56 57 /** 58 * @return apr handle to the pool 59 */ 60 apr_pool_t * 61 pool() const; 62 63 /** 64 * operator to return apr handle to the pool 65 */ 66 operator apr_pool_t *() const 67 { 68 return m_pool; 69 } 70 71 /** 72 * release pool and create a new one 73 */ 74 void renew(); 75 private: 76 apr_pool_t *m_parent; 77 apr_pool_t *m_pool; 78 79 static bool s_initialized; 80 static apr_pool_t *pool_create(apr_pool_t *parent); 81 }; 82 } 83 84 #endif 85 86 /* ----------------------------------------------------------------- 87 * local variables: 88 * eval: (load-file "../../rapidsvn-dev.el") 89 * end: 90 */ 91