Skip to content
This repository has been archived by the owner on Aug 23, 2022. It is now read-only.

Commit

Permalink
platform: Replace private copy constructor and copy assignement opera…
Browse files Browse the repository at this point in the history
…tor by a NonCopyable tag.

The class concerned by this change are: ATCmdParser, CallChain, FileBase and Stream.
  • Loading branch information
pan- committed Jun 20, 2017
1 parent dcbcf64 commit 7a1e2cf
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 19 deletions.
7 changes: 1 addition & 6 deletions platform/ATCmdParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

namespace mbed {

class ATCmdParser
class ATCmdParser : private NonCopyable<ATCmdParser>
{
private:
// File handle
Expand All @@ -70,11 +70,6 @@ class ATCmdParser
};
oob *_oobs;

// Prohibiting use of of copy constructor
ATCmdParser(const ATCmdParser &);
// Prohibiting copy assignment Operator
ATCmdParser &operator=(const ATCmdParser &);

public:

/**
Expand Down
6 changes: 2 additions & 4 deletions platform/CallChain.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#include "platform/Callback.h"
#include "platform/mbed_toolchain.h"
#include "platform/NonCopyable.h"
#include <string.h>

namespace mbed {
Expand Down Expand Up @@ -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
*
Expand Down Expand Up @@ -178,10 +179,7 @@ class CallChain {
return get(i);
}

/* disallow copy constructor and assignment operators */
private:
CallChain(const CallChain&);
CallChain & operator = (const CallChain&);
CallChainLink *_chain;
};

Expand Down
5 changes: 2 additions & 3 deletions platform/FileBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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();
Expand All @@ -59,8 +60,6 @@ class FileBase {
FileBase *_next;
const char * const _name;
const PathType _path_type;
FileBase(const FileBase&);
FileBase & operator = (const FileBase&);
};

} // namespace mbed
Expand Down
8 changes: 2 additions & 6 deletions platform/Stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "platform/platform.h"
#include "platform/FileLike.h"
#include "platform/FileHandle.h"
#include "platform/NonCopyable.h"
#include <cstdio>
#include <cstdarg>

Expand All @@ -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);
Expand Down Expand Up @@ -80,11 +81,6 @@ class Stream : public FileLike {
virtual void unlock() {
// Stub
}

/* disallow copy constructor and assignment operators */
private:
Stream(const Stream&);
Stream & operator = (const Stream&);
};

} // namespace mbed
Expand Down

0 comments on commit 7a1e2cf

Please sign in to comment.