Skip to content

Commit 7a1e2cf

Browse files
committed
platform: Replace private copy constructor and copy assignement operator by a NonCopyable tag.
The class concerned by this change are: ATCmdParser, CallChain, FileBase and Stream.
1 parent dcbcf64 commit 7a1e2cf

File tree

4 files changed

+7
-19
lines changed

4 files changed

+7
-19
lines changed

platform/ATCmdParser.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444

4545
namespace mbed {
4646

47-
class ATCmdParser
47+
class ATCmdParser : private NonCopyable<ATCmdParser>
4848
{
4949
private:
5050
// File handle
@@ -70,11 +70,6 @@ class ATCmdParser
7070
};
7171
oob *_oobs;
7272

73-
// Prohibiting use of of copy constructor
74-
ATCmdParser(const ATCmdParser &);
75-
// Prohibiting copy assignment Operator
76-
ATCmdParser &operator=(const ATCmdParser &);
77-
7873
public:
7974

8075
/**

platform/CallChain.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
#include "platform/Callback.h"
2020
#include "platform/mbed_toolchain.h"
21+
#include "platform/NonCopyable.h"
2122
#include <string.h>
2223

2324
namespace mbed {
@@ -65,7 +66,7 @@ namespace mbed {
6566
typedef Callback<void()> *pFunctionPointer_t;
6667
class CallChainLink;
6768

68-
class CallChain {
69+
class CallChain : private NonCopyable<CallChain> {
6970
public:
7071
/** Create an empty chain
7172
*
@@ -178,10 +179,7 @@ class CallChain {
178179
return get(i);
179180
}
180181

181-
/* disallow copy constructor and assignment operators */
182182
private:
183-
CallChain(const CallChain&);
184-
CallChain & operator = (const CallChain&);
185183
CallChainLink *_chain;
186184
};
187185

platform/FileBase.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ typedef int FILEHANDLE;
2424
#include "platform/platform.h"
2525
#include "platform/SingletonPtr.h"
2626
#include "platform/PlatformMutex.h"
27+
#include "platform/NonCopyable.h"
2728

2829
namespace mbed {
2930
/** \addtogroup platform */
@@ -39,7 +40,7 @@ typedef enum {
3940
* @class FileBase
4041
* @ingroup platform
4142
*/
42-
class FileBase {
43+
class FileBase : private NonCopyable<FileBase> {
4344
public:
4445
FileBase(const char *name, PathType t);
4546
virtual ~FileBase();
@@ -59,8 +60,6 @@ class FileBase {
5960
FileBase *_next;
6061
const char * const _name;
6162
const PathType _path_type;
62-
FileBase(const FileBase&);
63-
FileBase & operator = (const FileBase&);
6463
};
6564

6665
} // namespace mbed

platform/Stream.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "platform/platform.h"
2020
#include "platform/FileLike.h"
2121
#include "platform/FileHandle.h"
22+
#include "platform/NonCopyable.h"
2223
#include <cstdio>
2324
#include <cstdarg>
2425

@@ -36,7 +37,7 @@ extern char* mbed_gets(char *s, int size, std::FILE *_file);
3637
* @note Synchronization level: Set by subclass
3738
* @ingroup platform
3839
*/
39-
class Stream : public FileLike {
40+
class Stream : public FileLike, private NonCopyable<Stream> {
4041

4142
public:
4243
Stream(const char *name=NULL);
@@ -80,11 +81,6 @@ class Stream : public FileLike {
8081
virtual void unlock() {
8182
// Stub
8283
}
83-
84-
/* disallow copy constructor and assignment operators */
85-
private:
86-
Stream(const Stream&);
87-
Stream & operator = (const Stream&);
8884
};
8985

9086
} // namespace mbed

0 commit comments

Comments
 (0)