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

View File

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

View File

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

View File

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