Modernization cleanup.

This commit is contained in:
Jim Evins
2017-04-10 22:43:34 -04:00
parent b17cea7ace
commit 4d194f72e9
34 changed files with 110 additions and 109 deletions
+7 -7
View File
@@ -76,7 +76,7 @@ namespace glbarcode
} }
bool Barcode::showText( void ) const bool Barcode::showText( ) const
{ {
return d->mShowTextFlag; return d->mShowTextFlag;
} }
@@ -89,7 +89,7 @@ namespace glbarcode
} }
bool Barcode::checksum( void ) const bool Barcode::checksum( ) const
{ {
return d->mChecksumFlag; return d->mChecksumFlag;
} }
@@ -101,7 +101,7 @@ namespace glbarcode
} }
bool Barcode::isEmpty( void ) const bool Barcode::isEmpty( ) const
{ {
return d->mIsEmpty; return d->mIsEmpty;
} }
@@ -113,7 +113,7 @@ namespace glbarcode
} }
bool Barcode::isDataValid( void ) const bool Barcode::isDataValid( ) const
{ {
return d->mIsDataValid; return d->mIsDataValid;
} }
@@ -125,13 +125,13 @@ namespace glbarcode
} }
double Barcode::width( void ) const double Barcode::width( ) const
{ {
return d->mW; return d->mW;
} }
double Barcode::height( void ) const double Barcode::height( ) const
{ {
return d->mH; return d->mH;
} }
@@ -149,7 +149,7 @@ namespace glbarcode
} }
void Barcode::clear( void ) void Barcode::clear( )
{ {
std::list<DrawingPrimitive*>::iterator primitive; std::list<DrawingPrimitive*>::iterator primitive;
+7 -7
View File
@@ -83,7 +83,7 @@ namespace glbarcode
* *
* @sa setShowText() * @sa setShowText()
*/ */
bool showText( void ) const; bool showText() const;
/** /**
@@ -105,7 +105,7 @@ namespace glbarcode
* *
* @sa setChecksum() * @sa setChecksum()
*/ */
bool checksum( void ) const; bool checksum() const;
/** /**
@@ -138,7 +138,7 @@ namespace glbarcode
* *
* @sa setIsEmpty() * @sa setIsEmpty()
*/ */
bool isEmpty( void ) const; bool isEmpty() const;
/** /**
@@ -149,7 +149,7 @@ namespace glbarcode
* *
* @sa setIsDataValid() * @sa setIsDataValid()
*/ */
bool isDataValid( void ) const; bool isDataValid() const;
/** /**
@@ -159,7 +159,7 @@ namespace glbarcode
* *
* @sa setWidth() * @sa setWidth()
*/ */
double width( void ) const; double width() const;
/** /**
@@ -169,14 +169,14 @@ namespace glbarcode
* *
* @sa setHeight() * @sa setHeight()
*/ */
double height( void ) const; double height() const;
protected: protected:
/** /**
* Clear drawing primitives. * Clear drawing primitives.
*/ */
void clear( void ); void clear();
/** /**
+2 -2
View File
@@ -54,7 +54,7 @@ namespace glbarcode
/** /**
* Destructor. * Destructor.
*/ */
virtual ~Barcode1dBase(); ~Barcode1dBase() override;
/** /**
@@ -73,7 +73,7 @@ namespace glbarcode
*/ */
Barcode& build( const std::string& data, Barcode& build( const std::string& data,
double w = 0, double w = 0,
double h = 0 ); double h = 0 ) override;
protected: protected:
+2 -2
View File
@@ -56,7 +56,7 @@ namespace glbarcode
/** /**
* Destructor. * Destructor.
*/ */
virtual ~Barcode2dBase(); ~Barcode2dBase() override;
/** /**
@@ -75,7 +75,7 @@ namespace glbarcode
*/ */
Barcode& build( const std::string& data, Barcode& build( const std::string& data,
double w = 0, double w = 0,
double h = 0 ); double h = 0 ) override;
protected: protected:
+1 -1
View File
@@ -27,7 +27,7 @@ namespace glbarcode
/* /*
* Static CEPNET barcode creation method * Static CEPNET barcode creation method
*/ */
Barcode* BarcodeCepnet::create( void ) Barcode* BarcodeCepnet::create( )
{ {
return new BarcodeCepnet(); return new BarcodeCepnet();
} }
+2 -2
View File
@@ -52,11 +52,11 @@ namespace glbarcode
* *
* Used by glbarcode::BarcodeFactory * Used by glbarcode::BarcodeFactory
*/ */
static Barcode* create( void ); static Barcode* create();
private: private:
bool validateDigits( int nDigits ); bool validateDigits( int nDigits ) override;
}; };
+1 -1
View File
@@ -103,7 +103,7 @@ namespace glbarcode
/* /*
* Static Code39 barcode creation method * Static Code39 barcode creation method
*/ */
Barcode* BarcodeCode39::create( void ) Barcode* BarcodeCode39::create( )
{ {
return new BarcodeCode39(); return new BarcodeCode39();
} }
+5 -5
View File
@@ -77,21 +77,21 @@ namespace glbarcode
* *
* Used by glbarcode::BarcodeFactory * Used by glbarcode::BarcodeFactory
*/ */
static Barcode* create( void ); static Barcode* create();
private: private:
bool validate( const std::string& rawData ); bool validate( const std::string& rawData ) override;
std::string encode( const std::string& cookedData ); std::string encode( const std::string& cookedData ) override;
std::string prepareText( const std::string& rawData ); std::string prepareText( const std::string& rawData ) override;
void vectorize( const std::string& codedData, void vectorize( const std::string& codedData,
const std::string& displayText, const std::string& displayText,
const std::string& cookedData, const std::string& cookedData,
double& w, double& w,
double& h ); double& h ) override;
}; };
} }
+1 -1
View File
@@ -67,7 +67,7 @@ namespace glbarcode
/* /*
* Static Extended Code39 barcode creation method * Static Extended Code39 barcode creation method
*/ */
Barcode* BarcodeCode39Ext::create( void ) Barcode* BarcodeCode39Ext::create( )
{ {
return new BarcodeCode39Ext(); return new BarcodeCode39Ext();
} }
+4 -4
View File
@@ -114,15 +114,15 @@ namespace glbarcode
* *
* Used by glbarcode::BarcodeFactory * Used by glbarcode::BarcodeFactory
*/ */
static Barcode* create( void ); static Barcode* create();
private: private:
bool validate( const std::string& rawData ); bool validate( const std::string& rawData ) override;
std::string preprocess( const std::string& rawData ); std::string preprocess( const std::string& rawData ) override;
std::string prepareText( const std::string& rawData ); std::string prepareText( const std::string& rawData ) override;
}; };
+3 -3
View File
@@ -303,7 +303,7 @@ namespace
if ( nRawCw > 1558 ) if ( nRawCw > 1558 )
{ {
return NULL; return nullptr;
} }
int iParam = 0; int iParam = 0;
@@ -569,7 +569,7 @@ namespace glbarcode
/* /*
* Static DataMatrix barcode creation method * Static DataMatrix barcode creation method
*/ */
Barcode* BarcodeDataMatrix::create( void ) Barcode* BarcodeDataMatrix::create( )
{ {
return new BarcodeDataMatrix(); return new BarcodeDataMatrix();
} }
@@ -600,7 +600,7 @@ namespace glbarcode
* Determine parameters for "best size" * Determine parameters for "best size"
*/ */
const DMParameterEntry * p = ecc200BestSizeParams( nRawCw ); const DMParameterEntry * p = ecc200BestSizeParams( nRawCw );
if ( p == NULL ) if ( p == nullptr )
{ {
return false; return false;
} }
+3 -3
View File
@@ -44,14 +44,14 @@ namespace glbarcode
* *
* Used by glbarcode::BarcodeFactory * Used by glbarcode::BarcodeFactory
*/ */
static Barcode* create( void ); static Barcode* create();
private: private:
bool validate( const std::string& rawData ); bool validate( const std::string& rawData ) override;
bool encode( const std::string& cookedData, bool encode( const std::string& cookedData,
Matrix<bool>& encodedData ); Matrix<bool>& encodedData ) override;
}; };
+1 -1
View File
@@ -30,7 +30,7 @@ namespace glbarcode
/* /*
* Static EAN-13 barcode creation method * Static EAN-13 barcode creation method
*/ */
Barcode* BarcodeEan13::create( void ) Barcode* BarcodeEan13::create( )
{ {
return new BarcodeEan13(); return new BarcodeEan13();
} }
+4 -4
View File
@@ -44,7 +44,7 @@ namespace glbarcode
* *
* Used by glbarcode::BarcodeFactory * Used by glbarcode::BarcodeFactory
*/ */
static Barcode* create( void ); static Barcode* create();
/** /**
@@ -54,9 +54,9 @@ namespace glbarcode
private: private:
bool validateDigits( int nDigits ); bool validateDigits( int nDigits ) override;
std::string preprocess( const std::string& rawData ); std::string preprocess( const std::string& rawData ) override;
void vectorizeText( const std::string& displayText, void vectorizeText( const std::string& displayText,
double size1, double size1,
@@ -66,7 +66,7 @@ namespace glbarcode
double y1, double y1,
double x2Left, double x2Left,
double x2Right, double x2Right,
double y2 ); double y2 ) override;
}; };
+4 -3
View File
@@ -294,7 +294,7 @@ namespace
class Int104 class Int104
{ {
public: public:
Int104( void ) Int104( )
{ {
for ( int i = 0; i < 13; i++ ) for ( int i = 0; i < 13; i++ )
{ {
@@ -352,7 +352,7 @@ namespace glbarcode
/* /*
* Static Onecode barcode creation method * Static Onecode barcode creation method
*/ */
Barcode* BarcodeOnecode::create( void ) Barcode* BarcodeOnecode::create( )
{ {
return new BarcodeOnecode(); return new BarcodeOnecode();
} }
@@ -515,7 +515,7 @@ namespace glbarcode
for ( unsigned int i = 0; i < codedData.size(); i++ ) for ( unsigned int i = 0; i < codedData.size(); i++ )
{ {
double y = ONECODE_VERT_MARGIN; double y = ONECODE_VERT_MARGIN;
double length; double length = 0;
switch ( codedData[i] ) switch ( codedData[i] )
{ {
@@ -539,6 +539,7 @@ namespace glbarcode
// Not reached // Not reached
break; break;
} }
double width = ONECODE_BAR_WIDTH; double width = ONECODE_BAR_WIDTH;
addLine( x, y, width, length ); addLine( x, y, width, length );
+4 -4
View File
@@ -46,19 +46,19 @@ namespace glbarcode
* *
* Used by glbarcode::BarcodeFactory * Used by glbarcode::BarcodeFactory
*/ */
static Barcode* create( void ); static Barcode* create();
private: private:
bool validate( const std::string& rawData ); bool validate( const std::string& rawData ) override;
std::string encode( const std::string& cookedData ); std::string encode( const std::string& cookedData ) override;
void vectorize( const std::string& codedData, void vectorize( const std::string& codedData,
const std::string& displayText, const std::string& displayText,
const std::string& cookedData, const std::string& cookedData,
double& w, double& w,
double& h ); double& h ) override;
private: private:
+4 -4
View File
@@ -69,7 +69,7 @@ namespace glbarcode
/* /*
* Static Postnet barcode creation method * Static Postnet barcode creation method
*/ */
Barcode* BarcodePostnet::create( void ) Barcode* BarcodePostnet::create( )
{ {
return new BarcodePostnet(); return new BarcodePostnet();
} }
@@ -153,10 +153,9 @@ namespace glbarcode
double x = POSTNET_HORIZ_MARGIN; double x = POSTNET_HORIZ_MARGIN;
for ( unsigned int i=0; i < codedData.size(); i++ ) for ( unsigned int i=0; i < codedData.size(); i++ )
{ {
double length, width;
double y = POSTNET_VERT_MARGIN; double y = POSTNET_VERT_MARGIN;
double length = 0;
switch ( codedData[i] ) switch ( codedData[i] )
{ {
case '0': case '0':
@@ -170,7 +169,8 @@ namespace glbarcode
// Not reached // Not reached
break; break;
} }
width = POSTNET_BAR_WIDTH;
double width = POSTNET_BAR_WIDTH;
addLine( x, y, width, length ); addLine( x, y, width, length );
+4 -4
View File
@@ -69,7 +69,7 @@ namespace glbarcode
* *
* Used by glbarcode::BarcodeFactory * Used by glbarcode::BarcodeFactory
*/ */
static Barcode* create( void ); static Barcode* create();
protected: protected:
@@ -80,15 +80,15 @@ namespace glbarcode
private: private:
bool validate( const std::string& rawData ); bool validate( const std::string& rawData ) override;
std::string encode( const std::string& cookedData ); std::string encode( const std::string& cookedData ) override;
void vectorize( const std::string& codedData, void vectorize( const std::string& codedData,
const std::string& displayText, const std::string& displayText,
const std::string& cookedData, const std::string& cookedData,
double& w, double& w,
double& h ); double& h ) override;
}; };
+1 -1
View File
@@ -27,7 +27,7 @@ namespace glbarcode
/* /*
* Static Postnet-11 barcode creation method * Static Postnet-11 barcode creation method
*/ */
Barcode* BarcodePostnet11::create( void ) Barcode* BarcodePostnet11::create( )
{ {
return new BarcodePostnet11(); return new BarcodePostnet11();
} }
+2 -2
View File
@@ -52,11 +52,11 @@ namespace glbarcode
* *
* Used by glbarcode::BarcodeFactory * Used by glbarcode::BarcodeFactory
*/ */
static Barcode* create( void ); static Barcode* create();
private: private:
bool validateDigits( int nDigits ); bool validateDigits( int nDigits ) override;
}; };
+1 -1
View File
@@ -27,7 +27,7 @@ namespace glbarcode
/* /*
* Static Postnet-5 barcode creation method * Static Postnet-5 barcode creation method
*/ */
Barcode* BarcodePostnet5::create( void ) Barcode* BarcodePostnet5::create( )
{ {
return new BarcodePostnet5(); return new BarcodePostnet5();
} }
+2 -2
View File
@@ -52,11 +52,11 @@ namespace glbarcode
* *
* Used by glbarcode::BarcodeFactory * Used by glbarcode::BarcodeFactory
*/ */
static Barcode* create( void ); static Barcode* create();
private: private:
bool validateDigits( int nDigits ); bool validateDigits( int nDigits ) override;
}; };
+1 -1
View File
@@ -27,7 +27,7 @@ namespace glbarcode
/* /*
* Static Postnet-9 barcode creation method * Static Postnet-9 barcode creation method
*/ */
Barcode* BarcodePostnet9::create( void ) Barcode* BarcodePostnet9::create( )
{ {
return new BarcodePostnet9(); return new BarcodePostnet9();
} }
+2 -2
View File
@@ -52,11 +52,11 @@ namespace glbarcode
* *
* Used by glbarcode::BarcodeFactory * Used by glbarcode::BarcodeFactory
*/ */
static Barcode* create( void ); static Barcode* create();
private: private:
bool validateDigits( int nDigits ); bool validateDigits( int nDigits ) override;
}; };
+3 -3
View File
@@ -43,14 +43,14 @@ namespace glbarcode
* *
* Used by glbarcode::BarcodeFactory * Used by glbarcode::BarcodeFactory
*/ */
static Barcode* create( void ); static Barcode* create();
private: private:
bool validate( const std::string& rawData ); bool validate( const std::string& rawData ) override;
bool encode( const std::string& cookedData, bool encode( const std::string& cookedData,
Matrix<bool>& encodedData ); Matrix<bool>& encodedData ) override;
}; };
+1 -1
View File
@@ -30,7 +30,7 @@ namespace glbarcode
/* /*
* Static UPC-A barcode creation method * Static UPC-A barcode creation method
*/ */
Barcode* BarcodeUpcA::create( void ) Barcode* BarcodeUpcA::create( )
{ {
return new BarcodeUpcA(); return new BarcodeUpcA();
} }
+4 -4
View File
@@ -44,7 +44,7 @@ namespace glbarcode
* *
* Used by glbarcode::BarcodeFactory * Used by glbarcode::BarcodeFactory
*/ */
static Barcode* create( void ); static Barcode* create();
/** /**
@@ -54,9 +54,9 @@ namespace glbarcode
private: private:
bool validateDigits( int nDigits ); bool validateDigits( int nDigits ) override;
std::string preprocess( const std::string& rawData ); std::string preprocess( const std::string& rawData ) override;
void vectorizeText( const std::string& displayText, void vectorizeText( const std::string& displayText,
double size1, double size1,
@@ -66,7 +66,7 @@ namespace glbarcode
double y1, double y1,
double x2Left, double x2Left,
double x2Right, double x2Right,
double y2 ); double y2 ) override;
}; };
+4 -4
View File
@@ -49,17 +49,17 @@ namespace glbarcode
double y2 ) = 0; double y2 ) = 0;
private: private:
bool validate( const std::string& rawData ); bool validate( const std::string& rawData ) override;
std::string encode( const std::string& cookedData ); std::string encode( const std::string& cookedData ) override;
std::string prepareText( const std::string& rawData ); std::string prepareText( const std::string& rawData ) override;
void vectorize( const std::string& codedData, void vectorize( const std::string& codedData,
const std::string& displayText, const std::string& displayText,
const std::string& cookedData, const std::string& cookedData,
double& w, double& w,
double& h ); double& h ) override;
protected: protected:
+5 -5
View File
@@ -63,11 +63,11 @@ namespace glbarcode
} }
void Factory::init( void ) void Factory::init( )
{ {
static Factory* singletonInstance = NULL; static Factory* singletonInstance = nullptr;
if ( singletonInstance == NULL ) if ( singletonInstance == nullptr )
{ {
singletonInstance = new Factory(); singletonInstance = new Factory();
} }
@@ -92,7 +92,7 @@ namespace glbarcode
} }
TypeIdList Factory::getSupportedTypes( void ) TypeIdList Factory::getSupportedTypes( )
{ {
init(); init();
@@ -111,7 +111,7 @@ namespace glbarcode
return i->second(); return i->second();
} }
return NULL; return nullptr;
} }
+3 -3
View File
@@ -48,7 +48,7 @@ namespace glbarcode
/** /**
* Barcode creation function signature. * Barcode creation function signature.
*/ */
typedef Barcode* (*BarcodeCreateFct)( void ); typedef Barcode* (*BarcodeCreateFct)();
private: private:
@@ -66,7 +66,7 @@ namespace glbarcode
* is optional for an application to call init(), because glbarcode++ will automatically * is optional for an application to call init(), because glbarcode++ will automatically
* initialize the factory on demand. * initialize the factory on demand.
*/ */
static void init( void ); static void init();
/** /**
@@ -97,7 +97,7 @@ namespace glbarcode
/** /**
* Get list of supported types. * Get list of supported types.
*/ */
static TypeIdList getSupportedTypes( void ); static TypeIdList getSupportedTypes();
private: private:
+9 -9
View File
@@ -37,7 +37,7 @@ namespace glbarcode
/** /**
* Default constructor. * Default constructor.
*/ */
Matrix() : mNx(0), mNy(0), mData(NULL) { } Matrix() : mNx(0), mNy(0), mData(nullptr) { }
/** /**
@@ -45,7 +45,7 @@ namespace glbarcode
*/ */
Matrix( int nx, int ny ) : mNx(nx), Matrix( int nx, int ny ) : mNx(nx),
mNy(ny), mNy(ny),
mData((nx > 0 && ny > 0) ? new T[nx * ny] : NULL) { } mData((nx > 0 && ny > 0) ? new T[nx * ny] : nullptr) { }
/** /**
@@ -53,7 +53,7 @@ namespace glbarcode
*/ */
Matrix( const Matrix<T>& src ) : mNx(src.mNx), Matrix( const Matrix<T>& src ) : mNx(src.mNx),
mNy(src.mNy), mNy(src.mNy),
mData((src.mNx > 0 && src.mNy > 0) ? new T[src.mNx * src.mNy] : NULL) mData((src.mNx > 0 && src.mNy > 0) ? new T[src.mNx * src.mNy] : nullptr)
{ {
for ( int iy = 0; iy < mNy; iy++ ) for ( int iy = 0; iy < mNy; iy++ )
{ {
@@ -74,7 +74,7 @@ namespace glbarcode
int nx, int nx,
int ny ) : mNx(nx), int ny ) : mNx(nx),
mNy(ny), mNy(ny),
mData((nx > 0 && ny > 0) ? new T[nx * ny] : NULL) mData((nx > 0 && ny > 0) ? new T[nx * ny] : nullptr)
{ {
for ( int iy = 0; iy < mNy; iy++ ) for ( int iy = 0; iy < mNy; iy++ )
{ {
@@ -97,7 +97,7 @@ namespace glbarcode
*/ */
~Matrix() ~Matrix()
{ {
if ( mData != NULL ) if ( mData != nullptr )
{ {
delete[] mData; delete[] mData;
} }
@@ -127,13 +127,13 @@ namespace glbarcode
*/ */
inline void resize( int nx, int ny ) inline void resize( int nx, int ny )
{ {
if ( mData != NULL ) if ( mData != nullptr )
{ {
delete[] mData; delete[] mData;
} }
mNx = nx; mNx = nx;
mNy = ny; mNy = ny;
mData = (nx > 0 && ny > 0) ? new T[nx * ny] : NULL; mData = (nx > 0 && ny > 0) ? new T[nx * ny] : nullptr;
} }
@@ -142,7 +142,7 @@ namespace glbarcode
* *
* @returns Value of "nx" parameter * @returns Value of "nx" parameter
*/ */
inline int nx( void ) const inline int nx() const
{ {
return mNx; return mNx;
} }
@@ -153,7 +153,7 @@ namespace glbarcode
* *
* @returns Value of "ny" parameter * @returns Value of "ny" parameter
*/ */
inline int ny( void ) const inline int ny() const
{ {
return mNy; return mNy;
} }
+4 -4
View File
@@ -73,7 +73,7 @@ namespace glbarcode
} }
QPainter* QtRenderer::painter( void ) const QPainter* QtRenderer::painter( ) const
{ {
return d->painter; return d->painter;
} }
@@ -97,7 +97,7 @@ namespace glbarcode
} }
void QtRenderer::drawEnd( void ) void QtRenderer::drawEnd( )
{ {
if ( d->painter ) if ( d->painter )
{ {
@@ -110,10 +110,10 @@ namespace glbarcode
{ {
if ( d->painter ) if ( d->painter )
{ {
double x = x + w/2; // Offset line origin by 1/2 line width. double x1 = x + w/2; // Offset line origin by 1/2 line width.
d->painter->setPen( QPen( d->color, w ) ); d->painter->setPen( QPen( d->color, w ) );
d->painter->drawLine( QPointF(x, y), QPointF(x, y+h) ); d->painter->drawLine( QPointF(x1, y), QPointF(x1, y+h) );
} }
} }
+8 -8
View File
@@ -56,7 +56,7 @@ namespace glbarcode
/** /**
* Destructor * Destructor
*/ */
virtual ~QtRenderer(); ~QtRenderer() override;
/** Assignment operator. /** Assignment operator.
* *
@@ -85,13 +85,13 @@ namespace glbarcode
/* /*
* Virtual methods implemented by QtRenderer. * Virtual methods implemented by QtRenderer.
*/ */
void drawBegin( double w, double h ); void drawBegin( double w, double h ) override;
void drawEnd(); void drawEnd() override;
void drawLine( double x, double y, double w, double h ); void drawLine( double x, double y, double w, double h ) override;
void drawBox( double x, double y, double w, double h ); void drawBox( double x, double y, double w, double h ) override;
void drawText( double x, double y, double size, const std::string& text ); void drawText( double x, double y, double size, const std::string& text ) override;
void drawRing( double x, double y, double r, double w ); void drawRing( double x, double y, double r, double w ) override;
void drawHexagon( double x, double y, double h ); void drawHexagon( double x, double y, double h ) override;
/** /**
* Private data * Private data
+1 -1
View File
@@ -82,7 +82,7 @@ namespace glbarcode
* Required virtual method to perform rendering cleanup, such as closing devices * Required virtual method to perform rendering cleanup, such as closing devices
* and/or drawing contexts. * and/or drawing contexts.
*/ */
virtual void drawEnd( void ) = 0; virtual void drawEnd() = 0;
/** /**