aboutsummaryrefslogtreecommitdiff
path: root/src/sptr.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/sptr.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/sptr.h b/src/sptr.h
index faa8524..4baa697 100644
--- a/src/sptr.h
+++ b/src/sptr.h
@@ -45,31 +45,55 @@ namespace Bu
45 } 45 }
46 } 46 }
47 47
48 /**
49 * Get the number of references to this pointer.
50 *@returns (int32_t) The number of references to this pointer.
51 */
48 int32_t count() const 52 int32_t count() const
49 { 53 {
50 return *pRefCnt; 54 return *pRefCnt;
51 } 55 }
52 56
57 /**
58 * Pointer access operator.
59 *@returns (const T *)
60 */
53 const T *operator->() const 61 const T *operator->() const
54 { 62 {
55 return pData; 63 return pData;
56 } 64 }
57 65
66 /**
67 * Dereference operator.
68 *@returns (const T &) The value at the end of the pointer.
69 */
58 const T &operator*() const 70 const T &operator*() const
59 { 71 {
60 return *pData; 72 return *pData;
61 } 73 }
62 74
75 /**
76 * Pointer access operator.
77 *@returns (T *)
78 */
63 T *operator->() 79 T *operator->()
64 { 80 {
65 return pData; 81 return pData;
66 } 82 }
67 83
84 /**
85 * Dereference operator.
86 *@returns (T &) The value at the end of the pointer.
87 */
68 T &operator*() 88 T &operator*()
69 { 89 {
70 return *pData; 90 return *pData;
71 } 91 }
72 92
93 /**
94 * Assignment operator.
95 *@param src (const SPtr<T> &)
96 */
73 SPtr<T> operator=( const SPtr<T> &src ) 97 SPtr<T> operator=( const SPtr<T> &src )
74 { 98 {
75 decCount(); 99 decCount();
@@ -81,6 +105,10 @@ namespace Bu
81 return *this; 105 return *this;
82 } 106 }
83 107
108 /**
109 * Assignment operator.
110 *@param src (const SPtr<T> &)
111 */
84 const SPtr<T> operator=( const SPtr<T> &src ) const 112 const SPtr<T> operator=( const SPtr<T> &src ) const
85 { 113 {
86 decCount(); 114 decCount();
@@ -92,21 +120,38 @@ namespace Bu
92 return *this; 120 return *this;
93 } 121 }
94 122
123 /**
124 * Equals comparison operator.
125 *@param src (const SPtr<T> &) The SPtr to compare to.
126 *@returns (bool) Are the equal?
127 */
95 bool operator==( const SPtr<T> &src ) const 128 bool operator==( const SPtr<T> &src ) const
96 { 129 {
97 return pData == src.pData; 130 return pData == src.pData;
98 } 131 }
99 132
133 /**
134 * Equals comparison operator.
135 *@param src (const T *) The pointer to compare to.
136 *@returns (bool) Are the equal?
137 */
100 bool operator==( const T *src ) const 138 bool operator==( const T *src ) const
101 { 139 {
102 return pData == src; 140 return pData == src;
103 } 141 }
104 142
143 /**
144 * Boolean cast operator. Do we have a pointer?
145 */
105 operator bool() const 146 operator bool() const
106 { 147 {
107 return pRefCnt != NULL; 148 return pRefCnt != NULL;
108 } 149 }
109 150
151 /**
152 * Do we have a pointer?
153 *@returns (bool) Do we have a pointer?
154 */
110 bool isSet() const 155 bool isSet() const
111 { 156 {
112 return pRefCnt != NULL; 157 return pRefCnt != NULL;