/src/aspell/common/posib_err.hpp
Line | Count | Source |
1 | | // This file is part of The New Aspell |
2 | | // Copyright (C) 2001 by Kevin Atkinson under the GNU LGPL license |
3 | | // version 2.0 or 2.1. You should have received a copy of the LGPL |
4 | | // license along with this library if you did not you can find |
5 | | // it at http://www.gnu.org/. |
6 | | |
7 | | #ifndef PCOMMON_POSIB_ERR__HPP |
8 | | #define PCOMMON_POSIB_ERR__HPP |
9 | | |
10 | | #include "string.hpp" |
11 | | #include "error.hpp" |
12 | | |
13 | | #include "errors.hpp" |
14 | | |
15 | | #include "ndebug.hpp" |
16 | | |
17 | | namespace acommon { |
18 | | |
19 | | // PosibErr<type> is a special Error handling device that will make |
20 | | // sure that an error is properly handled. It is expected to be |
21 | | // used as the return type of the function It will automatically |
22 | | // convert to the "normal" return type however if the normal |
23 | | // returned type is accessed and there is an "unhandled" error |
24 | | // condition it will abort It will also abort if the object is |
25 | | // destroyed with an "unhandled" error condition. This includes |
26 | | // ignoring the return type of a function returning an error |
27 | | // condition. An error condition is handled by simply checking for |
28 | | // the presence of an error, calling ignore, or taking ownership of |
29 | | // the error. |
30 | | |
31 | | enum WhichErr { PrimErr, SecErr }; |
32 | | |
33 | | extern "C" const ErrorInfo * const perror_bad_file_format; |
34 | | |
35 | | template <typename Ret> class PosibErr; |
36 | | |
37 | | class PosibErrBase { |
38 | | private: |
39 | | struct ErrPtr { |
40 | | const Error * err; |
41 | | #ifndef NDEBUG |
42 | | bool handled; |
43 | | #endif |
44 | | int refcount; |
45 | 32.4k | ErrPtr(const Error * e) : err(e), |
46 | | #ifndef NDEBUG |
47 | 32.4k | handled(false), |
48 | | #endif |
49 | 32.4k | refcount(1) {} |
50 | | }; |
51 | | ErrPtr * err_; |
52 | | |
53 | | protected: |
54 | | |
55 | 233k | void posib_handle_err() const { |
56 | 233k | #ifndef NDEBUG |
57 | 233k | if (err_ && !err_->handled) |
58 | 0 | handle_err(); |
59 | 233k | #endif |
60 | 233k | } |
61 | | |
62 | 1.42M | void copy(const PosibErrBase & other) { |
63 | 1.42M | err_ = other.err_; |
64 | 1.42M | if (err_) { |
65 | 147k | ++ err_->refcount; |
66 | 147k | } |
67 | 1.42M | } |
68 | 2.17M | void destroy() { |
69 | 2.17M | if (err_ == 0) return; |
70 | 167k | -- err_->refcount; |
71 | 167k | if (err_->refcount == 0) { |
72 | 20.0k | #ifndef NDEBUG |
73 | 20.0k | if (!err_->handled) |
74 | 0 | handle_err(); |
75 | 20.0k | #endif |
76 | 20.0k | del(); |
77 | 20.0k | } |
78 | 167k | } |
79 | | |
80 | | public: |
81 | | PosibErrBase() |
82 | 748k | : err_(0) {} |
83 | | PosibErrBase(const PosibErrBase & other) |
84 | 1.41M | { |
85 | 1.41M | copy(other); |
86 | 1.41M | } |
87 | 1.07k | PosibErrBase& operator= (const PosibErrBase & other) { |
88 | 1.07k | destroy(); |
89 | 1.07k | copy(other); |
90 | 1.07k | return *this; |
91 | 1.07k | } |
92 | 2.16M | ~PosibErrBase() { |
93 | 2.16M | destroy(); |
94 | 2.16M | } |
95 | | |
96 | 27.9k | Error * release_err() { |
97 | 27.9k | if (err_ == 0) |
98 | 15.4k | return 0; |
99 | 12.4k | else |
100 | 12.4k | return release(); |
101 | 27.9k | } |
102 | 9.17k | void ignore_err() { |
103 | 9.17k | #ifndef NDEBUG |
104 | 9.17k | if (err_ != 0) |
105 | 6.42k | err_->handled = true; |
106 | 9.17k | #endif |
107 | 9.17k | } |
108 | 34.1k | const Error * get_err() const { |
109 | 34.1k | if (err_ == 0) { |
110 | 23.4k | return 0; |
111 | 23.4k | } else { |
112 | 10.6k | #ifndef NDEBUG |
113 | 10.6k | err_->handled = true; |
114 | 10.6k | #endif |
115 | 10.6k | return err_->err; |
116 | 10.6k | } |
117 | 34.1k | } |
118 | 0 | const Error * prvw_err() const { |
119 | 0 | if (err_ == 0) |
120 | 0 | return 0; |
121 | 0 | else |
122 | 0 | return err_->err; |
123 | 0 | } |
124 | 790k | bool has_err() const { |
125 | 790k | return err_ != 0; |
126 | 790k | } |
127 | 3.61k | bool has_err(const ErrorInfo * e) const { |
128 | 3.61k | if (err_ == 0) { |
129 | 691 | return false; |
130 | 2.92k | } else { |
131 | 2.92k | if (err_->err->is_a(e)) { |
132 | 2.92k | #ifndef NDEBUG |
133 | 2.92k | err_->handled = true; |
134 | 2.92k | #endif |
135 | 2.92k | return true; |
136 | 2.92k | } else { |
137 | 0 | return false; |
138 | 0 | } |
139 | 2.92k | } |
140 | 3.61k | } |
141 | | PosibErrBase & prim_err(const ErrorInfo * inf, ParmString p1 = 0, |
142 | | ParmString p2 = 0, ParmString p3 = 0, |
143 | | ParmString p4 = 0) |
144 | 32.4k | { |
145 | 32.4k | return set(inf, p1, p2, p3, p4); |
146 | 32.4k | } |
147 | | |
148 | | // These should only be called _after_ set is called |
149 | | PosibErrBase & with_file(ParmString fn, int lineno = 0); |
150 | | PosibErrBase & with_key(ParmString prefix, ParmString key); |
151 | | |
152 | | PosibErrBase & set(const ErrorInfo *, |
153 | | ParmString, ParmString, ParmString, ParmString); |
154 | | |
155 | | private: |
156 | | |
157 | | #ifndef NDEBUG |
158 | | void handle_err() const; |
159 | | #endif |
160 | | Error * release(); |
161 | | void del(); |
162 | | }; |
163 | | |
164 | | template <> |
165 | | class PosibErr<void> : public PosibErrBase |
166 | | { |
167 | | public: |
168 | | PosibErr(const PosibErrBase & other) |
169 | 35.4k | : PosibErrBase(other) {} |
170 | | |
171 | 1.13k | PosibErr() {} |
172 | | }; |
173 | | |
174 | | template <typename Ret> |
175 | | class PosibErr : public PosibErrBase |
176 | | { |
177 | | public: |
178 | 10.2k | PosibErr() : data() {}acommon::PosibErr<acommon::KeyInfo const*>::PosibErr() Line | Count | Source | 178 | 8.18k | PosibErr() : data() {} |
acommon::PosibErr<bool>::PosibErr() Line | Count | Source | 178 | 648 | PosibErr() : data() {} |
acommon::PosibErr<acommon::Convert*>::PosibErr() Line | Count | Source | 178 | 691 | PosibErr() : data() {} |
acommon::PosibErr<aspeller::Suggest*>::PosibErr() Line | Count | Source | 178 | 682 | PosibErr() : data() {} |
|
179 | | |
180 | | PosibErr(const PosibErrBase & other) |
181 | 30.7k | : PosibErrBase(other), data() {}acommon::PosibErr<acommon::DocumentChecker*>::PosibErr(acommon::PosibErrBase const&) Line | Count | Source | 181 | 6 | : PosibErrBase(other), data() {} |
Unexecuted instantiation: acommon::PosibErr<acommon::String>::PosibErr(acommon::PosibErrBase const&) Unexecuted instantiation: acommon::PosibErr<acommon::Config::Value>::PosibErr(acommon::PosibErrBase const&) acommon::PosibErr<bool>::PosibErr(acommon::PosibErrBase const&) Line | Count | Source | 181 | 45 | : PosibErrBase(other), data() {} |
acommon::PosibErr<int>::PosibErr(acommon::PosibErrBase const&) Line | Count | Source | 181 | 14.7k | : PosibErrBase(other), data() {} |
acommon::PosibErr<acommon::KeyInfo const*>::PosibErr(acommon::PosibErrBase const&) Line | Count | Source | 181 | 8.94k | : PosibErrBase(other), data() {} |
Unexecuted instantiation: acommon::PosibErr<acommon::NormTable<acommon::FromUniNormEntry>*>::PosibErr(acommon::PosibErrBase const&) Unexecuted instantiation: acommon::PosibErr<acommon::NormTable<acommon::ToUniNormEntry>*>::PosibErr(acommon::PosibErrBase const&) Unexecuted instantiation: acommon::PosibErr<acommon::NormTables*>::PosibErr(acommon::PosibErrBase const&) acommon::PosibErr<acommon::Convert*>::PosibErr(acommon::PosibErrBase const&) Line | Count | Source | 181 | 9 | : PosibErrBase(other), data() {} |
acommon::PosibErr<acommon::Decode*>::PosibErr(acommon::PosibErrBase const&) Line | Count | Source | 181 | 9 | : PosibErrBase(other), data() {} |
Unexecuted instantiation: acommon::PosibErr<acommon::Encode*>::PosibErr(acommon::PosibErrBase const&) acommon::PosibErr<acommon::ConfigModule const*>::PosibErr(acommon::PosibErrBase const&) Line | Count | Source | 181 | 3.38k | : PosibErrBase(other), data() {} |
acommon::PosibErr<acommon::ConfigFilterModule*>::PosibErr(acommon::PosibErrBase const&) Line | Count | Source | 181 | 3.38k | : PosibErrBase(other), data() {} |
Unexecuted instantiation: acommon::PosibErr<acommon::FilterModeList*>::PosibErr(acommon::PosibErrBase const&) Unexecuted instantiation: acommon::PosibErr<acommon::StringPairEnumeration*>::PosibErr(acommon::PosibErrBase const&) acommon::PosibErr<acommon::Config*>::PosibErr(acommon::PosibErrBase const&) Line | Count | Source | 181 | 53 | : PosibErrBase(other), data() {} |
acommon::PosibErr<acommon::Speller*>::PosibErr(acommon::PosibErrBase const&) Line | Count | Source | 181 | 100 | : PosibErrBase(other), data() {} |
acommon::PosibErr<char const*>::PosibErr(acommon::PosibErrBase const&) Line | Count | Source | 181 | 6 | : PosibErrBase(other), data() {} |
acommon::PosibErr<acommon::MDInfoListAll const*>::PosibErr(acommon::PosibErrBase const&) Line | Count | Source | 181 | 6 | : PosibErrBase(other), data() {} |
acommon::PosibErr<acommon::ModuleInfoList const*>::PosibErr(acommon::PosibErrBase const&) Line | Count | Source | 181 | 6 | : PosibErrBase(other), data() {} |
Unexecuted instantiation: acommon::PosibErr<acommon::DictInfoList const*>::PosibErr(acommon::PosibErrBase const&) Unexecuted instantiation: acommon::PosibErr<acommon::StringMap const*>::PosibErr(acommon::PosibErrBase const&) Unexecuted instantiation: acommon::PosibErr<acommon::WordList const*>::PosibErr(acommon::PosibErrBase const&) Unexecuted instantiation: acommon::PosibErr<aspeller::Language*>::PosibErr(acommon::PosibErrBase const&) Unexecuted instantiation: acommon::PosibErr<aspeller::AffixMgr*>::PosibErr(acommon::PosibErrBase const&) acommon::PosibErr<aspeller::Suggest*>::PosibErr(acommon::PosibErrBase const&) Line | Count | Source | 181 | 2 | : PosibErrBase(other), data() {} |
acommon::PosibErr<aspeller::Dictionary*>::PosibErr(acommon::PosibErrBase const&) Line | Count | Source | 181 | 29 | : PosibErrBase(other), data() {} |
Unexecuted instantiation: acommon::PosibErr<aspeller::Soundslike*>::PosibErr(acommon::PosibErrBase const&) Unexecuted instantiation: acommon::PosibErr<aspeller::PhonetParms*>::PosibErr(acommon::PosibErrBase const&) Unexecuted instantiation: acommon::PosibErr<char*>::PosibErr(acommon::PosibErrBase const&) Unexecuted instantiation: acommon::PosibErr<aspeller::TypoEditDistanceInfo*>::PosibErr(acommon::PosibErrBase const&) |
182 | | |
183 | | template <typename T> |
184 | | PosibErr(const PosibErr<T> & other) |
185 | 0 | : PosibErrBase(other), data(other.data) {}Unexecuted instantiation: acommon::PosibErr<unsigned int>::PosibErr<int>(acommon::PosibErr<int> const&) Unexecuted instantiation: acommon::PosibErr<bool>::PosibErr<char const*>(acommon::PosibErr<char const*> const&) |
186 | | |
187 | | PosibErr(const PosibErr<void> & other) |
188 | 0 | : PosibErrBase(other), data() {}Unexecuted instantiation: acommon::PosibErr<int>::PosibErr(acommon::PosibErr<void> const&) Unexecuted instantiation: acommon::PosibErr<bool>::PosibErr(acommon::PosibErr<void> const&) |
189 | | |
190 | 4.87k | PosibErr& operator= (const PosibErr & other) { |
191 | 4.87k | data = other.data; |
192 | 4.87k | PosibErrBase::destroy(); |
193 | 4.87k | PosibErrBase::copy(other); |
194 | 4.87k | return *this; |
195 | 4.87k | } acommon::PosibErr<acommon::KeyInfo const*>::operator=(acommon::PosibErr<acommon::KeyInfo const*> const&) Line | Count | Source | 190 | 762 | PosibErr& operator= (const PosibErr & other) { | 191 | 762 | data = other.data; | 192 | 762 | PosibErrBase::destroy(); | 193 | 762 | PosibErrBase::copy(other); | 194 | 762 | return *this; | 195 | 762 | } |
acommon::PosibErr<bool>::operator=(acommon::PosibErr<bool> const&) Line | Count | Source | 190 | 648 | PosibErr& operator= (const PosibErr & other) { | 191 | 648 | data = other.data; | 192 | 648 | PosibErrBase::destroy(); | 193 | 648 | PosibErrBase::copy(other); | 194 | 648 | return *this; | 195 | 648 | } |
acommon::PosibErr<acommon::String>::operator=(acommon::PosibErr<acommon::String> const&) Line | Count | Source | 190 | 732 | PosibErr& operator= (const PosibErr & other) { | 191 | 732 | data = other.data; | 192 | 732 | PosibErrBase::destroy(); | 193 | 732 | PosibErrBase::copy(other); | 194 | 732 | return *this; | 195 | 732 | } |
acommon::PosibErr<acommon::Convert*>::operator=(acommon::PosibErr<acommon::Convert*> const&) Line | Count | Source | 190 | 1.37k | PosibErr& operator= (const PosibErr & other) { | 191 | 1.37k | data = other.data; | 192 | 1.37k | PosibErrBase::destroy(); | 193 | 1.37k | PosibErrBase::copy(other); | 194 | 1.37k | return *this; | 195 | 1.37k | } |
acommon::PosibErr<aspeller::Suggest*>::operator=(acommon::PosibErr<aspeller::Suggest*> const&) Line | Count | Source | 190 | 1.36k | PosibErr& operator= (const PosibErr & other) { | 191 | 1.36k | data = other.data; | 192 | 1.36k | PosibErrBase::destroy(); | 193 | 1.36k | PosibErrBase::copy(other); | 194 | 1.36k | return *this; | 195 | 1.36k | } |
|
196 | 712k | PosibErr(const Ret & d) : data(d) {}acommon::PosibErr<acommon::String>::PosibErr(acommon::String const&) Line | Count | Source | 196 | 57.0k | PosibErr(const Ret & d) : data(d) {} |
acommon::PosibErr<acommon::Config::Value>::PosibErr(acommon::Config::Value const&) Line | Count | Source | 196 | 1.38k | PosibErr(const Ret & d) : data(d) {} |
acommon::PosibErr<int>::PosibErr(int const&) Line | Count | Source | 196 | 85.1k | PosibErr(const Ret & d) : data(d) {} |
acommon::PosibErr<acommon::DocumentChecker*>::PosibErr(acommon::DocumentChecker* const&) Line | Count | Source | 196 | 667 | PosibErr(const Ret & d) : data(d) {} |
acommon::PosibErr<bool>::PosibErr(bool const&) Line | Count | Source | 196 | 243k | PosibErr(const Ret & d) : data(d) {} |
acommon::PosibErr<acommon::KeyInfo const*>::PosibErr(acommon::KeyInfo const* const&) Line | Count | Source | 196 | 211k | PosibErr(const Ret & d) : data(d) {} |
acommon::PosibErr<acommon::NormTable<acommon::FromUniNormEntry>*>::PosibErr(acommon::NormTable<acommon::FromUniNormEntry>* const&) Line | Count | Source | 196 | 21.7k | PosibErr(const Ret & d) : data(d) {} |
acommon::PosibErr<acommon::NormTable<acommon::ToUniNormEntry>*>::PosibErr(acommon::NormTable<acommon::ToUniNormEntry>* const&) Line | Count | Source | 196 | 1.27k | PosibErr(const Ret & d) : data(d) {} |
acommon::PosibErr<acommon::NormTables*>::PosibErr(acommon::NormTables* const&) Line | Count | Source | 196 | 8.26k | PosibErr(const Ret & d) : data(d) {} |
acommon::PosibErr<acommon::Convert*>::PosibErr(acommon::Convert* const&) Line | Count | Source | 196 | 13.8k | PosibErr(const Ret & d) : data(d) {} |
acommon::PosibErr<acommon::Decode*>::PosibErr(acommon::Decode* const&) Line | Count | Source | 196 | 3.97k | PosibErr(const Ret & d) : data(d) {} |
acommon::PosibErr<acommon::Encode*>::PosibErr(acommon::Encode* const&) Line | Count | Source | 196 | 7.82k | PosibErr(const Ret & d) : data(d) {} |
acommon::PosibErr<acommon::Tokenizer*>::PosibErr(acommon::Tokenizer* const&) Line | Count | Source | 196 | 673 | PosibErr(const Ret & d) : data(d) {} |
Unexecuted instantiation: acommon::PosibErr<acommon::ConfigModule const*>::PosibErr(acommon::ConfigModule const* const&) Unexecuted instantiation: acommon::PosibErr<acommon::ConfigFilterModule*>::PosibErr(acommon::ConfigFilterModule* const&) Unexecuted instantiation: acommon::PosibErr<acommon::StringPairEnumeration*>::PosibErr(acommon::StringPairEnumeration* const&) acommon::PosibErr<acommon::FilterModeList*>::PosibErr(acommon::FilterModeList* const&) Line | Count | Source | 196 | 12.1k | PosibErr(const Ret & d) : data(d) {} |
acommon::PosibErr<acommon::Speller*>::PosibErr(acommon::Speller* const&) Line | Count | Source | 196 | 1.39k | PosibErr(const Ret & d) : data(d) {} |
acommon::PosibErr<acommon::Config*>::PosibErr(acommon::Config* const&) Line | Count | Source | 196 | 720 | PosibErr(const Ret & d) : data(d) {} |
acommon::PosibErr<char const*>::PosibErr(char const* const&) Line | Count | Source | 196 | 1.15k | PosibErr(const Ret & d) : data(d) {} |
acommon::PosibErr<acommon::MDInfoListAll const*>::PosibErr(acommon::MDInfoListAll const* const&) Line | Count | Source | 196 | 2.18k | PosibErr(const Ret & d) : data(d) {} |
acommon::PosibErr<acommon::ModuleInfoList const*>::PosibErr(acommon::ModuleInfoList const* const&) Line | Count | Source | 196 | 732 | PosibErr(const Ret & d) : data(d) {} |
acommon::PosibErr<acommon::DictInfoList const*>::PosibErr(acommon::DictInfoList const* const&) Line | Count | Source | 196 | 732 | PosibErr(const Ret & d) : data(d) {} |
acommon::PosibErr<acommon::StringMap const*>::PosibErr(acommon::StringMap const* const&) Line | Count | Source | 196 | 720 | PosibErr(const Ret & d) : data(d) {} |
acommon::PosibErr<acommon::WordList const*>::PosibErr(acommon::WordList const* const&) Line | Count | Source | 196 | 6.92k | PosibErr(const Ret & d) : data(d) {} |
acommon::PosibErr<aspeller::Language*>::PosibErr(aspeller::Language* const&) Line | Count | Source | 196 | 5.50k | PosibErr(const Ret & d) : data(d) {} |
acommon::PosibErr<aspeller::AffixMgr*>::PosibErr(aspeller::AffixMgr* const&) Line | Count | Source | 196 | 691 | PosibErr(const Ret & d) : data(d) {} |
acommon::PosibErr<aspeller::Suggest*>::PosibErr(aspeller::Suggest* const&) Line | Count | Source | 196 | 1.36k | PosibErr(const Ret & d) : data(d) {} |
acommon::PosibErr<aspeller::Dictionary*>::PosibErr(aspeller::Dictionary* const&) Line | Count | Source | 196 | 2.74k | PosibErr(const Ret & d) : data(d) {} |
acommon::PosibErr<aspeller::Soundslike*>::PosibErr(aspeller::Soundslike* const&) Line | Count | Source | 196 | 691 | PosibErr(const Ret & d) : data(d) {} |
acommon::PosibErr<aspeller::PhonetParms*>::PosibErr(aspeller::PhonetParms* const&) Line | Count | Source | 196 | 674 | PosibErr(const Ret & d) : data(d) {} |
acommon::PosibErr<char*>::PosibErr(char* const&) Line | Count | Source | 196 | 15.5k | PosibErr(const Ret & d) : data(d) {} |
acommon::PosibErr<aspeller::TypoEditDistanceInfo*>::PosibErr(aspeller::TypoEditDistanceInfo* const&) Line | Count | Source | 196 | 2.03k | PosibErr(const Ret & d) : data(d) {} |
|
197 | 233k | operator const Ret & () const {posib_handle_err(); return data;}acommon::PosibErr<acommon::DocumentChecker*>::operator acommon::DocumentChecker* const&() const Line | Count | Source | 197 | 667 | operator const Ret & () const {posib_handle_err(); return data;} |
acommon::PosibErr<acommon::Speller*>::operator acommon::Speller* const&() const Line | Count | Source | 197 | 1.39k | operator const Ret & () const {posib_handle_err(); return data;} |
acommon::PosibErr<int>::operator int const&() const Line | Count | Source | 197 | 9.70k | operator const Ret & () const {posib_handle_err(); return data;} |
acommon::PosibErr<acommon::Tokenizer*>::operator acommon::Tokenizer* const&() const Line | Count | Source | 197 | 673 | operator const Ret & () const {posib_handle_err(); return data;} |
acommon::PosibErr<acommon::String>::operator acommon::String const&() const Line | Count | Source | 197 | 26.4k | operator const Ret & () const {posib_handle_err(); return data;} |
acommon::PosibErr<acommon::KeyInfo const*>::operator acommon::KeyInfo const* const&() const Line | Count | Source | 197 | 106k | operator const Ret & () const {posib_handle_err(); return data;} |
acommon::PosibErr<bool>::operator bool const&() const Line | Count | Source | 197 | 83.6k | operator const Ret & () const {posib_handle_err(); return data;} |
acommon::PosibErr<acommon::DictInfoList const*>::operator acommon::DictInfoList const* const&() const Line | Count | Source | 197 | 732 | operator const Ret & () const {posib_handle_err(); return data;} |
acommon::PosibErr<acommon::Config::Value>::operator acommon::Config::Value const&() const Line | Count | Source | 197 | 1.38k | operator const Ret & () const {posib_handle_err(); return data;} |
acommon::PosibErr<acommon::Convert*>::operator acommon::Convert* const&() const Line | Count | Source | 197 | 1.36k | operator const Ret & () const {posib_handle_err(); return data;} |
acommon::PosibErr<aspeller::PhonetParms*>::operator aspeller::PhonetParms* const&() const Line | Count | Source | 197 | 674 | operator const Ret & () const {posib_handle_err(); return data;} |
|
198 | | |
199 | | Ret data; |
200 | | }; |
201 | | |
202 | | // |
203 | | // |
204 | | // |
205 | | #define RET_ON_ERR_SET(command, type, var) \ |
206 | 112k | type var;do{PosibErr< type > pe(command);if(pe.has_err())return PosibErrBase(pe);var=pe.data;} while(false) |
207 | | #define RET_ON_ERR(command) \ |
208 | 348k | do{PosibErrBase pe(command);if(pe.has_err())return PosibErrBase(pe);}while(false) |
209 | | |
210 | | |
211 | | // |
212 | | // |
213 | | // |
214 | | |
215 | | static inline PosibErrBase make_err(const ErrorInfo * inf, |
216 | | ParmString p1 = 0, ParmString p2 = 0, |
217 | | ParmString p3 = 0, ParmString p4 = 0) |
218 | 24.2k | { |
219 | 24.2k | return PosibErrBase().prim_err(inf, p1, p2, p3, p4); |
220 | 24.2k | } Unexecuted instantiation: document_checker-c.cpp:acommon::make_err(acommon::ErrorInfo const*, acommon::ParmString, acommon::ParmString, acommon::ParmString, acommon::ParmString) Unexecuted instantiation: config-c.cpp:acommon::make_err(acommon::ErrorInfo const*, acommon::ParmString, acommon::ParmString, acommon::ParmString, acommon::ParmString) Unexecuted instantiation: string_enumeration-c.cpp:acommon::make_err(acommon::ErrorInfo const*, acommon::ParmString, acommon::ParmString, acommon::ParmString, acommon::ParmString) Unexecuted instantiation: speller-c.cpp:acommon::make_err(acommon::ErrorInfo const*, acommon::ParmString, acommon::ParmString, acommon::ParmString, acommon::ParmString) Unexecuted instantiation: new_checker.cpp:acommon::make_err(acommon::ErrorInfo const*, acommon::ParmString, acommon::ParmString, acommon::ParmString, acommon::ParmString) config.cpp:acommon::make_err(acommon::ErrorInfo const*, acommon::ParmString, acommon::ParmString, acommon::ParmString, acommon::ParmString) Line | Count | Source | 218 | 1.27k | { | 219 | 1.27k | return PosibErrBase().prim_err(inf, p1, p2, p3, p4); | 220 | 1.27k | } |
Unexecuted instantiation: posib_err.cpp:acommon::make_err(acommon::ErrorInfo const*, acommon::ParmString, acommon::ParmString, acommon::ParmString, acommon::ParmString) fstream.cpp:acommon::make_err(acommon::ErrorInfo const*, acommon::ParmString, acommon::ParmString, acommon::ParmString, acommon::ParmString) Line | Count | Source | 218 | 3.14k | { | 219 | 3.14k | return PosibErrBase().prim_err(inf, p1, p2, p3, p4); | 220 | 3.14k | } |
convert.cpp:acommon::make_err(acommon::ErrorInfo const*, acommon::ParmString, acommon::ParmString, acommon::ParmString, acommon::ParmString) Line | Count | Source | 218 | 15 | { | 219 | 15 | return PosibErrBase().prim_err(inf, p1, p2, p3, p4); | 220 | 15 | } |
Unexecuted instantiation: document_checker.cpp:acommon::make_err(acommon::ErrorInfo const*, acommon::ParmString, acommon::ParmString, acommon::ParmString, acommon::ParmString) Unexecuted instantiation: filter.cpp:acommon::make_err(acommon::ErrorInfo const*, acommon::ParmString, acommon::ParmString, acommon::ParmString, acommon::ParmString) Unexecuted instantiation: file_data_util.cpp:acommon::make_err(acommon::ErrorInfo const*, acommon::ParmString, acommon::ParmString, acommon::ParmString, acommon::ParmString) Unexecuted instantiation: basic.cpp:acommon::make_err(acommon::ErrorInfo const*, acommon::ParmString, acommon::ParmString, acommon::ParmString, acommon::ParmString) Unexecuted instantiation: new_config.cpp:acommon::make_err(acommon::ErrorInfo const*, acommon::ParmString, acommon::ParmString, acommon::ParmString, acommon::ParmString) new_filter.cpp:acommon::make_err(acommon::ErrorInfo const*, acommon::ParmString, acommon::ParmString, acommon::ParmString, acommon::ParmString) Line | Count | Source | 218 | 3.38k | { | 219 | 3.38k | return PosibErrBase().prim_err(inf, p1, p2, p3, p4); | 220 | 3.38k | } |
new_fmode.cpp:acommon::make_err(acommon::ErrorInfo const*, acommon::ParmString, acommon::ParmString, acommon::ParmString, acommon::ParmString) Line | Count | Source | 218 | 5.78k | { | 219 | 5.78k | return PosibErrBase().prim_err(inf, p1, p2, p3, p4); | 220 | 5.78k | } |
find_speller.cpp:acommon::make_err(acommon::ErrorInfo const*, acommon::ParmString, acommon::ParmString, acommon::ParmString, acommon::ParmString) Line | Count | Source | 218 | 14 | { | 219 | 14 | return PosibErrBase().prim_err(inf, p1, p2, p3, p4); | 220 | 14 | } |
Unexecuted instantiation: url.cpp:acommon::make_err(acommon::ErrorInfo const*, acommon::ParmString, acommon::ParmString, acommon::ParmString, acommon::ParmString) Unexecuted instantiation: email.cpp:acommon::make_err(acommon::ErrorInfo const*, acommon::ParmString, acommon::ParmString, acommon::ParmString, acommon::ParmString) Unexecuted instantiation: tex.cpp:acommon::make_err(acommon::ErrorInfo const*, acommon::ParmString, acommon::ParmString, acommon::ParmString, acommon::ParmString) Unexecuted instantiation: sgml.cpp:acommon::make_err(acommon::ErrorInfo const*, acommon::ParmString, acommon::ParmString, acommon::ParmString, acommon::ParmString) Unexecuted instantiation: markdown.cpp:acommon::make_err(acommon::ErrorInfo const*, acommon::ParmString, acommon::ParmString, acommon::ParmString, acommon::ParmString) Unexecuted instantiation: context.cpp:acommon::make_err(acommon::ErrorInfo const*, acommon::ParmString, acommon::ParmString, acommon::ParmString, acommon::ParmString) Unexecuted instantiation: nroff.cpp:acommon::make_err(acommon::ErrorInfo const*, acommon::ParmString, acommon::ParmString, acommon::ParmString, acommon::ParmString) Unexecuted instantiation: texinfo.cpp:acommon::make_err(acommon::ErrorInfo const*, acommon::ParmString, acommon::ParmString, acommon::ParmString, acommon::ParmString) Unexecuted instantiation: cache.cpp:acommon::make_err(acommon::ErrorInfo const*, acommon::ParmString, acommon::ParmString, acommon::ParmString, acommon::ParmString) Unexecuted instantiation: getdata.cpp:acommon::make_err(acommon::ErrorInfo const*, acommon::ParmString, acommon::ParmString, acommon::ParmString, acommon::ParmString) Unexecuted instantiation: file_util.cpp:acommon::make_err(acommon::ErrorInfo const*, acommon::ParmString, acommon::ParmString, acommon::ParmString, acommon::ParmString) Unexecuted instantiation: string_map.cpp:acommon::make_err(acommon::ErrorInfo const*, acommon::ParmString, acommon::ParmString, acommon::ParmString, acommon::ParmString) Unexecuted instantiation: string_list.cpp:acommon::make_err(acommon::ErrorInfo const*, acommon::ParmString, acommon::ParmString, acommon::ParmString, acommon::ParmString) Unexecuted instantiation: iostream.cpp:acommon::make_err(acommon::ErrorInfo const*, acommon::ParmString, acommon::ParmString, acommon::ParmString, acommon::ParmString) info.cpp:acommon::make_err(acommon::ErrorInfo const*, acommon::ParmString, acommon::ParmString, acommon::ParmString, acommon::ParmString) Line | Count | Source | 218 | 6 | { | 219 | 6 | return PosibErrBase().prim_err(inf, p1, p2, p3, p4); | 220 | 6 | } |
Unexecuted instantiation: tokenizer.cpp:acommon::make_err(acommon::ErrorInfo const*, acommon::ParmString, acommon::ParmString, acommon::ParmString, acommon::ParmString) Unexecuted instantiation: speller_impl.cpp:acommon::make_err(acommon::ErrorInfo const*, acommon::ParmString, acommon::ParmString, acommon::ParmString, acommon::ParmString) language.cpp:acommon::make_err(acommon::ErrorInfo const*, acommon::ParmString, acommon::ParmString, acommon::ParmString, acommon::ParmString) Line | Count | Source | 218 | 10.6k | { | 219 | 10.6k | return PosibErrBase().prim_err(inf, p1, p2, p3, p4); | 220 | 10.6k | } |
Unexecuted instantiation: affix.cpp:acommon::make_err(acommon::ErrorInfo const*, acommon::ParmString, acommon::ParmString, acommon::ParmString, acommon::ParmString) Unexecuted instantiation: itemize.cpp:acommon::make_err(acommon::ErrorInfo const*, acommon::ParmString, acommon::ParmString, acommon::ParmString, acommon::ParmString) Unexecuted instantiation: speller.cpp:acommon::make_err(acommon::ErrorInfo const*, acommon::ParmString, acommon::ParmString, acommon::ParmString, acommon::ParmString) suggest.cpp:acommon::make_err(acommon::ErrorInfo const*, acommon::ParmString, acommon::ParmString, acommon::ParmString, acommon::ParmString) Line | Count | Source | 218 | 2 | { | 219 | 2 | return PosibErrBase().prim_err(inf, p1, p2, p3, p4); | 220 | 2 | } |
data.cpp:acommon::make_err(acommon::ErrorInfo const*, acommon::ParmString, acommon::ParmString, acommon::ParmString, acommon::ParmString) Line | Count | Source | 218 | 29 | { | 219 | 29 | return PosibErrBase().prim_err(inf, p1, p2, p3, p4); | 220 | 29 | } |
Unexecuted instantiation: multi_ws.cpp:acommon::make_err(acommon::ErrorInfo const*, acommon::ParmString, acommon::ParmString, acommon::ParmString, acommon::ParmString) Unexecuted instantiation: phonetic.cpp:acommon::make_err(acommon::ErrorInfo const*, acommon::ParmString, acommon::ParmString, acommon::ParmString, acommon::ParmString) Unexecuted instantiation: writable.cpp:acommon::make_err(acommon::ErrorInfo const*, acommon::ParmString, acommon::ParmString, acommon::ParmString, acommon::ParmString) Unexecuted instantiation: phonet.cpp:acommon::make_err(acommon::ErrorInfo const*, acommon::ParmString, acommon::ParmString, acommon::ParmString, acommon::ParmString) Unexecuted instantiation: typo_editdist.cpp:acommon::make_err(acommon::ErrorInfo const*, acommon::ParmString, acommon::ParmString, acommon::ParmString, acommon::ParmString) Unexecuted instantiation: readonly_ws.cpp:acommon::make_err(acommon::ErrorInfo const*, acommon::ParmString, acommon::ParmString, acommon::ParmString, acommon::ParmString) |
221 | | |
222 | | static const PosibErr<void> no_err; |
223 | | |
224 | | // |
225 | | // |
226 | | // |
227 | | inline String & String::operator= (const PosibErr<const char *> & s) |
228 | 0 | { |
229 | 0 | *this = s.data; |
230 | 0 | return *this; |
231 | 0 | } |
232 | | |
233 | | inline bool operator== (const PosibErr<String> & x, const char * y) |
234 | 0 | { |
235 | 0 | return x.data == y; |
236 | 0 | } |
237 | | inline bool operator!= (const PosibErr<String> & x, const char * y) |
238 | 0 | { |
239 | 0 | return x.data != y; |
240 | 0 | } |
241 | | |
242 | | inline ParmString::ParmString(const PosibErr<const char *> & s) |
243 | | : str_(s.data), size_(UINT_MAX) {} |
244 | | |
245 | | inline ParmString::ParmString(const PosibErr<String> & s) |
246 | 7.96k | : str_(s.data.c_str()), size_(s.data.size()) {} |
247 | | |
248 | | } |
249 | | |
250 | | #endif |