diff --git a/src/training/CMakeLists.txt b/src/training/CMakeLists.txt index b5f22f74c6..af1d520883 100644 --- a/src/training/CMakeLists.txt +++ b/src/training/CMakeLists.txt @@ -173,6 +173,7 @@ endif() ######################################## set(unicharset_training_src + icuerrorcode.cpp icuerrorcode.h lang_model_helpers.cpp lang_model_helpers.h diff --git a/src/training/Makefile.am b/src/training/Makefile.am index ed0b4b3a21..541a3b59c6 100644 --- a/src/training/Makefile.am +++ b/src/training/Makefile.am @@ -65,6 +65,7 @@ libtesseract_training_la_SOURCES = \ commandlineflags.cpp \ commontraining.cpp \ degradeimage.cpp \ + icuerrorcode.cpp \ lang_model_helpers.cpp \ ligature_table.cpp \ lstmtester.cpp \ diff --git a/src/training/icuerrorcode.cpp b/src/training/icuerrorcode.cpp new file mode 100644 index 0000000000..525ec2ad8b --- /dev/null +++ b/src/training/icuerrorcode.cpp @@ -0,0 +1,28 @@ +/////////////////////////////////////////////////////////////////////// +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +/////////////////////////////////////////////////////////////////////// + +#include "icuerrorcode.h" + +namespace tesseract { + +// Destructor. +// It is defined here, so the compiler can create a single vtable +// instead of weak vtables in every compilation unit. +IcuErrorCode::~IcuErrorCode() { + if (isFailure()) { + handleFailure(); + } +} + +} // namespace tesseract. diff --git a/src/training/icuerrorcode.h b/src/training/icuerrorcode.h index 5e50326c02..a2600e7fbd 100644 --- a/src/training/icuerrorcode.h +++ b/src/training/icuerrorcode.h @@ -7,7 +7,7 @@ * * Features: * - The constructor initializes the internal UErrorCode to U_ZERO_ERROR, - * removing one common source of errors. + * removing one common source of errors. * - Same use in C APIs taking a UErrorCode* (pointer) and C++ taking * UErrorCode& (reference), via conversion operators. * - Automatic checking for success when it goes out of scope. On failure, @@ -44,11 +44,7 @@ namespace tesseract { class IcuErrorCode : public icu::ErrorCode { public: IcuErrorCode() {} - virtual ~IcuErrorCode() { - if (isFailure()) { - handleFailure(); - } - } + virtual ~IcuErrorCode(); protected: virtual void handleFailure() const {