File indexing completed on 2024-06-02 04:44:36
0001 /* 0002 * ==================================================================== 0003 * Copyright (c) 2002-2009 The RapidSvn Group. All rights reserved. 0004 * 0005 * This program is free software: you can redistribute it and/or modify 0006 * it under the terms of the GNU General Public License as published by 0007 * the Free Software Foundation, either version 3 of the License, or 0008 * (at your option) any later version. 0009 * 0010 * This program is distributed in the hope that it will be useful, 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0013 * GNU General Public License for more details. 0014 * 0015 * You should have received a copy of the GNU General Public License 0016 * along with this program (in the file GPL.txt. 0017 * If not, see <http://www.gnu.org/licenses/>. 0018 * 0019 * This software consists of voluntary contributions made by many 0020 * individuals. For exact contribution history, see the revision 0021 * history and logs, available at http://rapidsvn.tigris.org/. 0022 * ==================================================================== 0023 */ 0024 0025 // svncpp 0026 #include "kdevsvncpp/pool.hpp" 0027 0028 0029 /** 0030 * SvnCpp namespace 0031 */ 0032 namespace svn 0033 { 0034 static bool m_initialized = false; 0035 0036 inline static apr_pool_t * 0037 pool_create(apr_pool_t * parent) 0038 { 0039 // CAUTION: this is not thread-safe!!! 0040 if (!m_initialized) 0041 { 0042 m_initialized = true; 0043 apr_pool_initialize(); 0044 } 0045 0046 return svn_pool_create(parent); 0047 } 0048 0049 Pool::Pool(apr_pool_t * parent) 0050 : m_parent(parent), m_pool(pool_create(parent)) 0051 { 0052 } 0053 0054 Pool::~Pool() 0055 { 0056 if (m_pool) 0057 { 0058 svn_pool_destroy(m_pool); 0059 } 0060 } 0061 0062 apr_pool_t * 0063 Pool::pool() const 0064 { 0065 return m_pool; 0066 } 0067 0068 void 0069 Pool::renew() 0070 { 0071 if (m_pool) 0072 { 0073 svn_pool_destroy(m_pool); 0074 } 0075 m_pool = pool_create(m_parent); 0076 } 0077 0078 //TODO 0079 // apr_pool_t * 0080 // Pool::operator=(const Pool & pool) 0081 // { 0082 // return 0083 // if (this == &path) 0084 // return *this; 0085 // m_path = path.c_str(); 0086 // return *this; 0087 // } 0088 } 0089 0090 /* ----------------------------------------------------------------- 0091 * local variables: 0092 * eval: (load-file "../../rapidsvn-dev.el") 0093 * end: 0094 */