Skip to content

Commit 1694be9

Browse files
stweilzdenop
authored andcommitted
tessdatamanager: Use PACKAGE_VERSION instead of TESSERACT_VERSION_STR (#1407)
This allows further simplifications for the version handling. Move the implementation for the constructors from .h file to .cpp file to reduce dependencies. Remove unneeded include statements from the .h file to reduce more dependencies. Signed-off-by: Stefan Weil <[email protected]>
1 parent 8c25875 commit 1694be9

File tree

2 files changed

+19
-13
lines changed

2 files changed

+19
-13
lines changed

ccutil/tessdatamanager.cpp

+15
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
#pragma warning(disable:4244) // Conversion warnings
2222
#endif
2323

24+
#ifdef HAVE_CONFIG_H
25+
#include "config_auto.h"
26+
#endif
27+
2428
#include "tessdatamanager.h"
2529

2630
#include <stdio.h>
@@ -33,6 +37,17 @@
3337

3438
namespace tesseract {
3539

40+
TessdataManager::TessdataManager() : reader_(nullptr), is_loaded_(false), swap_(false) {
41+
SetVersionString(PACKAGE_VERSION);
42+
}
43+
44+
TessdataManager::TessdataManager(FileReader reader)
45+
: reader_(reader),
46+
is_loaded_(false),
47+
swap_(false) {
48+
SetVersionString(PACKAGE_VERSION);
49+
}
50+
3651
// Lazily loads from the the given filename. Won't actually read the file
3752
// until it needs it.
3853
void TessdataManager::LoadFileLater(const char *data_file_name) {

ccutil/tessdatamanager.h

+4-13
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,7 @@
2020
#ifndef TESSERACT_CCUTIL_TESSDATAMANAGER_H_
2121
#define TESSERACT_CCUTIL_TESSDATAMANAGER_H_
2222

23-
#include <stdio.h>
24-
25-
#include "host.h"
26-
#include "strngs.h"
27-
#include "tprintf.h"
28-
#include "version.h"
23+
#include "genericvector.h"
2924

3025
static const char kTrainedDataSuffix[] = "traineddata";
3126

@@ -130,13 +125,9 @@ static const int kMaxNumTessdataEntries = 1000;
130125

131126
class TessdataManager {
132127
public:
133-
TessdataManager() : reader_(nullptr), is_loaded_(false), swap_(false) {
134-
SetVersionString(TESSERACT_VERSION_STR);
135-
}
136-
explicit TessdataManager(FileReader reader)
137-
: reader_(reader), is_loaded_(false), swap_(false) {
138-
SetVersionString(TESSERACT_VERSION_STR);
139-
}
128+
TessdataManager();
129+
explicit TessdataManager(FileReader reader);
130+
140131
~TessdataManager() {}
141132

142133
bool swap() const { return swap_; }

0 commit comments

Comments
 (0)