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.
pull/4594/head
Vincent Coubard 2017-06-20 12:47:27 +01:00
parent dcbcf64830
commit 7a1e2cfc9a
4 changed files with 7 additions and 19 deletions

View File

@ -44,7 +44,7 @@
namespace mbed {
class ATCmdParser
class ATCmdParser : private NonCopyable<ATCmdParser>
{
private:
// File handle
@ -70,11 +70,6 @@ private:
};
oob *_oobs;
// Prohibiting use of of copy constructor
ATCmdParser(const ATCmdParser &);
// Prohibiting copy assignment Operator
ATCmdParser &operator=(const ATCmdParser &);
public:
/**

View File

@ -18,6 +18,7 @@
#include "platform/Callback.h"
#include "platform/mbed_toolchain.h"
#include "platform/NonCopyable.h"
#include <string.h>
namespace mbed {
@ -65,7 +66,7 @@ namespace mbed {
typedef Callback<void()> *pFunctionPointer_t;
class CallChainLink;
class CallChain {
class CallChain : private NonCopyable<CallChain> {
public:
/** Create an empty chain
*
@ -178,10 +179,7 @@ public:
return get(i);
}
/* disallow copy constructor and assignment operators */
private:
CallChain(const CallChain&);
CallChain & operator = (const CallChain&);
CallChainLink *_chain;
};

View File

@ -24,6 +24,7 @@ typedef int FILEHANDLE;
#include "platform/platform.h"
#include "platform/SingletonPtr.h"
#include "platform/PlatformMutex.h"
#include "platform/NonCopyable.h"
namespace mbed {
/** \addtogroup platform */
@ -39,7 +40,7 @@ typedef enum {
* @class FileBase
* @ingroup platform
*/
class FileBase {
class FileBase : private NonCopyable<FileBase> {
public:
FileBase(const char *name, PathType t);
virtual ~FileBase();
@ -59,8 +60,6 @@ private:
FileBase *_next;
const char * const _name;
const PathType _path_type;
FileBase(const FileBase&);
FileBase & operator = (const FileBase&);
};
} // namespace mbed

View File

@ -19,6 +19,7 @@
#include "platform/platform.h"
#include "platform/FileLike.h"
#include "platform/FileHandle.h"
#include "platform/NonCopyable.h"
#include <cstdio>
#include <cstdarg>
@ -36,7 +37,7 @@ extern char* mbed_gets(char *s, int size, std::FILE *_file);
* @note Synchronization level: Set by subclass
* @ingroup platform
*/
class Stream : public FileLike {
class Stream : public FileLike, private NonCopyable<Stream> {
public:
Stream(const char *name=NULL);
@ -80,11 +81,6 @@ protected:
virtual void unlock() {
// Stub
}
/* disallow copy constructor and assignment operators */
private:
Stream(const Stream&);
Stream & operator = (const Stream&);
};
} // namespace mbed