Skip to content

Commit

Permalink
BLOB_CHOICE: Add copy assignment operator
Browse files Browse the repository at this point in the history
This fixes a warning from LGTM:

    No matching copy assignment operator in class BLOB_CHOICE.
    It is good practice to match a copy constructor
    with a copy assignment operator.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
  • Loading branch information
stweil committed Oct 18, 2018
1 parent 7100a14 commit a1f0c66
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/ccstruct/ratngs.cpp
Expand Up @@ -129,6 +129,24 @@ BLOB_CHOICE::BLOB_CHOICE(const BLOB_CHOICE &other) : ELIST_LINK(other) {
fonts_ = other.fonts_;
}

// Copy assignment operator.
BLOB_CHOICE& BLOB_CHOICE::operator=(const BLOB_CHOICE& other) {
ELIST_LINK::operator=(other);
unichar_id_ = other.unichar_id();
rating_ = other.rating();
certainty_ = other.certainty();
fontinfo_id_ = other.fontinfo_id();
fontinfo_id2_ = other.fontinfo_id2();
script_id_ = other.script_id();
matrix_cell_ = other.matrix_cell_;
min_xheight_ = other.min_xheight_;
max_xheight_ = other.max_xheight_;
yshift_ = other.yshift();
classifier_ = other.classifier_;
fonts_ = other.fonts_;
return *this;
}

// Returns true if *this and other agree on the baseline and x-height
// to within some tolerance based on a given estimate of the x-height.
bool BLOB_CHOICE::PosAndSizeAgree(const BLOB_CHOICE& other, float x_height,
Expand Down
3 changes: 3 additions & 0 deletions src/ccstruct/ratngs.h
Expand Up @@ -197,6 +197,9 @@ class BLOB_CHOICE: public ELIST_LINK
}

private:
// Copy assignment operator.
BLOB_CHOICE& operator=(const BLOB_CHOICE& other);

UNICHAR_ID unichar_id_; // unichar id
// Fonts and scores. Allowed to be empty.
GenericVector<tesseract::ScoredFont> fonts_;
Expand Down

0 comments on commit a1f0c66

Please sign in to comment.