Skip to content

Commit

Permalink
Merge pull request #1591 from ZaMaZaN4iK/fix_default_two
Browse files Browse the repository at this point in the history
Use default keyword instead of empty ctors/dtors.
  • Loading branch information
egorpugin authored May 22, 2018
2 parents 555f6ff + d14a7ca commit 78857ca
Show file tree
Hide file tree
Showing 96 changed files with 98 additions and 219 deletions.
3 changes: 0 additions & 3 deletions src/ccmain/ltrresultiterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ LTRResultIterator::LTRResultIterator(PAGE_RES* page_res, Tesseract* tesseract,
paragraph_separator_("\n") {
}

LTRResultIterator::~LTRResultIterator() {
}

// Returns the null terminated UTF-8 encoded text string for the current
// object at the given level. Use delete [] to free after use.
char* LTRResultIterator::GetUTF8Text(PageIteratorLevel level) const {
Expand Down
3 changes: 2 additions & 1 deletion src/ccmain/ltrresultiterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ class TESS_API LTRResultIterator : public PageIterator {
int scale, int scaled_yres,
int rect_left, int rect_top,
int rect_width, int rect_height);
virtual ~LTRResultIterator();

virtual ~LTRResultIterator() = default;

// 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() {}
virtual ~MutableIterator() = default;

// See PageIterator and ResultIterator for most calls.

Expand Down
3 changes: 1 addition & 2 deletions src/ccmain/paramsd.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ class ParamContent : public ELIST_LINK {
static ParamContent* GetParamContentById(int id);

// Constructors for the various ParamTypes.
ParamContent() {
}
ParamContent() = default;
explicit ParamContent(tesseract::StringParam* it);
explicit ParamContent(tesseract::IntParam* it);
explicit ParamContent(tesseract::BoolParam* it);
Expand Down
2 changes: 1 addition & 1 deletion src/ccmain/resultiterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class TESS_API ResultIterator : public LTRResultIterator {
* ResultIterator is copy constructible!
* The default copy constructor works just fine for us.
*/
virtual ~ResultIterator() {}
virtual ~ResultIterator() = default;

// ============= Moving around within the page ============.
/**
Expand Down
3 changes: 0 additions & 3 deletions src/ccstruct/boxword.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ BoxWord::BoxWord(const BoxWord& src) {
CopyFrom(src);
}

BoxWord::~BoxWord() {
}

BoxWord& BoxWord::operator=(const BoxWord& src) {
CopyFrom(src);
return *this;
Expand Down
2 changes: 1 addition & 1 deletion src/ccstruct/boxword.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class BoxWord {
public:
BoxWord();
explicit BoxWord(const BoxWord& src);
~BoxWord();
~BoxWord() = default;

BoxWord& operator=(const BoxWord& src);

Expand Down
5 changes: 0 additions & 5 deletions src/ccstruct/ccstruct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,4 @@ const double CCStruct::kAscenderFraction = 0.25;
const double CCStruct::kXHeightCapRatio = CCStruct::kXHeightFraction /
(CCStruct::kXHeightFraction + CCStruct::kAscenderFraction);

CCStruct::CCStruct() {}

CCStruct::~CCStruct() {
}

}
4 changes: 2 additions & 2 deletions src/ccstruct/ccstruct.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
namespace tesseract {
class CCStruct : public CUtil {
public:
CCStruct();
~CCStruct();
CCStruct() = default;
~CCStruct() = default;

// Globally accessible constants.
// APPROXIMATIONS of the fractions of the character cell taken by
Expand Down
2 changes: 1 addition & 1 deletion src/ccstruct/crakedge.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

class CRACKEDGE {
public:
CRACKEDGE() {}
CRACKEDGE() = default;

ICOORD pos; /*position of crack */
int8_t stepx; //edge step
Expand Down
3 changes: 0 additions & 3 deletions src/ccstruct/detlinefit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ const int kMaxRealDistance = 2.0;
DetLineFit::DetLineFit() : square_length_(0.0) {
}

DetLineFit::~DetLineFit() {
}

// Delete all Added points.
void DetLineFit::Clear() {
pts_.clear();
Expand Down
2 changes: 1 addition & 1 deletion src/ccstruct/detlinefit.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ namespace tesseract {
class DetLineFit {
public:
DetLineFit();
~DetLineFit();
~DetLineFit() = default;

// Delete all Added points.
void Clear();
Expand Down
2 changes: 1 addition & 1 deletion src/ccstruct/fontinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ struct FontSpacingInfo {
*/
struct FontInfo {
FontInfo() : name(nullptr), properties(0), universal_id(0), spacing_vec(nullptr) {}
~FontInfo() {}
~FontInfo() = default;

// Writes to the given file. Returns false in case of error.
bool Serialize(FILE* fp) const;
Expand Down
3 changes: 1 addition & 2 deletions src/ccstruct/mod128.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
class DLLSYM DIR128
{
public:
DIR128() {
} //empty constructor
DIR128() = default;

DIR128( //constructor
int16_t value) { //value to assign
Expand Down
3 changes: 1 addition & 2 deletions src/ccstruct/ocrblock.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ class BLOCK:public ELIST_LINK
int16_t xmax, //< top right
int16_t ymax);

~BLOCK () {
}
~BLOCK () = default;

/**
* set space size etc.
Expand Down
3 changes: 1 addition & 2 deletions src/ccstruct/ocrrow.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ class ROW:public ELIST_LINK
{
friend void tweak_row_baseline(ROW *, double, double);
public:
ROW() {
} //empty constructor
ROW() = default;
ROW( //constructor
int32_t spline_size, //no of segments
int32_t *xstarts, //segment boundaries
Expand Down
18 changes: 6 additions & 12 deletions src/ccstruct/pageres.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ class PAGE_RES { // page result
BLOCK_LIST *block_list, // real blocks
WERD_CHOICE **prev_word_best_choice_ptr);

~PAGE_RES () { // destructor
}
~PAGE_RES () = default;
};

/*************************************************************************
Expand All @@ -109,13 +108,11 @@ class BLOCK_RES:public ELIST_LINK {

ROW_RES_LIST row_res_list;

BLOCK_RES() {
} // empty constructor
BLOCK_RES() = default;

BLOCK_RES(bool merge_similar_words, BLOCK *the_block); // real block

~BLOCK_RES () { // destructor
}
~BLOCK_RES () = default;
};

/*************************************************************************
Expand All @@ -130,13 +127,11 @@ class ROW_RES:public ELIST_LINK {
int32_t whole_word_rej_count; // rejs in total rej wds
WERD_RES_LIST word_res_list;

ROW_RES() {
} // empty constructor
ROW_RES() = default;

ROW_RES(bool merge_similar_words, ROW *the_row); // real row

~ROW_RES() { // destructor
}
~ROW_RES() = default;
};

/*************************************************************************
Expand Down Expand Up @@ -660,8 +655,7 @@ class PAGE_RES_IT {
public:
PAGE_RES * page_res; // page being iterated

PAGE_RES_IT() {
} // empty contructor
PAGE_RES_IT() = default;

PAGE_RES_IT(PAGE_RES *the_page_res) { // page result
page_res = the_page_res;
Expand Down
2 changes: 1 addition & 1 deletion src/ccstruct/params_training_featdef.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ using ParamsTrainingHypothesisList = GenericVector<ParamsTrainingHypothesis>;
// explored on PASS1, PASS2, fix xheight pass, etc).
class ParamsTrainingBundle {
public:
ParamsTrainingBundle() {}
ParamsTrainingBundle() = default;
// Starts a new hypothesis list.
// Should be called at the beginning of a new run of the segmentation search.
void StartHypothesisList() {
Expand Down
9 changes: 3 additions & 6 deletions src/ccstruct/points.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ class ICOORD
ycoord = yin;
}
///destructor
~ICOORD () {
}
~ICOORD () = default;

///access function
int16_t x() const {
Expand Down Expand Up @@ -163,8 +162,7 @@ class DLLSYM ICOORDELT:public ELIST_LINK, public ICOORD
{
public:
///empty constructor
ICOORDELT() {
}
ICOORDELT() = default;
///constructor from ICOORD
ICOORDELT (ICOORD icoord):ICOORD (icoord) {
}
Expand All @@ -190,8 +188,7 @@ class DLLSYM FCOORD
{
public:
///empty constructor
FCOORD() {
}
FCOORD() = default;
///constructor
///@param xvalue x value
///@param yvalue y value
Expand Down
6 changes: 2 additions & 4 deletions src/ccstruct/polyblk.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,11 @@

class DLLSYM POLY_BLOCK {
public:
POLY_BLOCK() {
}
POLY_BLOCK() = default;
// Initialize from box coordinates.
POLY_BLOCK(const TBOX& box, PolyBlockType type);
POLY_BLOCK(ICOORDELT_LIST *points, PolyBlockType type);
~POLY_BLOCK () {
}
~POLY_BLOCK () = default;

TBOX *bounding_box() { // access function
return &box;
Expand Down
3 changes: 1 addition & 2 deletions src/ccstruct/quadratc.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
class QUAD_COEFFS
{
public:
QUAD_COEFFS() {
} //empty constructor
QUAD_COEFFS() = default;
QUAD_COEFFS( //constructor
double xsq, //coefficients
float x,
Expand Down
2 changes: 1 addition & 1 deletion src/ccstruct/ratngs.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class BLOB_CHOICE: public ELIST_LINK
float yshift, // the larger of y shift (top or bottom)
BlobChoiceClassifier c); // adapted match or other
BLOB_CHOICE(const BLOB_CHOICE &other);
~BLOB_CHOICE() {}
~BLOB_CHOICE() = default;

UNICHAR_ID unichar_id() const {
return unichar_id_;
Expand Down
3 changes: 1 addition & 2 deletions src/ccstruct/rejctmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,7 @@ class REJ
BOOL8 rej_before_quality_accept();

public:
REJ() { //constructor
}
REJ() = default;

REJ( //classwise copy
const REJ &source) {
Expand Down
3 changes: 1 addition & 2 deletions src/ccstruct/stepblob.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ ELISTIZEH(C_BLOB)
class C_BLOB:public ELIST_LINK
{
public:
C_BLOB() {
}
C_BLOB() = default;
explicit C_BLOB(C_OUTLINE_LIST *outline_list);
// Simpler constructor to build a blob from a single outline that has
// already been fully initialized.
Expand Down
5 changes: 2 additions & 3 deletions src/ccstruct/werd.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class ROW; //forward decl

class WERD : public ELIST2_LINK {
public:
WERD() {}
WERD() = default;
// WERD constructed with:
// blob_list - blobs of the word (we take this list's contents)
// blanks - number of blanks before the word
Expand All @@ -75,8 +75,7 @@ class WERD : public ELIST2_LINK {
// W_BOL and W_EOL flags are set according to the given values.
WERD* ConstructFromSingleBlob(bool bol, bool eol, C_BLOB* blob);

~WERD() {
}
~WERD() = default;

// assignment
WERD & operator= (const WERD &source);
Expand Down
4 changes: 2 additions & 2 deletions src/ccutil/ambigs.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class UnicharIdArrayUtils {
class AmbigSpec : public ELIST_LINK {
public:
AmbigSpec();
~AmbigSpec() {}
~AmbigSpec() = default;

// Comparator function for sorting AmbigSpec_LISTs. The lists will
// be sorted by their wrong_ngram arrays. Example of wrong_ngram vectors
Expand Down Expand Up @@ -142,7 +142,7 @@ using UnicharAmbigsVector = GenericVector<AmbigSpec_LIST *>;

class UnicharAmbigs {
public:
UnicharAmbigs() {}
UnicharAmbigs() = default;
~UnicharAmbigs() {
replace_ambigs_.delete_data_pointers();
dang_ambigs_.delete_data_pointers();
Expand Down
4 changes: 0 additions & 4 deletions src/ccutil/ccutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ CCUtil::CCUtil() :
" whether to adapt to a character", &params_) {
}

CCUtil::~CCUtil() {
}


CCUtilMutex::CCUtilMutex() {
#ifdef _WIN32
mutex_ = CreateMutex(0, FALSE, 0);
Expand Down
2 changes: 1 addition & 1 deletion src/ccutil/ccutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class CCUtilMutex {
class CCUtil {
public:
CCUtil();
virtual ~CCUtil();
virtual ~CCUtil() = default;

public:
// Read the arguments and set up the data path.
Expand Down
2 changes: 1 addition & 1 deletion src/ccutil/genericheap.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ namespace tesseract {
template <typename Pair>
class GenericHeap {
public:
GenericHeap() {}
GenericHeap() = default;
// The initial size is only a GenericVector::reserve. It is not enforced as
// the size limit of the heap. Caller must implement their own enforcement.
explicit GenericHeap(int initial_size) {
Expand Down
2 changes: 1 addition & 1 deletion src/ccutil/indexmapbidi.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class IndexMapBiDi;
// It must be initialized by copying from an IndexMapBiDi or by DeSerialize.
class IndexMap {
public:
virtual ~IndexMap() {}
virtual ~IndexMap() = default;

// SparseToCompact takes a sparse index to an index in the compact space.
// Uses a binary search to find the result. For faster speed use
Expand Down
Loading

0 comments on commit 78857ca

Please sign in to comment.