• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 /*
12  * WebRtc
13  * Copy from third_party/libjingle/source/talk/base/constructormagic.h
14  */
15 
16 #ifndef WEBRTC_SYSTEM_WRAPPERS_INTERFACE_CONSTRUCTOR_MAGIC_H_
17 #define WEBRTC_SYSTEM_WRAPPERS_INTERFACE_CONSTRUCTOR_MAGIC_H_
18 
19 #ifndef DISALLOW_ASSIGN
20 #define DISALLOW_ASSIGN(TypeName) \
21   void operator=(const TypeName&)
22 #endif
23 
24 #ifndef DISALLOW_COPY_AND_ASSIGN
25 // A macro to disallow the evil copy constructor and operator= functions
26 // This should be used in the private: declarations for a class
27 #define DISALLOW_COPY_AND_ASSIGN(TypeName)    \
28   TypeName(const TypeName&);                    \
29   DISALLOW_ASSIGN(TypeName)
30 #endif
31 
32 #ifndef DISALLOW_EVIL_CONSTRUCTORS
33 // Alternative, less-accurate legacy name.
34 #define DISALLOW_EVIL_CONSTRUCTORS(TypeName) \
35   DISALLOW_COPY_AND_ASSIGN(TypeName)
36 #endif
37 
38 #ifndef DISALLOW_IMPLICIT_CONSTRUCTORS
39 // A macro to disallow all the implicit constructors, namely the
40 // default constructor, copy constructor and operator= functions.
41 //
42 // This should be used in the private: declarations for a class
43 // that wants to prevent anyone from instantiating it. This is
44 // especially useful for classes containing only static methods.
45 #define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \
46   TypeName();                                    \
47   DISALLOW_EVIL_CONSTRUCTORS(TypeName)
48 #endif
49 
50 #endif  // WEBRTC_SYSTEM_WRAPPERS_INTERFACE_CONSTRUCTOR_MAGIC_H_
51