Skip to content

Commit a1f0c66

Browse files
committed
BLOB_CHOICE: Add copy assignment operator
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 <[email protected]>
1 parent 7100a14 commit a1f0c66

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

src/ccstruct/ratngs.cpp

+18
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,24 @@ BLOB_CHOICE::BLOB_CHOICE(const BLOB_CHOICE &other) : ELIST_LINK(other) {
129129
fonts_ = other.fonts_;
130130
}
131131

132+
// Copy assignment operator.
133+
BLOB_CHOICE& BLOB_CHOICE::operator=(const BLOB_CHOICE& other) {
134+
ELIST_LINK::operator=(other);
135+
unichar_id_ = other.unichar_id();
136+
rating_ = other.rating();
137+
certainty_ = other.certainty();
138+
fontinfo_id_ = other.fontinfo_id();
139+
fontinfo_id2_ = other.fontinfo_id2();
140+
script_id_ = other.script_id();
141+
matrix_cell_ = other.matrix_cell_;
142+
min_xheight_ = other.min_xheight_;
143+
max_xheight_ = other.max_xheight_;
144+
yshift_ = other.yshift();
145+
classifier_ = other.classifier_;
146+
fonts_ = other.fonts_;
147+
return *this;
148+
}
149+
132150
// Returns true if *this and other agree on the baseline and x-height
133151
// to within some tolerance based on a given estimate of the x-height.
134152
bool BLOB_CHOICE::PosAndSizeAgree(const BLOB_CHOICE& other, float x_height,

src/ccstruct/ratngs.h

+3
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,9 @@ class BLOB_CHOICE: public ELIST_LINK
197197
}
198198

199199
private:
200+
// Copy assignment operator.
201+
BLOB_CHOICE& operator=(const BLOB_CHOICE& other);
202+
200203
UNICHAR_ID unichar_id_; // unichar id
201204
// Fonts and scores. Allowed to be empty.
202205
GenericVector<tesseract::ScoredFont> fonts_;

0 commit comments

Comments
 (0)