Code

add breton win32 installer translation
[inkscape.git] / src / gc-managed.h
1 /** \file
2  * Inkscape::GC::Managed - base class for GC-managed objects
3  *
4  * Copyright 2004 MenTaLguY <mental@rydia.net>
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * See the file COPYING for details.
12  *
13  */
15 #ifndef SEEN_INKSCAPE_GC_MANAGED_H
16 #define SEEN_INKSCAPE_GC_MANAGED_H
18 #include "gc-core.h"
20 namespace Inkscape {
22 namespace GC {
24 /** @brief A base class for objects for whom the normal new and delete
25   *        operators should use the garbage-collected allocator
26   */
27 template <ScanPolicy default_scan=SCANNED,
28           CollectionPolicy default_collect=AUTO>
29 class Managed {
30 public:
31     void *operator new(std::size_t size,
32                        ScanPolicy scan=default_scan,
33                        CollectionPolicy collect=default_collect)
34     throw (std::bad_alloc)
35     {
36         return ::operator new(size, scan, collect);
37     }
39     void *operator new[](std::size_t size,
40                          ScanPolicy scan=default_scan,
41                          CollectionPolicy collect=default_collect)
42     throw (std::bad_alloc)
43     {
44         return ::operator new[](size, scan, collect);
45     }
47     void operator delete(void *p) { return ::operator delete(p, GC); }
48 };
50 }
52 }
54 #endif
55 /*
56   Local Variables:
57   mode:c++
58   c-file-style:"stroustrup"
59   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
60   indent-tabs-mode:nil
61   fill-column:99
62   End:
63 */
64 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :