/src/aspell/common/clone_ptr.hpp
Line | Count | Source (jump to first uncovered line) |
1 | | // Copyright (c) 2001 |
2 | | // Kevin Atkinson |
3 | | // |
4 | | // Permission to use, copy, modify, distribute and sell this software |
5 | | // and its documentation for any purpose is hereby granted without |
6 | | // fee, provided that the above copyright notice appear in all copies |
7 | | // and that both that copyright notice and this permission notice |
8 | | // appear in supporting documentation. Kevin Atkinson makes no |
9 | | // representations about the suitability of this software for any |
10 | | // purpose. It is provided "as is" without express or implied |
11 | | // warranty. |
12 | | |
13 | | #ifndef autil__clone_ptr |
14 | | #define autil__clone_ptr |
15 | | |
16 | | #include "generic_copy_ptr.hpp" |
17 | | |
18 | | namespace acommon { |
19 | | |
20 | | template <typename T> |
21 | | class ClonePtr |
22 | | { |
23 | | struct Parms { |
24 | | T * clone(const T * ptr) const; |
25 | | void assign(T * & rhs, const T * lhs) const; |
26 | | void del(T * ptr); |
27 | | }; |
28 | | GenericCopyPtr<T, Parms> impl; |
29 | | |
30 | | public: |
31 | | |
32 | 4.17k | explicit ClonePtr(T * p = 0) : impl(p) {} acommon::ClonePtr<aspeller::Suggest>::ClonePtr(aspeller::Suggest*) Line | Count | Source | 32 | 2.08k | explicit ClonePtr(T * p = 0) : impl(p) {} |
acommon::ClonePtr<acommon::Convert>::ClonePtr(acommon::Convert*) Line | Count | Source | 32 | 2.08k | explicit ClonePtr(T * p = 0) : impl(p) {} |
Unexecuted instantiation: acommon::ClonePtr<acommon::Enumeration<aspeller::WordEntry*> >::ClonePtr(acommon::Enumeration<aspeller::WordEntry*>*) |
33 | 0 | ClonePtr(const ClonePtr & other) : impl(other.impl) {} |
34 | | |
35 | 0 | ClonePtr & operator=(const ClonePtr & other) { |
36 | 0 | impl = other.impl; |
37 | 0 | return *this; |
38 | 0 | } |
39 | | |
40 | | void assign(const T * other) {impl.assign(other);} |
41 | 4.02k | void reset(T * other = 0) {impl.reset(other);} acommon::ClonePtr<acommon::Convert>::reset(acommon::Convert*) Line | Count | Source | 41 | 2.01k | void reset(T * other = 0) {impl.reset(other);} |
acommon::ClonePtr<aspeller::Suggest>::reset(aspeller::Suggest*) Line | Count | Source | 41 | 2.00k | void reset(T * other = 0) {impl.reset(other);} |
|
42 | | |
43 | | T & operator* () const {return *impl;} |
44 | 57.7k | T * operator-> () const {return impl;} acommon::ClonePtr<acommon::Convert>::operator->() const Line | Count | Source | 44 | 39.8k | T * operator-> () const {return impl;} |
acommon::ClonePtr<aspeller::Suggest>::operator->() const Line | Count | Source | 44 | 17.9k | T * operator-> () const {return impl;} |
Unexecuted instantiation: acommon::ClonePtr<acommon::Enumeration<aspeller::WordEntry*> >::operator->() const |
45 | | T * get() const {return impl;} |
46 | 19.8k | operator T * () const {return impl;} |
47 | | |
48 | | T * release() {return impl.release();} |
49 | | }; |
50 | | |
51 | | } |
52 | | |
53 | | #endif |
54 | | |