Big-Ugly Style Update (#278)
* Bulk replaced tabs with spaces * Bulk removed trailing whitespace from lines * Replaced c-style comments with c++-style comments in file banners * Replace nested namespace definitions with single concise definitions (C++17), this keeps the indentation more manageable * Cleanup ordering and spacing of include directives * Bulk renaming of header file extensions from '.h' to '.hpp'. * Update CODING-STYLE.md * Update target_compile_features from cxx_std_11 to cxx_std_20. * Refresh .clang-format file. Still needs a lot of tweaking.
This commit is contained in:
+88
-87
@@ -1,117 +1,118 @@
|
||||
/* Barcode1dBase.cpp
|
||||
*
|
||||
* Copyright (C) 2013 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of glbarcode++.
|
||||
*
|
||||
* glbarcode++ is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* glbarcode++ is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with glbarcode++. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
// Barcode1dBase.cpp
|
||||
//
|
||||
// Copyright (C) 2013 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of glbarcode++.
|
||||
//
|
||||
// glbarcode++ is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// glbarcode++ is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with glbarcode++. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#include "Barcode1dBase.h"
|
||||
|
||||
#include "Barcode1dBase.hpp"
|
||||
|
||||
#include "DrawingPrimitives.hpp"
|
||||
|
||||
#include <list>
|
||||
|
||||
#include "DrawingPrimitives.h"
|
||||
|
||||
|
||||
namespace glbarcode
|
||||
{
|
||||
|
||||
/*
|
||||
* Barcode1dBase private data
|
||||
*/
|
||||
struct Barcode1dBase::PrivateData {
|
||||
int dummy;
|
||||
};
|
||||
/*
|
||||
* Barcode1dBase private data
|
||||
*/
|
||||
struct Barcode1dBase::PrivateData {
|
||||
int dummy;
|
||||
};
|
||||
|
||||
|
||||
Barcode1dBase::Barcode1dBase()
|
||||
{
|
||||
d = new Barcode1dBase::PrivateData;
|
||||
}
|
||||
Barcode1dBase::Barcode1dBase()
|
||||
{
|
||||
d = new Barcode1dBase::PrivateData;
|
||||
}
|
||||
|
||||
|
||||
Barcode1dBase::~Barcode1dBase()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
Barcode1dBase::~Barcode1dBase()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
|
||||
|
||||
Barcode& Barcode1dBase::build( const std::string& rawData,
|
||||
double w,
|
||||
double h )
|
||||
{
|
||||
std::string cookedData; /* Preprocessed data */
|
||||
std::string displayText; /* Text data to be displayed */
|
||||
std::string codedData; /* Encoded data */
|
||||
Barcode& Barcode1dBase::build( const std::string& rawData,
|
||||
double w,
|
||||
double h )
|
||||
{
|
||||
std::string cookedData; /* Preprocessed data */
|
||||
std::string displayText; /* Text data to be displayed */
|
||||
std::string codedData; /* Encoded data */
|
||||
|
||||
clear();
|
||||
clear();
|
||||
|
||||
if ( rawData.empty() )
|
||||
{
|
||||
setIsEmpty( true );
|
||||
setIsDataValid( false );
|
||||
if ( rawData.empty() )
|
||||
{
|
||||
setIsEmpty( true );
|
||||
setIsDataValid( false );
|
||||
|
||||
setWidth( 0 );
|
||||
setHeight( 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
setIsEmpty( false );
|
||||
setWidth( 0 );
|
||||
setHeight( 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
setIsEmpty( false );
|
||||
|
||||
if ( !validate( rawData ) )
|
||||
{
|
||||
setIsDataValid( false );
|
||||
if ( !validate( rawData ) )
|
||||
{
|
||||
setIsDataValid( false );
|
||||
|
||||
setWidth( 0 );
|
||||
setHeight( 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
setIsDataValid( true );
|
||||
setWidth( 0 );
|
||||
setHeight( 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
setIsDataValid( true );
|
||||
|
||||
cookedData = preprocess( rawData );
|
||||
codedData = encode( cookedData );
|
||||
displayText = prepareText( rawData );
|
||||
cookedData = preprocess( rawData );
|
||||
codedData = encode( cookedData );
|
||||
displayText = prepareText( rawData );
|
||||
|
||||
vectorize( codedData, displayText, cookedData, w, h );
|
||||
vectorize( codedData, displayText, cookedData, w, h );
|
||||
|
||||
setWidth( w );
|
||||
setHeight( h );
|
||||
}
|
||||
}
|
||||
setWidth( w );
|
||||
setHeight( h );
|
||||
}
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Default preprocess method
|
||||
*/
|
||||
std::string Barcode1dBase::preprocess( const std::string& rawData )
|
||||
{
|
||||
return rawData;
|
||||
}
|
||||
/*
|
||||
* Default preprocess method
|
||||
*/
|
||||
std::string Barcode1dBase::preprocess( const std::string& rawData )
|
||||
{
|
||||
return rawData;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Default prepareText method
|
||||
*/
|
||||
std::string Barcode1dBase::prepareText( const std::string& rawData )
|
||||
{
|
||||
return rawData;
|
||||
}
|
||||
/*
|
||||
* Default prepareText method
|
||||
*/
|
||||
std::string Barcode1dBase::prepareText( const std::string& rawData )
|
||||
{
|
||||
return rawData;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user