Fixed some clang errors about explicit constructors and more formatting.

git-svn-id: https://tesseract-ocr.googlecode.com/svn/trunk@1085 d0cd1f9f-072b-0410-8dd7-cf729c803f20
This commit is contained in:
theraysmith@gmail.com 2014-04-28 23:10:48 +00:00
parent d748d94aae
commit d7b089fbcf
5 changed files with 98 additions and 99 deletions

View File

@ -54,10 +54,10 @@ class ParamContent : public ELIST_LINK {
// Constructors for the various ParamTypes.
ParamContent() {
}
ParamContent(tesseract::StringParam* it);
ParamContent(tesseract::IntParam* it);
ParamContent(tesseract::BoolParam* it);
ParamContent(tesseract::DoubleParam* it);
explicit ParamContent(tesseract::StringParam* it);
explicit ParamContent(tesseract::IntParam* it);
explicit ParamContent(tesseract::BoolParam* it);
explicit ParamContent(tesseract::DoubleParam* it);
// Getters and Setters.
@ -93,7 +93,7 @@ class ParamsEditor : public SVEventHandler {
// Integrate the parameters editor as popupmenu into the existing scrollview
// window (usually the pg editor). If sv == null, create a new empty
// empty window and attach the parameter editor to that window (ugly).
ParamsEditor(tesseract::Tesseract*, ScrollView* sv = NULL);
explicit ParamsEditor(tesseract::Tesseract*, ScrollView* sv = NULL);
// Event listener. Waits for SVET_POPUP events and processes them.
void Notify(const SVEvent* sve);

View File

@ -94,8 +94,7 @@ class DLLSYM ELIST_LINK
}
//constructor
ELIST_LINK( //copy constructor
const ELIST_LINK &) { //dont copy link
ELIST_LINK(const ELIST_LINK &) { // don't copy link.
next = NULL;
}
@ -210,8 +209,7 @@ class DLLSYM ELIST_ITERATOR
list = NULL;
} //unassigned list
ELIST_ITERATOR( //constructor
ELIST *list_to_iterate);
explicit ELIST_ITERATOR(ELIST *list_to_iterate);
void set_to_list( //change list
ELIST *list_to_iterate);
@ -893,95 +891,99 @@ ELISTIZEH is a concatenation of 3 fragments ELISTIZEH_A, ELISTIZEH_B and
ELISTIZEH_C.
***********************************************************************/
#define ELISTIZEH_A(CLASSNAME) \
\
#define ELISTIZEH_A(CLASSNAME) \
\
extern DLLSYM void CLASSNAME##_zapper(ELIST_LINK* link);
#define ELISTIZEH_B(CLASSNAME) \
\
/*********************************************************************** \
* CLASS - CLASSNAME##_LIST \
* \
* List class for class CLASSNAME \
* \
**********************************************************************/ \
\
class DLLSYM CLASSNAME##_LIST : public ELIST \
{ \
public: \
CLASSNAME##_LIST():ELIST() {}\
/* constructor */ \
\
CLASSNAME##_LIST( /* dont construct */ \
const CLASSNAME##_LIST&) /*by initial assign*/\
{ DONT_CONSTRUCT_LIST_BY_COPY.error( QUOTE_IT( CLASSNAME##_LIST ), \
ABORT, NULL ); } \
\
void clear() /* delete elements */\
{ ELIST::internal_clear( &CLASSNAME##_zapper ); } \
\
~CLASSNAME##_LIST() /* destructor */ \
{ clear(); } \
\
/* Become a deep copy of src_list*/ \
void deep_copy(const CLASSNAME##_LIST* src_list, \
CLASSNAME* (*copier)(const CLASSNAME*)); \
\
void operator=( /* prevent assign */ \
const CLASSNAME##_LIST&) \
{ DONT_ASSIGN_LISTS.error( QUOTE_IT( CLASSNAME##_LIST ), \
ABORT, NULL ); }
#define ELISTIZEH_B(CLASSNAME) \
\
/*********************************************************************** \
* CLASS - CLASSNAME##_LIST \
* \
* List class for class CLASSNAME \
* \
**********************************************************************/ \
\
class DLLSYM CLASSNAME##_LIST : public ELIST { \
public: \
CLASSNAME##_LIST():ELIST() {} \
\
void clear() { /* delete elements */\
ELIST::internal_clear(&CLASSNAME##_zapper); \
} \
\
~CLASSNAME##_LIST() { \
clear(); \
} \
\
/* Become a deep copy of src_list*/ \
void deep_copy(const CLASSNAME##_LIST* src_list, \
CLASSNAME* (*copier)(const CLASSNAME*)); \
\
private: \
/* Prevent assign and copy construction. */ \
CLASSNAME##_LIST(const CLASSNAME##_LIST&) { \
DONT_CONSTRUCT_LIST_BY_COPY.error(QUOTE_IT(CLASSNAME##_LIST), ABORT, NULL);\
} \
void operator=(const CLASSNAME##_LIST&) { \
DONT_ASSIGN_LISTS.error(QUOTE_IT(CLASSNAME##_LIST), ABORT, NULL ); \
} \
#define ELISTIZEH_C( CLASSNAME ) \
}; \
\
\
\
/*********************************************************************** \
* CLASS - CLASSNAME##_IT \
* \
* Iterator class for class CLASSNAME##_LIST \
* \
* Note: We don't need to coerce pointers to member functions input \
* parameters as these are automatically converted to the type of the base \
* type. ("A ptr to a class may be converted to a pointer to a public base \
* class of that class") \
**********************************************************************/ \
\
class DLLSYM CLASSNAME##_IT : public ELIST_ITERATOR \
{ \
public: \
CLASSNAME##_IT():ELIST_ITERATOR(){} \
\
CLASSNAME##_IT( \
CLASSNAME##_LIST* list):ELIST_ITERATOR(list){} \
\
CLASSNAME* data() \
{ return (CLASSNAME*) ELIST_ITERATOR::data(); } \
\
CLASSNAME* data_relative( \
inT8 offset) \
{ return (CLASSNAME*) ELIST_ITERATOR::data_relative( offset ); } \
\
CLASSNAME* forward() \
{ return (CLASSNAME*) ELIST_ITERATOR::forward(); } \
\
CLASSNAME* extract() \
{ return (CLASSNAME*) ELIST_ITERATOR::extract(); } \
\
CLASSNAME* move_to_first() \
{ return (CLASSNAME*) ELIST_ITERATOR::move_to_first(); } \
\
CLASSNAME* move_to_last() \
{ return (CLASSNAME*) ELIST_ITERATOR::move_to_last(); } \
#define ELISTIZEH_C( CLASSNAME ) \
}; \
\
\
\
/*********************************************************************** \
* CLASS - CLASSNAME##_IT \
* \
* Iterator class for class CLASSNAME##_LIST \
* \
* Note: We don't need to coerce pointers to member functions input \
* parameters as these are automatically converted to the type of the base \
* type. ("A ptr to a class may be converted to a pointer to a public base \
* class of that class") \
**********************************************************************/ \
\
class DLLSYM CLASSNAME##_IT : public ELIST_ITERATOR { \
public: \
CLASSNAME##_IT():ELIST_ITERATOR(){} \
\
/* TODO(rays) This constructor should be explicit, but that means changing \
hundreds of incorrect initializations of iterators that use = over () */ \
CLASSNAME##_IT(CLASSNAME##_LIST* list) : ELIST_ITERATOR(list) {} \
\
CLASSNAME* data() { \
return reinterpret_cast<CLASSNAME*>(ELIST_ITERATOR::data()); \
} \
\
CLASSNAME* data_relative(inT8 offset) { \
return reinterpret_cast<CLASSNAME*>(ELIST_ITERATOR::data_relative(offset));\
} \
\
CLASSNAME* forward() { \
return reinterpret_cast<CLASSNAME*>(ELIST_ITERATOR::forward()); \
} \
\
CLASSNAME* extract() { \
return reinterpret_cast<CLASSNAME*>(ELIST_ITERATOR::extract()); \
} \
\
CLASSNAME* move_to_first() { \
return reinterpret_cast<CLASSNAME*>(ELIST_ITERATOR::move_to_first()); \
} \
\
CLASSNAME* move_to_last() { \
return reinterpret_cast<CLASSNAME*>(ELIST_ITERATOR::move_to_last()); \
} \
};
#define ELISTIZEH( CLASSNAME ) \
\
ELISTIZEH_A( CLASSNAME ) \
\
ELISTIZEH_B( CLASSNAME ) \
\
#define ELISTIZEH( CLASSNAME ) \
\
ELISTIZEH_A( CLASSNAME ) \
\
ELISTIZEH_B( CLASSNAME ) \
\
ELISTIZEH_C( CLASSNAME )

View File

@ -87,8 +87,7 @@ PARAM_DESC *ReadParamDesc(FILE *File, uinT16 N) {
ParamDesc[i].NonEssential = FALSE;
else
ParamDesc[i].NonEssential = TRUE;
if (tfscanf(File, "%f%f", &(ParamDesc[i].Min), &(ParamDesc[i].Max)) !=
2)
if (tfscanf(File, "%f%f", &(ParamDesc[i].Min), &(ParamDesc[i].Max)) != 2)
DoError (ILLEGALMINMAXSPEC, "Illegal min or max specification");
ParamDesc[i].Range = ParamDesc[i].Max - ParamDesc[i].Min;
ParamDesc[i].HalfRange = ParamDesc[i].Range / 2;

View File

@ -167,14 +167,13 @@ FEATURE ReadFeature(FILE *File, const FEATURE_DESC_STRUCT* FeatureDesc) {
Feature = NewFeature (FeatureDesc);
for (i = 0; i < Feature->Type->NumParams; i++) {
if (tfscanf (File, "%f", &(Feature->Params[i])) != 1)
if (tfscanf(File, "%f", &(Feature->Params[i])) != 1)
DoError (ILLEGAL_FEATURE_PARAM, "Illegal feature parameter spec");
#ifndef _WIN32
assert (!isnan(Feature->Params[i]));
#endif
}
return (Feature);
} /* ReadFeature */
@ -206,7 +205,6 @@ FEATURE_SET ReadFeatureSet(FILE *File, const FEATURE_DESC_STRUCT* FeatureDesc) {
AddFeature(FeatureSet, ReadFeature (File, FeatureDesc));
return (FeatureSet);
} /* ReadFeatureSet */

View File

@ -27,7 +27,7 @@ int rgb[3] = { 255, 255, 255 };
class SVPaint : public SVEventHandler {
public:
SVPaint(const char* server_name);
explicit SVPaint(const char* server_name);
// This is the main event handling function that we need to overwrite, defined
// in SVEventHandler.
void Notify(const SVEvent* sv_event);