2014-05-13 18:00:26 +00:00
|
|
|
/*
|
|
|
|
|
* Copyright 2004 The WebRTC Project Authors. All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef WEBRTC_BASE_CONSTRUCTORMAGIC_H_
|
|
|
|
|
#define WEBRTC_BASE_CONSTRUCTORMAGIC_H_
|
|
|
|
|
|
2014-06-27 15:49:02 +00:00
|
|
|
// Undefine macros first, just in case. Some third-party includes have their own
|
|
|
|
|
// version.
|
|
|
|
|
|
2015-09-09 23:43:40 -07:00
|
|
|
// Put this in the declarations for a class to be unassignable.
|
2014-06-27 15:49:02 +00:00
|
|
|
#undef DISALLOW_ASSIGN
|
2014-05-13 18:00:26 +00:00
|
|
|
#define DISALLOW_ASSIGN(TypeName) \
|
2015-09-09 23:43:40 -07:00
|
|
|
void operator=(const TypeName&) = delete
|
2014-05-13 18:00:26 +00:00
|
|
|
|
2015-09-09 23:43:40 -07:00
|
|
|
// A macro to disallow the copy constructor and operator= functions. This should
|
|
|
|
|
// be used in the declarations for a class.
|
2014-05-13 18:00:26 +00:00
|
|
|
#undef DISALLOW_COPY_AND_ASSIGN
|
2015-09-09 23:43:40 -07:00
|
|
|
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
|
|
|
|
|
TypeName(const TypeName&) = delete; \
|
2014-05-13 18:00:26 +00:00
|
|
|
DISALLOW_ASSIGN(TypeName)
|
|
|
|
|
|
2015-09-09 23:43:40 -07:00
|
|
|
// A macro to disallow all the implicit constructors, namely the default
|
|
|
|
|
// constructor, copy constructor and operator= functions.
|
2014-05-13 18:00:26 +00:00
|
|
|
//
|
2015-09-09 23:43:40 -07:00
|
|
|
// This should be used in the declarations for a class that wants to prevent
|
|
|
|
|
// anyone from instantiating it. This is especially useful for classes
|
|
|
|
|
// containing only static methods.
|
2014-06-27 15:49:02 +00:00
|
|
|
#undef DISALLOW_IMPLICIT_CONSTRUCTORS
|
2014-05-13 18:00:26 +00:00
|
|
|
#define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \
|
2015-09-09 23:43:40 -07:00
|
|
|
TypeName() = delete; \
|
2015-04-04 23:56:53 +00:00
|
|
|
DISALLOW_COPY_AND_ASSIGN(TypeName)
|
2014-05-13 18:00:26 +00:00
|
|
|
|
|
|
|
|
#endif // WEBRTC_BASE_CONSTRUCTORMAGIC_H_
|