Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 <sw@weilnetz.de>
  • Loading branch information
stweil authored and zdenop committed Mar 22, 2018
1 parent 8c25875 commit 1694be9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
15 changes: 15 additions & 0 deletions ccutil/tessdatamanager.cpp
Expand Up @@ -21,6 +21,10 @@
#pragma warning(disable:4244) // Conversion warnings
#endif

#ifdef HAVE_CONFIG_H
#include "config_auto.h"
#endif

#include "tessdatamanager.h"

#include <stdio.h>
Expand All @@ -33,6 +37,17 @@

namespace tesseract {

TessdataManager::TessdataManager() : reader_(nullptr), is_loaded_(false), swap_(false) {
SetVersionString(PACKAGE_VERSION);
}

TessdataManager::TessdataManager(FileReader reader)
: reader_(reader),
is_loaded_(false),
swap_(false) {
SetVersionString(PACKAGE_VERSION);
}

// Lazily loads from the the given filename. Won't actually read the file
// until it needs it.
void TessdataManager::LoadFileLater(const char *data_file_name) {
Expand Down
17 changes: 4 additions & 13 deletions ccutil/tessdatamanager.h
Expand Up @@ -20,12 +20,7 @@
#ifndef TESSERACT_CCUTIL_TESSDATAMANAGER_H_
#define TESSERACT_CCUTIL_TESSDATAMANAGER_H_

#include <stdio.h>

#include "host.h"
#include "strngs.h"
#include "tprintf.h"
#include "version.h"
#include "genericvector.h"

static const char kTrainedDataSuffix[] = "traineddata";

Expand Down Expand Up @@ -130,13 +125,9 @@ static const int kMaxNumTessdataEntries = 1000;

class TessdataManager {
public:
TessdataManager() : reader_(nullptr), is_loaded_(false), swap_(false) {
SetVersionString(TESSERACT_VERSION_STR);
}
explicit TessdataManager(FileReader reader)
: reader_(reader), is_loaded_(false), swap_(false) {
SetVersionString(TESSERACT_VERSION_STR);
}
TessdataManager();
explicit TessdataManager(FileReader reader);

~TessdataManager() {}

bool swap() const { return swap_; }
Expand Down

0 comments on commit 1694be9

Please sign in to comment.