Skip to content

Commit

Permalink
Modernize C++ code using override
Browse files Browse the repository at this point in the history
The modifications were done using this command:

    run-clang-tidy-8.py -header-filter='.*' -checks='-*,modernize-use-override' -fix

Signed-off-by: Stefan Weil <sw@weilnetz.de>
  • Loading branch information
stweil committed Mar 26, 2019
1 parent f877640 commit 36f7688
Show file tree
Hide file tree
Showing 39 changed files with 123 additions and 123 deletions.
36 changes: 18 additions & 18 deletions src/api/renderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class TESS_API TessTextRenderer : public TessResultRenderer {
explicit TessTextRenderer(const char *outputbase);

protected:
virtual bool AddImageHandler(TessBaseAPI* api);
bool AddImageHandler(TessBaseAPI* api) override;
};

/**
Expand All @@ -160,9 +160,9 @@ class TESS_API TessHOcrRenderer : public TessResultRenderer {
explicit TessHOcrRenderer(const char *outputbase);

protected:
virtual bool BeginDocumentHandler();
virtual bool AddImageHandler(TessBaseAPI* api);
virtual bool EndDocumentHandler();
bool BeginDocumentHandler() override;
bool AddImageHandler(TessBaseAPI* api) override;
bool EndDocumentHandler() override;

private:
bool font_info_; // whether to print font information
Expand All @@ -176,9 +176,9 @@ class TESS_API TessHOcrRenderer : public TessResultRenderer {
explicit TessAltoRenderer(const char *outputbase);

protected:
virtual bool BeginDocumentHandler();
virtual bool AddImageHandler(TessBaseAPI* api);
virtual bool EndDocumentHandler();
bool BeginDocumentHandler() override;
bool AddImageHandler(TessBaseAPI* api) override;
bool EndDocumentHandler() override;

};

Expand All @@ -191,9 +191,9 @@ class TESS_API TessTsvRenderer : public TessResultRenderer {
explicit TessTsvRenderer(const char* outputbase);

protected:
virtual bool BeginDocumentHandler();
virtual bool AddImageHandler(TessBaseAPI* api);
virtual bool EndDocumentHandler();
bool BeginDocumentHandler() override;
bool AddImageHandler(TessBaseAPI* api) override;
bool EndDocumentHandler() override;

private:
bool font_info_; // whether to print font information
Expand All @@ -209,9 +209,9 @@ class TESS_API TessPDFRenderer : public TessResultRenderer {
TessPDFRenderer(const char* outputbase, const char* datadir, bool textonly = false);

protected:
virtual bool BeginDocumentHandler();
virtual bool AddImageHandler(TessBaseAPI* api);
virtual bool EndDocumentHandler();
bool BeginDocumentHandler() override;
bool AddImageHandler(TessBaseAPI* api) override;
bool EndDocumentHandler() override;

private:
// We don't want to have every image in memory at once,
Expand Down Expand Up @@ -244,7 +244,7 @@ class TESS_API TessUnlvRenderer : public TessResultRenderer {
explicit TessUnlvRenderer(const char *outputbase);

protected:
virtual bool AddImageHandler(TessBaseAPI* api);
bool AddImageHandler(TessBaseAPI* api) override;
};

/**
Expand All @@ -255,7 +255,7 @@ class TESS_API TessLSTMBoxRenderer : public TessResultRenderer {
explicit TessLSTMBoxRenderer(const char* outputbase);

protected:
virtual bool AddImageHandler(TessBaseAPI* api);
bool AddImageHandler(TessBaseAPI* api) override;
};

/**
Expand All @@ -266,7 +266,7 @@ class TESS_API TessBoxTextRenderer : public TessResultRenderer {
explicit TessBoxTextRenderer(const char *outputbase);

protected:
virtual bool AddImageHandler(TessBaseAPI* api);
bool AddImageHandler(TessBaseAPI* api) override;
};

/**
Expand All @@ -277,7 +277,7 @@ class TESS_API TessWordStrBoxRenderer : public TessResultRenderer {
explicit TessWordStrBoxRenderer(const char* outputbase);

protected:
virtual bool AddImageHandler(TessBaseAPI* api);
bool AddImageHandler(TessBaseAPI* api) override;
};

#ifndef DISABLED_LEGACY_ENGINE
Expand All @@ -290,7 +290,7 @@ class TESS_API TessOsdRenderer : public TessResultRenderer {
explicit TessOsdRenderer(const char* outputbase);

protected:
virtual bool AddImageHandler(TessBaseAPI* api);
bool AddImageHandler(TessBaseAPI* api) override;
};

#endif // ndef DISABLED_LEGACY_ENGINE
Expand Down
6 changes: 3 additions & 3 deletions src/ccmain/equationdetect.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class EquationDetect : public EquationDetectBase {
public:
EquationDetect(const char* equ_datapath,
const char* equ_language);
~EquationDetect();
~EquationDetect() override;

enum IndentType {
NO_INDENT,
Expand All @@ -57,13 +57,13 @@ class EquationDetect : public EquationDetectBase {
// Iterate over the blobs inside to_block, and set the blobs that we want to
// process to BSTT_NONE. (By default, they should be BSTT_SKIP). The function
// returns 0 upon success.
int LabelSpecialText(TO_BLOCK* to_block);
int LabelSpecialText(TO_BLOCK* to_block) override;

// Find possible equation partitions from part_grid. Should be called
// after the special_text_type of blobs are set.
// It returns 0 upon success.
int FindEquationParts(ColPartitionGrid* part_grid,
ColPartitionSet** best_columns);
ColPartitionSet** best_columns) override;

// Reset the resolution of the processing image. TEST only function.
void SetResolution(const int resolution);
Expand Down
2 changes: 1 addition & 1 deletion src/ccmain/ltrresultiterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class TESS_API LTRResultIterator : public PageIterator {
int rect_left, int rect_top,
int rect_width, int rect_height);

virtual ~LTRResultIterator();
~LTRResultIterator() override;

// LTRResultIterators may be copied! This makes it possible to iterate over
// all the objects at a lower level, while maintaining an iterator to
Expand Down
2 changes: 1 addition & 1 deletion src/ccmain/mutableiterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class MutableIterator : public ResultIterator {
: ResultIterator(
LTRResultIterator(page_res, tesseract, scale, scaled_yres, rect_left,
rect_top, rect_width, rect_height)) {}
virtual ~MutableIterator();
~MutableIterator() override;

// See PageIterator and ResultIterator for most calls.

Expand Down
2 changes: 1 addition & 1 deletion src/ccmain/paramsd.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class ParamsEditor : public SVEventHandler {
explicit ParamsEditor(tesseract::Tesseract*, ScrollView* sv = nullptr);

// Event listener. Waits for SVET_POPUP events and processes them.
void Notify(const SVEvent* sve);
void Notify(const SVEvent* sve) override;

private:
// Gets the up to the first 3 prefixes from s (split by _).
Expand Down
2 changes: 1 addition & 1 deletion src/ccmain/pgedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ STRING_VAR(editor_debug_config_file, "", "Config file to apply to single words")

class BlnEventHandler : public SVEventHandler {
public:
void Notify(const SVEvent* sv_event) {
void Notify(const SVEvent* sv_event) override {
if (sv_event->type == SVET_DESTROY)
bln_word_window = nullptr;
else if (sv_event->type == SVET_CLICK)
Expand Down
2 changes: 1 addition & 1 deletion src/ccmain/pgedit.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class PGEventHandler : public SVEventHandler {
public:
PGEventHandler(tesseract::Tesseract* tess) : tess_(tess) {
}
void Notify(const SVEvent* sve);
void Notify(const SVEvent* sve) override;
private:
tesseract::Tesseract* tess_;
};
Expand Down
12 changes: 6 additions & 6 deletions src/ccmain/resultiterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ class TESS_API ResultIterator : public LTRResultIterator {
* ResultIterator is copy constructible!
* The default copy constructor works just fine for us.
*/
virtual ~ResultIterator() = default;
~ResultIterator() override = default;

// ============= Moving around within the page ============.
/**
* Moves the iterator to point to the start of the page to begin
* an iteration.
*/
virtual void Begin();
void Begin() override;

/**
* Moves to the start of the next object at the given level in the
Expand All @@ -67,23 +67,23 @@ class TESS_API ResultIterator : public LTRResultIterator {
* This function iterates words in right-to-left scripts correctly, if
* the appropriate language has been loaded into Tesseract.
*/
virtual bool Next(PageIteratorLevel level);
bool Next(PageIteratorLevel level) override;

/**
* IsAtBeginningOf() returns whether we're at the logical beginning of the
* given level. (as opposed to ResultIterator's left-to-right top-to-bottom
* order). Otherwise, this acts the same as PageIterator::IsAtBeginningOf().
* For a full description, see pageiterator.h
*/
virtual bool IsAtBeginningOf(PageIteratorLevel level) const;
bool IsAtBeginningOf(PageIteratorLevel level) const override;

/**
* Implement PageIterator's IsAtFinalElement correctly in a BiDi context.
* For instance, IsAtFinalElement(RIL_PARA, RIL_WORD) returns whether we
* point at the last word in a paragraph. See PageIterator for full comment.
*/
virtual bool IsAtFinalElement(PageIteratorLevel level,
PageIteratorLevel element) const;
bool IsAtFinalElement(PageIteratorLevel level,
PageIteratorLevel element) const override;

// ============= Functions that refer to words only ============.
// Returns the number of blanks before the current word.
Expand Down
2 changes: 1 addition & 1 deletion src/ccmain/tesseractclass.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ typedef void (Tesseract::*WordRecognizer)(const WordData& word_data,
class Tesseract : public Wordrec {
public:
Tesseract();
~Tesseract();
~Tesseract() override;

// Return appropriate dictionary
Dict& getDict() override;
Expand Down
2 changes: 1 addition & 1 deletion src/ccstruct/ccstruct.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace tesseract {
class CCStruct : public CUtil {
public:
CCStruct() = default;
virtual ~CCStruct();
~CCStruct() override;

// Globally accessible constants.
// APPROXIMATIONS of the fractions of the character cell taken by
Expand Down
4 changes: 2 additions & 2 deletions src/ccstruct/matrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ class BandTriMatrix : public GENERIC_2D_ARRAY<T> {
// Expression to select a specific location in the matrix. The matrix is
// stored COLUMN-major, so the left-most index is the most significant.
// This allows [][] access to use indices in the same order as (,).
virtual int index(int column, int row) const {
int index(int column, int row) const override {
ASSERT_HOST(row >= column);
ASSERT_HOST(row - column < this->dim2_);
return column * this->dim2_ + row - column;
Expand Down Expand Up @@ -580,7 +580,7 @@ class MATRIX : public BandTriMatrix<BLOB_CHOICE_LIST *> {
MATRIX(int dimension, int bandwidth)
: BandTriMatrix<BLOB_CHOICE_LIST *>(dimension, bandwidth, NOT_CLASSIFIED) {}

virtual ~MATRIX();
~MATRIX() override;

// Returns true if there are any real classification results.
bool Classified(int col, int row, int wildcard_id) const;
Expand Down
6 changes: 3 additions & 3 deletions src/ccutil/indexmapbidi.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class IndexMap {
// Allows a many-to-one mapping by merging compact space indices.
class IndexMapBiDi : public IndexMap {
public:
virtual ~IndexMapBiDi();
~IndexMapBiDi() override;

// Top-level init function in a single call to initialize a map to select
// a single contiguous subrange [start, end) of the sparse space to be mapped
Expand Down Expand Up @@ -135,11 +135,11 @@ class IndexMapBiDi : public IndexMap {
void CompleteMerges();

// SparseToCompact takes a sparse index to an index in the compact space.
virtual int SparseToCompact(int sparse_index) const {
int SparseToCompact(int sparse_index) const override {
return sparse_map_[sparse_index];
}
// The size of the sparse space.
virtual int SparseSize() const {
int SparseSize() const override {
return sparse_map_.size();
}

Expand Down
Loading

0 comments on commit 36f7688

Please sign in to comment.