1 /*
2  * Copyright (C) 2002 - David W. Durham
3  *
4  * This file is part of ReZound, an audio editing application.
5  *
6  * ReZound is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published
8  * by the Free Software Foundation; either version 2 of the License,
9  * or (at your option) any later version.
10  *
11  * ReZound is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
19  */
20 #ifndef SCOPED_AUTO_RELEASE_POOL_H
21 #define SCOPED_AUTO_RELEASE_POOL_H
22 
23 #include "../../config/common.h"
24 
25 #import <Foundation/Foundation.h>
26 -
27 class ScopedAutoReleasePool {
28 public:
29     ScopedAutoReleasePool() {
30 #if defined(__OBJC__) && !defined(__USING_ARC__)
31         m_pool =  [[NSAutoreleasePool alloc] init];
32 #endif
33     }
34 
35     ~ScopedAutoReleasePool() {
36 #if defined(__OBJC__) && !defined(__USING_ARC__)
37         [m_pool release];
38 #endif
39     }
40 
41 private:
42 #if defined(__OBJC__) && !defined(__USING_ARC__)
43     NSAutoreleasePool* m_pool;
44 #endif
45 };
46 
47 #endif
48