media/webrtc/signaling/include/SharedPtr.h

branch
TOR_BUG_9701
changeset 10
ac0c01689b40
equal deleted inserted replaced
-1:000000000000 0:50268d6040b0
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5 #pragma once
6
7 #include <vector>
8 #include "base/linked_ptr.h"
9 #include "nsAutoPtr.h"
10
11 #ifndef DECLARE_PTR
12 #define DECLARE_PTR(className)\
13 class className;\
14 typedef linked_ptr<className> className##Ptr;
15 #endif
16
17
18 #ifndef DECLARE_PTR_VECTOR
19 #define DECLARE_PTR_VECTOR(className)\
20 DECLARE_PTR(className)\
21 typedef std::vector<className##Ptr> className##Vtr;\
22 typedef linked_ptr<className##Vtr> className##Vtr##Ptr;
23 #endif
24
25
26 #ifndef NULL_PTR
27 #define NULL_PTR(className) linked_ptr<className>()
28 #endif
29
30 // NSPR Variations of the above, to help with migration
31 // from linked_ptr to nsRefPtr
32 #ifndef DECLARE_NS_PTR
33 #define DECLARE_NS_PTR(className)\
34 class className;\
35 typedef nsRefPtr<className> className##Ptr;
36 #endif
37
38
39 #ifndef DECLARE_NS_PTR_VECTOR
40 #define DECLARE_NS_PTR_VECTOR(className)\
41 DECLARE_NS_PTR(className)\
42 typedef std::vector<className##Ptr> className##Vtr;\
43 typedef linked_ptr<className##Vtr> className##Vtr##Ptr;
44 #endif

mercurial