/src/aspell/common/copy_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__copy_ptr |
14 | | #define autil__copy_ptr |
15 | | |
16 | | #include "generic_copy_ptr-t.hpp" |
17 | | |
18 | | namespace acommon { |
19 | | |
20 | | template <typename T> |
21 | | class CopyPtr |
22 | | { |
23 | | struct Parms { |
24 | | T * clone(const T * ptr) const |
25 | 0 | { return new T(*ptr);} |
26 | | void assign(T * & rhs, const T * lhs) const |
27 | 0 | { *rhs = *lhs; } |
28 | | void del(T * ptr) |
29 | 16.4k | { delete ptr; } acommon::CopyPtr<acommon::Error>::Parms::del(acommon::Error*) Line | Count | Source | 29 | 9.39k | { delete ptr; } |
acommon::CopyPtr<acommon::Tokenizer>::Parms::del(acommon::Tokenizer*) Line | Count | Source | 29 | 694 | { delete ptr; } |
acommon::CopyPtr<acommon::Filter>::Parms::del(acommon::Filter*) Line | Count | Source | 29 | 694 | { delete ptr; } |
Unexecuted instantiation: acommon::CopyPtr<aspeller::SensitiveCompare>::Parms::del(aspeller::SensitiveCompare*) acommon::CopyPtr<acommon::Config>::Parms::del(acommon::Config*) Line | Count | Source | 29 | 739 | { delete ptr; } |
acommon::CopyPtr<aspeller::Dictionary::Id>::Parms::del(aspeller::Dictionary::Id*) Line | Count | Source | 29 | 4.97k | { delete ptr; } |
|
30 | | |
31 | | }; |
32 | | GenericCopyPtr<T, Parms> impl; |
33 | | |
34 | | public: |
35 | | |
36 | 20.9k | explicit CopyPtr(T * p = 0) : impl(p) {} acommon::CopyPtr<acommon::Error>::CopyPtr(acommon::Error*) Line | Count | Source | 36 | 13.0k | explicit CopyPtr(T * p = 0) : impl(p) {} |
acommon::CopyPtr<acommon::Filter>::CopyPtr(acommon::Filter*) Line | Count | Source | 36 | 696 | explicit CopyPtr(T * p = 0) : impl(p) {} |
acommon::CopyPtr<acommon::Tokenizer>::CopyPtr(acommon::Tokenizer*) Line | Count | Source | 36 | 696 | explicit CopyPtr(T * p = 0) : impl(p) {} |
acommon::CopyPtr<aspeller::SensitiveCompare>::CopyPtr(aspeller::SensitiveCompare*) Line | Count | Source | 36 | 739 | explicit CopyPtr(T * p = 0) : impl(p) {} |
acommon::CopyPtr<acommon::Config>::CopyPtr(acommon::Config*) Line | Count | Source | 36 | 739 | explicit CopyPtr(T * p = 0) : impl(p) {} |
acommon::CopyPtr<aspeller::Dictionary::Id>::CopyPtr(aspeller::Dictionary::Id*) Line | Count | Source | 36 | 4.97k | explicit CopyPtr(T * p = 0) : impl(p) {} |
|
37 | 0 | CopyPtr(const CopyPtr & other) : impl(other.impl) {} |
38 | | |
39 | 0 | CopyPtr & operator=(const CopyPtr & other) { |
40 | 0 | impl = other.impl; |
41 | 0 | return *this; |
42 | 0 | } |
43 | | |
44 | | void assign(const T * other) {impl.assign(other);} |
45 | 38.5k | void reset(T * other = 0) {impl.reset(other);} acommon::CopyPtr<acommon::Error>::reset(acommon::Error*) Line | Count | Source | 45 | 31.4k | void reset(T * other = 0) {impl.reset(other);} |
acommon::CopyPtr<acommon::Tokenizer>::reset(acommon::Tokenizer*) Line | Count | Source | 45 | 694 | void reset(T * other = 0) {impl.reset(other);} |
acommon::CopyPtr<acommon::Filter>::reset(acommon::Filter*) Line | Count | Source | 45 | 694 | void reset(T * other = 0) {impl.reset(other);} |
acommon::CopyPtr<acommon::Config>::reset(acommon::Config*) Line | Count | Source | 45 | 739 | void reset(T * other = 0) {impl.reset(other);} |
acommon::CopyPtr<aspeller::Dictionary::Id>::reset(aspeller::Dictionary::Id*) Line | Count | Source | 45 | 4.97k | void reset(T * other = 0) {impl.reset(other);} |
|
46 | | |
47 | 40.3k | T & operator* () const {return *impl;} acommon::CopyPtr<aspeller::Dictionary::Id>::operator*() const Line | Count | Source | 47 | 31.8k | T & operator* () const {return *impl;} |
acommon::CopyPtr<acommon::Config>::operator*() const Line | Count | Source | 47 | 8.57k | T & operator* () const {return *impl;} |
Unexecuted instantiation: acommon::CopyPtr<aspeller::SensitiveCompare>::operator*() const |
48 | 181k | T * operator-> () const {return impl;} Unexecuted instantiation: acommon::CopyPtr<acommon::Error>::operator->() const acommon::CopyPtr<acommon::Filter>::operator->() const Line | Count | Source | 48 | 694 | T * operator-> () const {return impl;} |
acommon::CopyPtr<acommon::Tokenizer>::operator->() const Line | Count | Source | 48 | 167k | T * operator-> () const {return impl;} |
acommon::CopyPtr<acommon::Config>::operator->() const Line | Count | Source | 48 | 13.5k | T * operator-> () const {return impl;} |
Unexecuted instantiation: acommon::CopyPtr<aspeller::Dictionary::Id>::operator->() const |
49 | | T * get() const {return impl;} |
50 | 39.2k | operator T * () const {return impl;} acommon::CopyPtr<acommon::Filter>::operator acommon::Filter*() const Line | Count | Source | 50 | 694 | operator T * () const {return impl;} |
acommon::CopyPtr<acommon::Error>::operator acommon::Error*() const Line | Count | Source | 50 | 32.8k | operator T * () const {return impl;} |
acommon::CopyPtr<acommon::Config>::operator acommon::Config*() const Line | Count | Source | 50 | 5.64k | operator T * () const {return impl;} |
|
51 | | |
52 | | T * release() {return impl.release();} |
53 | | }; |
54 | | |
55 | | } |
56 | | |
57 | | #endif |
58 | | |