diff options
author | alberth <alberth@openttd.org> | 2015-08-08 10:06:24 +0000 |
---|---|---|
committer | alberth <alberth@openttd.org> | 2015-08-08 10:06:24 +0000 |
commit | b885d79f506bde93b4ab278b3f84b8ca6254f3b9 (patch) | |
tree | ed7e027c4444181baab5b4ef6b667cd179f29a65 /src/misc/countedptr.hpp | |
parent | 9cadc0e1504cf979c14e1cb42bfe51a29675dd81 (diff) | |
download | openttd-b885d79f506bde93b4ab278b3f84b8ca6254f3b9.tar.xz |
(svn r27362) -Codechange: Codestyle fixes for reference var declarations, static cast type, operator methods.
Diffstat (limited to 'src/misc/countedptr.hpp')
-rw-r--r-- | src/misc/countedptr.hpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/misc/countedptr.hpp b/src/misc/countedptr.hpp index 5dfc9a74c..1a783cf3e 100644 --- a/src/misc/countedptr.hpp +++ b/src/misc/countedptr.hpp @@ -38,7 +38,7 @@ public: inline CCountedPtr(Tcls *pObj = NULL) : m_pT(pObj) {AddRef();} /** copy constructor (invoked also when initializing from another smart ptr) */ - inline CCountedPtr(const CCountedPtr& src) : m_pT(src.m_pT) {AddRef();} + inline CCountedPtr(const CCountedPtr &src) : m_pT(src.m_pT) {AddRef();} /** destructor releasing the reference */ inline ~CCountedPtr() {Release();} @@ -52,10 +52,10 @@ public: inline void Release() {if (m_pT != NULL) {Tcls *pT = m_pT; m_pT = NULL; pT->Release();}} /** dereference of smart pointer - const way */ - inline const Tcls *operator -> () const {assert(m_pT != NULL); return m_pT;} + inline const Tcls *operator->() const {assert(m_pT != NULL); return m_pT;} /** dereference of smart pointer - non const way */ - inline Tcls *operator -> () {assert(m_pT != NULL); return m_pT;} + inline Tcls *operator->() {assert(m_pT != NULL); return m_pT;} /** raw pointer casting operator - const way */ inline operator const Tcls*() const {assert(m_pT == NULL); return m_pT;} @@ -64,13 +64,13 @@ public: inline operator Tcls*() {return m_pT;} /** operator & to support output arguments */ - inline Tcls** operator &() {assert(m_pT == NULL); return &m_pT;} + inline Tcls** operator&() {assert(m_pT == NULL); return &m_pT;} /** assignment operator from raw ptr */ - inline CCountedPtr& operator = (Tcls *pT) {Assign(pT); return *this;} + inline CCountedPtr& operator=(Tcls *pT) {Assign(pT); return *this;} /** assignment operator from another smart ptr */ - inline CCountedPtr& operator = (const CCountedPtr& src) {Assign(src.m_pT); return *this;} + inline CCountedPtr& operator=(const CCountedPtr &src) {Assign(src.m_pT); return *this;} /** assignment operator helper */ inline void Assign(Tcls *pT); @@ -79,10 +79,10 @@ public: inline bool IsNull() const {return m_pT == NULL;} /** another way how to test for NULL value */ - //inline bool operator == (const CCountedPtr& sp) const {return m_pT == sp.m_pT;} + //inline bool operator == (const CCountedPtr &sp) const {return m_pT == sp.m_pT;} /** yet another way how to test for NULL value */ - //inline bool operator != (const CCountedPtr& sp) const {return m_pT != sp.m_pT;} + //inline bool operator != (const CCountedPtr &sp) const {return m_pT != sp.m_pT;} /** assign pointer w/o incrementing ref count */ inline void Attach(Tcls *pT) {Release(); m_pT = pT;} |