author | alwin <alwin> | 2004-03-12 19:18:29 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-03-12 19:18:29 (UTC) |
commit | 874d5a34eca296263dcd1adf857aebe9981825a1 (patch) (unidiff) | |
tree | a7b60a4d2a4de379ee4370dada0a76a8b2b3b4ee /libopie2 | |
parent | 590587e74b908460a275b1f58654bcf4cce5d175 (diff) | |
download | opie-874d5a34eca296263dcd1adf857aebe9981825a1.zip opie-874d5a34eca296263dcd1adf857aebe9981825a1.tar.gz opie-874d5a34eca296263dcd1adf857aebe9981825a1.tar.bz2 |
renaming
-rw-r--r-- | libopie2/opiecore/osmartpointer.h (renamed from libopie2/opiecore/osmart_pointer.h) | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/libopie2/opiecore/osmart_pointer.h b/libopie2/opiecore/osmartpointer.h index 2a2518f..9000e71 100644 --- a/libopie2/opiecore/osmart_pointer.h +++ b/libopie2/opiecore/osmartpointer.h | |||
@@ -29,11 +29,11 @@ _;:, .> :=|. This program is free software; you can | |||
29 | Boston, MA 02111-1307, USA. | 29 | Boston, MA 02111-1307, USA. |
30 | */ | 30 | */ |
31 | 31 | ||
32 | #ifndef _osmart_pointer_h | 32 | #ifndef _OSmartPointer_h |
33 | #define _osmart_pointer_h | 33 | #define _OSmartPointer_h |
34 | 34 | ||
35 | /*! | 35 | /*! |
36 | * \file osmart_pointer.h | 36 | * \file OSmartPointer.h |
37 | * \brief smart pointer and reference counter | 37 | * \brief smart pointer and reference counter |
38 | * \author Rajko Albrecht | 38 | * \author Rajko Albrecht |
39 | * | 39 | * |
@@ -42,15 +42,15 @@ _;:, .> :=|. This program is free software; you can | |||
42 | namespace Opie { | 42 | namespace Opie { |
43 | 43 | ||
44 | //! simple reference counter class | 44 | //! simple reference counter class |
45 | class oref_count { | 45 | class ORefCount { |
46 | protected: | 46 | protected: |
47 | //! reference count member | 47 | //! reference count member |
48 | long m_RefCount; | 48 | long m_RefCount; |
49 | public: | 49 | public: |
50 | //! first reference must be added after "new" via Pointer() | 50 | //! first reference must be added after "new" via Pointer() |
51 | oref_count() : m_RefCount(0) | 51 | ORefCount() : m_RefCount(0) |
52 | {} | 52 | {} |
53 | virtual ~oref_count() {} | 53 | virtual ~ORefCount() {} |
54 | //! add a reference | 54 | //! add a reference |
55 | void Incr() { | 55 | void Incr() { |
56 | ++m_RefCount; | 56 | ++m_RefCount; |
@@ -64,7 +64,7 @@ public: | |||
64 | }; | 64 | }; |
65 | 65 | ||
66 | //! reference counting wrapper class | 66 | //! reference counting wrapper class |
67 | template<class T> class osmart_pointer { | 67 | template<class T> class OSmartPointer { |
68 | //! pointer to object | 68 | //! pointer to object |
69 | /*! | 69 | /*! |
70 | * this object must contain Incr(), Decr() and Shared() | 70 | * this object must contain Incr(), Decr() and Shared() |
@@ -74,13 +74,13 @@ template<class T> class osmart_pointer { | |||
74 | T *ptr; | 74 | T *ptr; |
75 | public: | 75 | public: |
76 | //! standart constructor | 76 | //! standart constructor |
77 | osmart_pointer() { ptr = NULL; } | 77 | OSmartPointer() { ptr = NULL; } |
78 | //! standart destructor | 78 | //! standart destructor |
79 | /*! | 79 | /*! |
80 | * release the reference, if it were the last reference, destroys | 80 | * release the reference, if it were the last reference, destroys |
81 | * ptr | 81 | * ptr |
82 | */ | 82 | */ |
83 | ~osmart_pointer() | 83 | ~OSmartPointer() |
84 | { | 84 | { |
85 | if (ptr){ | 85 | if (ptr){ |
86 | ptr->Decr(); | 86 | ptr->Decr(); |
@@ -89,12 +89,12 @@ public: | |||
89 | } | 89 | } |
90 | } | 90 | } |
91 | //! construction | 91 | //! construction |
92 | osmart_pointer(T* t) { if (ptr = t) ptr->Incr(); } | 92 | OSmartPointer(T* t) { if (ptr = t) ptr->Incr(); } |
93 | //! Pointer copy | 93 | //! Pointer copy |
94 | osmart_pointer(const osmart_pointer<T>& p) | 94 | OSmartPointer(const OSmartPointer<T>& p) |
95 | { if (ptr = p.ptr) ptr->Incr(); } | 95 | { if (ptr = p.ptr) ptr->Incr(); } |
96 | //! pointer copy by assignment | 96 | //! pointer copy by assignment |
97 | osmart_pointer<T>& operator= (const osmart_pointer<T>& p) | 97 | OSmartPointer<T>& operator= (const OSmartPointer<T>& p) |
98 | { | 98 | { |
99 | // already same: nothing to do | 99 | // already same: nothing to do |
100 | if (ptr == p.ptr) return *this; | 100 | if (ptr == p.ptr) return *this; |
@@ -104,7 +104,7 @@ public: | |||
104 | if (ptr = p.ptr) ptr->Incr(); | 104 | if (ptr = p.ptr) ptr->Incr(); |
105 | return *this; | 105 | return *this; |
106 | } | 106 | } |
107 | osmart_pointer<T>& operator= (T*p) | 107 | OSmartPointer<T>& operator= (T*p) |
108 | { | 108 | { |
109 | if (ptr==p)return *this; | 109 | if (ptr==p)return *this; |
110 | if (ptr) { | 110 | if (ptr) { |
@@ -142,3 +142,4 @@ public: | |||
142 | } | 142 | } |
143 | 143 | ||
144 | #endif | 144 | #endif |
145 | |||