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:
+505
-507
File diff suppressed because it is too large
Load Diff
@@ -1,98 +0,0 @@
|
||||
/* Backends.h
|
||||
*
|
||||
* Copyright (C) 2014 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef barcode_Backends_h
|
||||
#define barcode_Backends_h
|
||||
|
||||
|
||||
#include "Style.h"
|
||||
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
namespace barcode
|
||||
{
|
||||
|
||||
///
|
||||
/// Backends Database
|
||||
///
|
||||
class Backends : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
private:
|
||||
Backends();
|
||||
|
||||
public:
|
||||
static void init();
|
||||
|
||||
/////////////////////////////////
|
||||
// Public Methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
static const QStringList& backendList();
|
||||
static QString backendName( const QString& backendId );
|
||||
static const QList<Style>& styleList();
|
||||
static const Style& defaultStyle();
|
||||
static const Style& style( const QString& backendId, const QString& StyleId );
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Private Methods
|
||||
/////////////////////////////////
|
||||
private:
|
||||
static void registerBackend( const QString &backendId, const QString &backendName );
|
||||
|
||||
static void registerStyle( const QString& id,
|
||||
const QString& backendId,
|
||||
const QString& name,
|
||||
bool canText,
|
||||
bool textOptional,
|
||||
bool canChecksum,
|
||||
bool checksumOptional,
|
||||
const QString& defaultDigits,
|
||||
bool canFreeForm,
|
||||
int preferedN );
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Private Members
|
||||
/////////////////////////////////
|
||||
static QStringList mBackendIdList;
|
||||
static QMap<QString,QString> mBackendNameMap;
|
||||
|
||||
static QList<Style> mStyleList;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif // barcode_Backends_h
|
||||
@@ -0,0 +1,95 @@
|
||||
// Backends.hpp
|
||||
//
|
||||
// Copyright (C) 2014 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt 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 General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#ifndef barcode_Backends_hpp
|
||||
#define barcode_Backends_hpp
|
||||
|
||||
|
||||
#include "Style.hpp"
|
||||
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
|
||||
|
||||
namespace glabels::barcode
|
||||
{
|
||||
|
||||
///
|
||||
/// Backends Database
|
||||
///
|
||||
class Backends : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
private:
|
||||
Backends();
|
||||
|
||||
public:
|
||||
static void init();
|
||||
|
||||
/////////////////////////////////
|
||||
// Public Methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
static const QStringList& backendList();
|
||||
static QString backendName( const QString& backendId );
|
||||
static const QList<Style>& styleList();
|
||||
static const Style& defaultStyle();
|
||||
static const Style& style( const QString& backendId, const QString& StyleId );
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Private Methods
|
||||
/////////////////////////////////
|
||||
private:
|
||||
static void registerBackend( const QString &backendId, const QString &backendName );
|
||||
|
||||
static void registerStyle( const QString& id,
|
||||
const QString& backendId,
|
||||
const QString& name,
|
||||
bool canText,
|
||||
bool textOptional,
|
||||
bool canChecksum,
|
||||
bool checksumOptional,
|
||||
const QString& defaultDigits,
|
||||
bool canFreeForm,
|
||||
int preferedN );
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Private Members
|
||||
/////////////////////////////////
|
||||
static QStringList mBackendIdList;
|
||||
static QMap<QString,QString> mBackendNameMap;
|
||||
|
||||
static QList<Style> mStyleList;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // barcode_Backends_hpp
|
||||
@@ -37,7 +37,7 @@ set (barcode_sources
|
||||
)
|
||||
|
||||
set (barcode_qobject_headers
|
||||
Backends.h
|
||||
Backends.hpp
|
||||
)
|
||||
|
||||
qt6_wrap_cpp (barcode_moc_sources ${barcode_qobject_headers})
|
||||
@@ -50,10 +50,9 @@ add_library (Barcode STATIC
|
||||
${barcode_moc_sources}
|
||||
)
|
||||
|
||||
#target_compile_features (Barcode
|
||||
# PUBLIC cxx_std_11
|
||||
#)
|
||||
set_property (TARGET Barcode PROPERTY CXX_STANDARD 11)
|
||||
target_compile_features (Barcode
|
||||
PUBLIC cxx_std_20
|
||||
)
|
||||
|
||||
target_include_directories (Barcode
|
||||
PUBLIC ..
|
||||
|
||||
+891
-893
File diff suppressed because it is too large
Load Diff
@@ -1,424 +0,0 @@
|
||||
/* GnuBarcode.h
|
||||
*
|
||||
* Copyright (C) 2017 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef barcode_GnuBarcode_h
|
||||
#define barcode_GnuBarcode_h
|
||||
|
||||
#if HAVE_GNU_BARCODE
|
||||
|
||||
#include "glbarcode/Barcode1dBase.h"
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
namespace barcode
|
||||
{
|
||||
namespace GnuBarcode
|
||||
{
|
||||
|
||||
/**
|
||||
* GnuBarcode::Base base class for all GNU Barcodes
|
||||
*
|
||||
* Implements glbarcode::Barcode1dBase.
|
||||
*/
|
||||
class Base : public glbarcode::Barcode1dBase
|
||||
{
|
||||
protected:
|
||||
int flags;
|
||||
|
||||
bool isAscii( const std::string& data ) const;
|
||||
|
||||
bool isNumericLengthValid( const std::string& data,
|
||||
unsigned int nMin,
|
||||
unsigned int nMax ) const;
|
||||
|
||||
bool isNumericLength1Valid( const std::string& data,
|
||||
unsigned int nMin,
|
||||
unsigned int nMax ) const;
|
||||
|
||||
bool isNumericLength2Valid( const std::string& data,
|
||||
unsigned int nMin,
|
||||
unsigned int nMax ) const;
|
||||
|
||||
void vectorize( const std::string& encodedData,
|
||||
const std::string& displayText,
|
||||
const std::string& cookedData,
|
||||
double& w,
|
||||
double& h ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* EAN Barcode (Any)
|
||||
*/
|
||||
class Ean : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* EAN-8 Barcode
|
||||
*/
|
||||
class Ean8 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* EAN-8+2 Barcode
|
||||
*/
|
||||
class Ean8_2 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* EAN-8+5 Barcode
|
||||
*/
|
||||
class Ean8_5 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* EAN-13 Barcode
|
||||
*/
|
||||
class Ean13 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* EAN-13+2 Barcode
|
||||
*/
|
||||
class Ean13_2 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* EAN-13+5 Barcode
|
||||
*/
|
||||
class Ean13_5 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* UPC Barcode (Any)
|
||||
*/
|
||||
class Upc : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* UPC-A Barcode
|
||||
*/
|
||||
class UpcA : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* UPC-A+2 Barcode
|
||||
*/
|
||||
class UpcA_2 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* UPC-A+5 Barcode
|
||||
*/
|
||||
class UpcA_5 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* UPC-E Barcode
|
||||
*/
|
||||
class UpcE : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* UPC-E+2 Barcode
|
||||
*/
|
||||
class UpcE_2 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* UPC-E+5 Barcode
|
||||
*/
|
||||
class UpcE_5 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* ISBN Barcode
|
||||
*/
|
||||
class Isbn : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* ISBN+5 Barcode
|
||||
*/
|
||||
class Isbn_5 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Code39 Barcode
|
||||
*/
|
||||
class Code39 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Code128 Barcode
|
||||
*/
|
||||
class Code128 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Code128C Barcode
|
||||
*/
|
||||
class Code128C : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Code128B Barcode
|
||||
*/
|
||||
class Code128B : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* I25 Barcode
|
||||
*/
|
||||
class I25 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* CBR Barcode
|
||||
*/
|
||||
class Cbr : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* MSI Barcode
|
||||
*/
|
||||
class Msi : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* PLS Barcode
|
||||
*/
|
||||
class Pls : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Code93 Barcode
|
||||
*/
|
||||
class Code93 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif // HAVE_GNU_BARCODE
|
||||
|
||||
#endif // barcode_GnuBarcode_h
|
||||
@@ -0,0 +1,419 @@
|
||||
// GnuBarcode.hpp
|
||||
//
|
||||
// Copyright (C) 2017 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt 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 General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#ifndef barcode_GnuBarcode_hpp
|
||||
#define barcode_GnuBarcode_hpp
|
||||
|
||||
#if HAVE_GNU_BARCODE
|
||||
|
||||
|
||||
#include "glbarcode/Barcode1dBase.hpp"
|
||||
|
||||
|
||||
namespace glabels::barcode::GnuBarcode
|
||||
{
|
||||
|
||||
/**
|
||||
* GnuBarcode::Base base class for all GNU Barcodes
|
||||
*
|
||||
* Implements glbarcode::Barcode1dBase.
|
||||
*/
|
||||
class Base : public glbarcode::Barcode1dBase
|
||||
{
|
||||
protected:
|
||||
int flags;
|
||||
|
||||
bool isAscii( const std::string& data ) const;
|
||||
|
||||
bool isNumericLengthValid( const std::string& data,
|
||||
unsigned int nMin,
|
||||
unsigned int nMax ) const;
|
||||
|
||||
bool isNumericLength1Valid( const std::string& data,
|
||||
unsigned int nMin,
|
||||
unsigned int nMax ) const;
|
||||
|
||||
bool isNumericLength2Valid( const std::string& data,
|
||||
unsigned int nMin,
|
||||
unsigned int nMax ) const;
|
||||
|
||||
void vectorize( const std::string& encodedData,
|
||||
const std::string& displayText,
|
||||
const std::string& cookedData,
|
||||
double& w,
|
||||
double& h ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* EAN Barcode (Any)
|
||||
*/
|
||||
class Ean : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* EAN-8 Barcode
|
||||
*/
|
||||
class Ean8 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* EAN-8+2 Barcode
|
||||
*/
|
||||
class Ean8_2 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* EAN-8+5 Barcode
|
||||
*/
|
||||
class Ean8_5 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* EAN-13 Barcode
|
||||
*/
|
||||
class Ean13 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* EAN-13+2 Barcode
|
||||
*/
|
||||
class Ean13_2 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* EAN-13+5 Barcode
|
||||
*/
|
||||
class Ean13_5 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* UPC Barcode (Any)
|
||||
*/
|
||||
class Upc : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* UPC-A Barcode
|
||||
*/
|
||||
class UpcA : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* UPC-A+2 Barcode
|
||||
*/
|
||||
class UpcA_2 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* UPC-A+5 Barcode
|
||||
*/
|
||||
class UpcA_5 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* UPC-E Barcode
|
||||
*/
|
||||
class UpcE : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* UPC-E+2 Barcode
|
||||
*/
|
||||
class UpcE_2 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* UPC-E+5 Barcode
|
||||
*/
|
||||
class UpcE_5 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* ISBN Barcode
|
||||
*/
|
||||
class Isbn : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* ISBN+5 Barcode
|
||||
*/
|
||||
class Isbn_5 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Code39 Barcode
|
||||
*/
|
||||
class Code39 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Code128 Barcode
|
||||
*/
|
||||
class Code128 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Code128C Barcode
|
||||
*/
|
||||
class Code128C : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Code128B Barcode
|
||||
*/
|
||||
class Code128B : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* I25 Barcode
|
||||
*/
|
||||
class I25 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* CBR Barcode
|
||||
*/
|
||||
class Cbr : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* MSI Barcode
|
||||
*/
|
||||
class Msi : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* PLS Barcode
|
||||
*/
|
||||
class Pls : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Code93 Barcode
|
||||
*/
|
||||
class Code93 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // HAVE_GNU_BARCODE
|
||||
|
||||
#endif // barcode_GnuBarcode_hpp
|
||||
@@ -1,91 +1,86 @@
|
||||
/* QrEncode.cpp
|
||||
*
|
||||
* Copyright (C) 2017 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
// QrEncode.cpp
|
||||
//
|
||||
// Copyright (C) 2017 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt 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 General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#if HAVE_QRENCODE
|
||||
|
||||
#include "QrEncode.h"
|
||||
|
||||
#include "QrEncode.hpp"
|
||||
|
||||
#include <qrencode.h>
|
||||
|
||||
|
||||
namespace glabels
|
||||
namespace glabels::barcode::QrEncode
|
||||
{
|
||||
namespace barcode
|
||||
{
|
||||
namespace QrEncode
|
||||
{
|
||||
|
||||
/*
|
||||
* Static QrCode barcode creation method
|
||||
*/
|
||||
glbarcode::Barcode* QrCode::create()
|
||||
{
|
||||
return new QrCode();
|
||||
}
|
||||
/*
|
||||
* Static QrCode barcode creation method
|
||||
*/
|
||||
glbarcode::Barcode* QrCode::create()
|
||||
{
|
||||
return new QrCode();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* QrCode data validation, implements glbarcode::Barcode2dBase::validate()
|
||||
*/
|
||||
bool QrCode::validate( const std::string& rawData )
|
||||
{
|
||||
if ( rawData.size() == 0 )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/*
|
||||
* QrCode data validation, implements glbarcode::Barcode2dBase::validate()
|
||||
*/
|
||||
bool QrCode::validate( const std::string& rawData )
|
||||
{
|
||||
if ( rawData.size() == 0 )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* QrCode data encoding, implements glbarcode::Barcode2dBase::encode()
|
||||
*/
|
||||
bool QrCode::encode( const std::string& cookedData, glbarcode::Matrix<bool>& encodedData )
|
||||
{
|
||||
QRcode *qrcode = QRcode_encodeString( cookedData.c_str(), 0, QR_ECLEVEL_M, QR_MODE_8, 1 );
|
||||
if ( qrcode == nullptr )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
/*
|
||||
* QrCode data encoding, implements glbarcode::Barcode2dBase::encode()
|
||||
*/
|
||||
bool QrCode::encode( const std::string& cookedData, glbarcode::Matrix<bool>& encodedData )
|
||||
{
|
||||
QRcode *qrcode = QRcode_encodeString( cookedData.c_str(), 0, QR_ECLEVEL_M, QR_MODE_8, 1 );
|
||||
if ( qrcode == nullptr )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
int w = qrcode->width;
|
||||
encodedData.resize( w, w );
|
||||
|
||||
|
||||
for ( int iy = 0; iy < w; iy++ )
|
||||
{
|
||||
for ( int ix = 0; ix < w; ix++ )
|
||||
{
|
||||
encodedData[iy][ix] = qrcode->data[ iy*w + ix ] & 0x01;
|
||||
}
|
||||
}
|
||||
int w = qrcode->width;
|
||||
encodedData.resize( w, w );
|
||||
|
||||
|
||||
QRcode_free( qrcode );
|
||||
for ( int iy = 0; iy < w; iy++ )
|
||||
{
|
||||
for ( int ix = 0; ix < w; ix++ )
|
||||
{
|
||||
encodedData[iy][ix] = qrcode->data[ iy*w + ix ] & 0x01;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
QRcode_free( qrcode );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
/* QrEncode.h
|
||||
*
|
||||
* Copyright (C) 2017 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef barcode_QrEncode_h
|
||||
#define barcode_QrEncode_h
|
||||
|
||||
#if HAVE_QRENCODE
|
||||
|
||||
#include "glbarcode/Barcode2dBase.h"
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
namespace barcode
|
||||
{
|
||||
namespace QrEncode
|
||||
{
|
||||
|
||||
/**
|
||||
* QrEncode::QrCode QR Code Barcode
|
||||
*
|
||||
* Implements glbarcode::Barcode2dBase.
|
||||
*/
|
||||
class QrCode : public glbarcode::Barcode2dBase
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
private:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
|
||||
bool encode( const std::string& cookedData,
|
||||
glbarcode::Matrix<bool>& encodedData ) override;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif // HAVE_QRENCODE
|
||||
|
||||
#endif // barcode_QrEncode_h
|
||||
@@ -0,0 +1,55 @@
|
||||
// QrEncode.hpp
|
||||
//
|
||||
// Copyright (C) 2017 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt 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 General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#ifndef barcode_QrEncode_hpp
|
||||
#define barcode_QrEncode_hpp
|
||||
|
||||
#if HAVE_QRENCODE
|
||||
|
||||
|
||||
#include "glbarcode/Barcode2dBase.hpp"
|
||||
|
||||
|
||||
namespace glabels::barcode::QrEncode
|
||||
{
|
||||
|
||||
///
|
||||
/// QrEncode::QrCode QR Code Barcode
|
||||
///
|
||||
/// Implements glbarcode::Barcode2dBase.
|
||||
///
|
||||
class QrCode : public glbarcode::Barcode2dBase
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
private:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
|
||||
bool encode( const std::string& cookedData,
|
||||
glbarcode::Matrix<bool>& encodedData ) override;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // HAVE_QRENCODE
|
||||
|
||||
#endif // barcode_QrEncode_hpp
|
||||
+190
-192
@@ -1,225 +1,223 @@
|
||||
/* Style.cpp
|
||||
*
|
||||
* Copyright (C) 2013 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "Style.h"
|
||||
|
||||
#include "Backends.h"
|
||||
// Style.cpp
|
||||
//
|
||||
// Copyright (C) 2013 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt 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 General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
|
||||
namespace glabels
|
||||
#include "Style.hpp"
|
||||
|
||||
#include "Backends.hpp"
|
||||
|
||||
|
||||
namespace glabels::barcode
|
||||
{
|
||||
namespace barcode
|
||||
{
|
||||
|
||||
///
|
||||
/// Default Constructor
|
||||
///
|
||||
Style::Style ()
|
||||
: mId( "" ),
|
||||
mBackendId( "" ),
|
||||
mName( "" ),
|
||||
mCanText( false ),
|
||||
mTextOptional( false ),
|
||||
mCanChecksum( false ),
|
||||
mChecksumOptional( false ),
|
||||
mDefaultDigits( "" ),
|
||||
mCanFreeform( false ),
|
||||
mPreferedN( 0 )
|
||||
{
|
||||
// empty
|
||||
}
|
||||
|
||||
///
|
||||
/// Default Constructor
|
||||
///
|
||||
Style::Style ()
|
||||
: mId( "" ),
|
||||
mBackendId( "" ),
|
||||
mName( "" ),
|
||||
mCanText( false ),
|
||||
mTextOptional( false ),
|
||||
mCanChecksum( false ),
|
||||
mChecksumOptional( false ),
|
||||
mDefaultDigits( "" ),
|
||||
mCanFreeform( false ),
|
||||
mPreferedN( 0 )
|
||||
{
|
||||
// empty
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Constructor From Data
|
||||
///
|
||||
Style::Style ( const QString& id,
|
||||
const QString& backendId,
|
||||
const QString& name,
|
||||
bool canText,
|
||||
bool textOptional,
|
||||
bool canChecksum,
|
||||
bool checksumOptional,
|
||||
const QString& defaultDigits,
|
||||
bool canFreeform,
|
||||
int preferedN )
|
||||
: mId( id ),
|
||||
mBackendId( backendId ),
|
||||
mName( name ),
|
||||
mCanText( canText ),
|
||||
mTextOptional( textOptional ),
|
||||
mCanChecksum( canChecksum ),
|
||||
mChecksumOptional( checksumOptional ),
|
||||
mDefaultDigits( defaultDigits ),
|
||||
mCanFreeform( canFreeform ),
|
||||
mPreferedN( preferedN )
|
||||
{
|
||||
// empty
|
||||
}
|
||||
///
|
||||
/// Constructor From Data
|
||||
///
|
||||
Style::Style ( const QString& id,
|
||||
const QString& backendId,
|
||||
const QString& name,
|
||||
bool canText,
|
||||
bool textOptional,
|
||||
bool canChecksum,
|
||||
bool checksumOptional,
|
||||
const QString& defaultDigits,
|
||||
bool canFreeform,
|
||||
int preferedN )
|
||||
: mId( id ),
|
||||
mBackendId( backendId ),
|
||||
mName( name ),
|
||||
mCanText( canText ),
|
||||
mTextOptional( textOptional ),
|
||||
mCanChecksum( canChecksum ),
|
||||
mChecksumOptional( checksumOptional ),
|
||||
mDefaultDigits( defaultDigits ),
|
||||
mCanFreeform( canFreeform ),
|
||||
mPreferedN( preferedN )
|
||||
{
|
||||
// empty
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// ID Property Getter
|
||||
///
|
||||
const QString& Style::id() const
|
||||
{
|
||||
return mId;
|
||||
}
|
||||
///
|
||||
/// ID Property Getter
|
||||
///
|
||||
const QString& Style::id() const
|
||||
{
|
||||
return mId;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Full ID Property Getter
|
||||
///
|
||||
QString Style::fullId() const
|
||||
{
|
||||
if ( mBackendId == "" )
|
||||
{
|
||||
return mId;
|
||||
}
|
||||
else
|
||||
{
|
||||
return mBackendId + "::" + mId;
|
||||
}
|
||||
}
|
||||
///
|
||||
/// Full ID Property Getter
|
||||
///
|
||||
QString Style::fullId() const
|
||||
{
|
||||
if ( mBackendId == "" )
|
||||
{
|
||||
return mId;
|
||||
}
|
||||
else
|
||||
{
|
||||
return mBackendId + "::" + mId;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Backend ID Property Getter
|
||||
///
|
||||
const QString& Style::backendId() const
|
||||
{
|
||||
return mBackendId;
|
||||
}
|
||||
///
|
||||
/// Backend ID Property Getter
|
||||
///
|
||||
const QString& Style::backendId() const
|
||||
{
|
||||
return mBackendId;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Name Property Getter
|
||||
///
|
||||
const QString& Style::name() const
|
||||
{
|
||||
return mName;
|
||||
}
|
||||
///
|
||||
/// Name Property Getter
|
||||
///
|
||||
const QString& Style::name() const
|
||||
{
|
||||
return mName;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Full Name Property Getter
|
||||
///
|
||||
QString Style::fullName() const
|
||||
{
|
||||
if ( mBackendId == "" )
|
||||
{
|
||||
return mName;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Backends::backendName(mBackendId) + " / " + mName;
|
||||
}
|
||||
}
|
||||
///
|
||||
/// Full Name Property Getter
|
||||
///
|
||||
QString Style::fullName() const
|
||||
{
|
||||
if ( mBackendId == "" )
|
||||
{
|
||||
return mName;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Backends::backendName(mBackendId) + " / " + mName;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Can Text Property Getter
|
||||
///
|
||||
bool Style::canText() const
|
||||
{
|
||||
return mCanText;
|
||||
}
|
||||
///
|
||||
/// Can Text Property Getter
|
||||
///
|
||||
bool Style::canText() const
|
||||
{
|
||||
return mCanText;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Text Optional Property Getter
|
||||
///
|
||||
bool Style::textOptional() const
|
||||
{
|
||||
return mTextOptional;
|
||||
}
|
||||
///
|
||||
/// Text Optional Property Getter
|
||||
///
|
||||
bool Style::textOptional() const
|
||||
{
|
||||
return mTextOptional;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Can Checksum Property Getter
|
||||
///
|
||||
bool Style::canChecksum() const
|
||||
{
|
||||
return mCanChecksum;
|
||||
}
|
||||
///
|
||||
/// Can Checksum Property Getter
|
||||
///
|
||||
bool Style::canChecksum() const
|
||||
{
|
||||
return mCanChecksum;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Checksum Optional Property Getter
|
||||
///
|
||||
bool Style::checksumOptional() const
|
||||
{
|
||||
return mChecksumOptional;
|
||||
}
|
||||
///
|
||||
/// Checksum Optional Property Getter
|
||||
///
|
||||
bool Style::checksumOptional() const
|
||||
{
|
||||
return mChecksumOptional;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Default Digits Property Getter
|
||||
///
|
||||
const QString& Style::defaultDigits() const
|
||||
{
|
||||
return mDefaultDigits;
|
||||
}
|
||||
///
|
||||
/// Default Digits Property Getter
|
||||
///
|
||||
const QString& Style::defaultDigits() const
|
||||
{
|
||||
return mDefaultDigits;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Can Freeform Property Getter
|
||||
///
|
||||
bool Style::canFreeform() const
|
||||
{
|
||||
return mCanFreeform;
|
||||
}
|
||||
///
|
||||
/// Can Freeform Property Getter
|
||||
///
|
||||
bool Style::canFreeform() const
|
||||
{
|
||||
return mCanFreeform;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Preferred N Property Getter
|
||||
///
|
||||
int Style::preferedN() const
|
||||
{
|
||||
return mPreferedN;
|
||||
}
|
||||
///
|
||||
/// Preferred N Property Getter
|
||||
///
|
||||
int Style::preferedN() const
|
||||
{
|
||||
return mPreferedN;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Generate Example Digits
|
||||
///
|
||||
QString Style::exampleDigits( int n ) const
|
||||
{
|
||||
if ( mCanFreeform )
|
||||
{
|
||||
return QString( qMax( n, 1 ), QChar('0') );
|
||||
}
|
||||
else
|
||||
{
|
||||
return mDefaultDigits;
|
||||
}
|
||||
}
|
||||
///
|
||||
/// Generate Example Digits
|
||||
///
|
||||
QString Style::exampleDigits( int n ) const
|
||||
{
|
||||
if ( mCanFreeform )
|
||||
{
|
||||
return QString( qMax( n, 1 ), QChar('0') );
|
||||
}
|
||||
else
|
||||
{
|
||||
return mDefaultDigits;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// "Not equals" operator
|
||||
///
|
||||
bool Style::operator!=( const Style& other ) const
|
||||
{
|
||||
return (mBackendId != other.mBackendId) || (mId != other.mId);
|
||||
}
|
||||
|
||||
} // namespace barcode
|
||||
} // namespace glabels
|
||||
///
|
||||
/// "Not equals" operator
|
||||
///
|
||||
bool Style::operator!=( const Style& other ) const
|
||||
{
|
||||
return (mBackendId != other.mBackendId) || (mId != other.mId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,120 +0,0 @@
|
||||
/* Style.h
|
||||
*
|
||||
* Copyright (C) 2013 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef barcode_Style_h
|
||||
#define barcode_Style_h
|
||||
|
||||
|
||||
#include <QString>
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
namespace barcode
|
||||
{
|
||||
|
||||
///
|
||||
/// Style Type
|
||||
///
|
||||
class Style
|
||||
{
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
public:
|
||||
Style ();
|
||||
|
||||
Style ( const QString& id,
|
||||
const QString& backendId,
|
||||
const QString& name,
|
||||
bool canText,
|
||||
bool textOptional,
|
||||
bool canChecksum,
|
||||
bool checksumOptional,
|
||||
const QString& defaultDigits,
|
||||
bool canFreeform,
|
||||
int preferedN );
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Properties
|
||||
/////////////////////////////////
|
||||
const QString& id() const;
|
||||
|
||||
QString fullId() const;
|
||||
|
||||
const QString& backendId() const;
|
||||
|
||||
const QString& name() const;
|
||||
|
||||
QString fullName() const;
|
||||
|
||||
bool canText() const;
|
||||
|
||||
bool textOptional() const;
|
||||
|
||||
bool canChecksum() const;
|
||||
|
||||
bool checksumOptional() const;
|
||||
|
||||
const QString& defaultDigits() const;
|
||||
|
||||
bool canFreeform() const;
|
||||
|
||||
int preferedN() const;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
QString exampleDigits( int n ) const;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Operators
|
||||
/////////////////////////////////
|
||||
public:
|
||||
bool operator!=( const Style& other ) const;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Private Data
|
||||
/////////////////////////////////
|
||||
private:
|
||||
QString mId;
|
||||
QString mBackendId;
|
||||
QString mName;
|
||||
bool mCanText;
|
||||
bool mTextOptional;
|
||||
bool mCanChecksum;
|
||||
bool mChecksumOptional;
|
||||
QString mDefaultDigits;
|
||||
bool mCanFreeform;
|
||||
int mPreferedN;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif // barcode_Style_h
|
||||
@@ -0,0 +1,117 @@
|
||||
// Style.hpp
|
||||
//
|
||||
// Copyright (C) 2013 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt 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 General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#ifndef barcode_Style_hpp
|
||||
#define barcode_Style_hpp
|
||||
|
||||
|
||||
#include <QString>
|
||||
|
||||
|
||||
namespace glabels::barcode
|
||||
{
|
||||
|
||||
///
|
||||
/// Style Type
|
||||
///
|
||||
class Style
|
||||
{
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
public:
|
||||
Style ();
|
||||
|
||||
Style ( const QString& id,
|
||||
const QString& backendId,
|
||||
const QString& name,
|
||||
bool canText,
|
||||
bool textOptional,
|
||||
bool canChecksum,
|
||||
bool checksumOptional,
|
||||
const QString& defaultDigits,
|
||||
bool canFreeform,
|
||||
int preferedN );
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Properties
|
||||
/////////////////////////////////
|
||||
const QString& id() const;
|
||||
|
||||
QString fullId() const;
|
||||
|
||||
const QString& backendId() const;
|
||||
|
||||
const QString& name() const;
|
||||
|
||||
QString fullName() const;
|
||||
|
||||
bool canText() const;
|
||||
|
||||
bool textOptional() const;
|
||||
|
||||
bool canChecksum() const;
|
||||
|
||||
bool checksumOptional() const;
|
||||
|
||||
const QString& defaultDigits() const;
|
||||
|
||||
bool canFreeform() const;
|
||||
|
||||
int preferedN() const;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
QString exampleDigits( int n ) const;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Operators
|
||||
/////////////////////////////////
|
||||
public:
|
||||
bool operator!=( const Style& other ) const;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Private Data
|
||||
/////////////////////////////////
|
||||
private:
|
||||
QString mId;
|
||||
QString mBackendId;
|
||||
QString mName;
|
||||
bool mCanText;
|
||||
bool mTextOptional;
|
||||
bool mCanChecksum;
|
||||
bool mChecksumOptional;
|
||||
QString mDefaultDigits;
|
||||
bool mCanFreeform;
|
||||
int mPreferedN;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // barcode_Style_hpp
|
||||
+1543
-1548
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -20,7 +20,7 @@ set (merge_sources
|
||||
)
|
||||
|
||||
set (merge_qobject_headers
|
||||
Merge.h
|
||||
Merge.hpp
|
||||
)
|
||||
|
||||
qt6_wrap_cpp (merge_moc_sources ${merge_qobject_headers})
|
||||
@@ -33,10 +33,9 @@ add_library (Merge STATIC
|
||||
${merge_moc_sources}
|
||||
)
|
||||
|
||||
#target_compile_features (Merge
|
||||
# PUBLIC cxx_std_11
|
||||
#)
|
||||
set_property (TARGET Merge PROPERTY CXX_STANDARD 11)
|
||||
target_compile_features (Merge
|
||||
PUBLIC cxx_std_20
|
||||
)
|
||||
|
||||
target_include_directories (Merge
|
||||
PUBLIC ..
|
||||
|
||||
+187
-189
@@ -1,222 +1,220 @@
|
||||
/* Merge/Factory.cpp
|
||||
*
|
||||
* Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "Factory.h"
|
||||
|
||||
#include "None.h"
|
||||
#include "TextCsv.h"
|
||||
#include "TextCsvKeys.h"
|
||||
#include "TextTsv.h"
|
||||
#include "TextTsvKeys.h"
|
||||
#include "TextColon.h"
|
||||
#include "TextColonKeys.h"
|
||||
#include "TextSemicolon.h"
|
||||
#include "TextSemicolonKeys.h"
|
||||
// Merge/Factory.cpp
|
||||
//
|
||||
// Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt 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 General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
|
||||
namespace glabels
|
||||
#include "Factory.hpp"
|
||||
|
||||
#include "None.hpp"
|
||||
#include "TextCsv.hpp"
|
||||
#include "TextCsvKeys.hpp"
|
||||
#include "TextTsv.hpp"
|
||||
#include "TextTsvKeys.hpp"
|
||||
#include "TextColon.hpp"
|
||||
#include "TextColonKeys.hpp"
|
||||
#include "TextSemicolon.hpp"
|
||||
#include "TextSemicolonKeys.hpp"
|
||||
|
||||
|
||||
namespace glabels::merge
|
||||
{
|
||||
namespace merge
|
||||
{
|
||||
|
||||
//
|
||||
// Static data
|
||||
//
|
||||
QMap<QString,Factory::BackendEntry> Factory::mBackendIdMap;
|
||||
QMap<QString,Factory::BackendEntry> Factory::mBackendNameMap;
|
||||
QStringList Factory::mNameList;
|
||||
//
|
||||
// Static data
|
||||
//
|
||||
QMap<QString,Factory::BackendEntry> Factory::mBackendIdMap;
|
||||
QMap<QString,Factory::BackendEntry> Factory::mBackendNameMap;
|
||||
QStringList Factory::mNameList;
|
||||
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
Factory::Factory()
|
||||
{
|
||||
registerBackend( None::id(),
|
||||
tr("None"),
|
||||
NONE,
|
||||
&None::create );
|
||||
|
||||
registerBackend( TextCsv::id(),
|
||||
tr("Text: Comma Separated Values (CSV)"),
|
||||
FILE,
|
||||
&TextCsv::create );
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
Factory::Factory()
|
||||
{
|
||||
registerBackend( None::id(),
|
||||
tr("None"),
|
||||
NONE,
|
||||
&None::create );
|
||||
|
||||
registerBackend( TextCsvKeys::id(),
|
||||
tr("Text: Comma Separated Values (CSV), keys on line 1"),
|
||||
FILE,
|
||||
&TextCsvKeys::create );
|
||||
registerBackend( TextCsv::id(),
|
||||
tr("Text: Comma Separated Values (CSV)"),
|
||||
FILE,
|
||||
&TextCsv::create );
|
||||
|
||||
registerBackend( TextTsv::id(),
|
||||
tr("Text: Tab Separated Values (TSV)"),
|
||||
FILE,
|
||||
&TextTsv::create );
|
||||
registerBackend( TextCsvKeys::id(),
|
||||
tr("Text: Comma Separated Values (CSV), keys on line 1"),
|
||||
FILE,
|
||||
&TextCsvKeys::create );
|
||||
|
||||
registerBackend( TextTsvKeys::id(),
|
||||
tr("Text: Tab Separated Values (TSV), keys on line 1"),
|
||||
FILE,
|
||||
&TextTsvKeys::create );
|
||||
registerBackend( TextTsv::id(),
|
||||
tr("Text: Tab Separated Values (TSV)"),
|
||||
FILE,
|
||||
&TextTsv::create );
|
||||
|
||||
registerBackend( TextColon::id(),
|
||||
tr("Text: Colon Separated Values"),
|
||||
FILE,
|
||||
&TextColon::create );
|
||||
registerBackend( TextTsvKeys::id(),
|
||||
tr("Text: Tab Separated Values (TSV), keys on line 1"),
|
||||
FILE,
|
||||
&TextTsvKeys::create );
|
||||
|
||||
registerBackend( TextColonKeys::id(),
|
||||
tr("Text: Colon Separated Values, keys on line 1"),
|
||||
FILE,
|
||||
&TextColonKeys::create );
|
||||
registerBackend( TextColon::id(),
|
||||
tr("Text: Colon Separated Values"),
|
||||
FILE,
|
||||
&TextColon::create );
|
||||
|
||||
registerBackend( TextSemicolon::id(),
|
||||
tr("Text: Semicolon Separated Values"),
|
||||
FILE,
|
||||
&TextSemicolon::create );
|
||||
registerBackend( TextColonKeys::id(),
|
||||
tr("Text: Colon Separated Values, keys on line 1"),
|
||||
FILE,
|
||||
&TextColonKeys::create );
|
||||
|
||||
registerBackend( TextSemicolonKeys::id(),
|
||||
tr("Text: Semicolon Separated Values, keys on line 1"),
|
||||
FILE,
|
||||
&TextSemicolonKeys::create );
|
||||
}
|
||||
registerBackend( TextSemicolon::id(),
|
||||
tr("Text: Semicolon Separated Values"),
|
||||
FILE,
|
||||
&TextSemicolon::create );
|
||||
|
||||
registerBackend( TextSemicolonKeys::id(),
|
||||
tr("Text: Semicolon Separated Values, keys on line 1"),
|
||||
FILE,
|
||||
&TextSemicolonKeys::create );
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Initialize
|
||||
///
|
||||
void Factory::init()
|
||||
{
|
||||
static Factory* singletonInstance = nullptr;
|
||||
if ( !singletonInstance )
|
||||
{
|
||||
singletonInstance = new Factory();
|
||||
}
|
||||
}
|
||||
///
|
||||
/// Initialize
|
||||
///
|
||||
void Factory::init()
|
||||
{
|
||||
static Factory* singletonInstance = nullptr;
|
||||
if ( !singletonInstance )
|
||||
{
|
||||
singletonInstance = new Factory();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Create Merge object
|
||||
///
|
||||
Merge* Factory::createMerge( const QString& id )
|
||||
{
|
||||
QMap<QString,BackendEntry>::iterator iBackend = mBackendIdMap.find( id );
|
||||
if ( iBackend != mBackendIdMap.end() )
|
||||
{
|
||||
return iBackend->create();
|
||||
}
|
||||
|
||||
return None::create();
|
||||
}
|
||||
///
|
||||
/// Create Merge object
|
||||
///
|
||||
Merge* Factory::createMerge( const QString& id )
|
||||
{
|
||||
QMap<QString,BackendEntry>::iterator iBackend = mBackendIdMap.find( id );
|
||||
if ( iBackend != mBackendIdMap.end() )
|
||||
{
|
||||
return iBackend->create();
|
||||
}
|
||||
|
||||
return None::create();
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Get name list
|
||||
///
|
||||
QStringList Factory::nameList()
|
||||
{
|
||||
return mNameList;
|
||||
}
|
||||
///
|
||||
/// Get name list
|
||||
///
|
||||
QStringList Factory::nameList()
|
||||
{
|
||||
return mNameList;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Convert ID to name
|
||||
///
|
||||
QString Factory::idToName( const QString& id )
|
||||
{
|
||||
if ( mBackendIdMap.contains( id ) )
|
||||
{
|
||||
return mBackendIdMap[id].name;
|
||||
}
|
||||
else
|
||||
{
|
||||
return tr("None");
|
||||
}
|
||||
}
|
||||
///
|
||||
/// Convert ID to name
|
||||
///
|
||||
QString Factory::idToName( const QString& id )
|
||||
{
|
||||
if ( mBackendIdMap.contains( id ) )
|
||||
{
|
||||
return mBackendIdMap[id].name;
|
||||
}
|
||||
else
|
||||
{
|
||||
return tr("None");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Convert name to ID
|
||||
///
|
||||
QString Factory::nameToId( const QString& name )
|
||||
{
|
||||
if ( mBackendNameMap.contains( name ) )
|
||||
{
|
||||
return mBackendNameMap[name].id;
|
||||
}
|
||||
else
|
||||
{
|
||||
return "None";
|
||||
}
|
||||
}
|
||||
///
|
||||
/// Convert name to ID
|
||||
///
|
||||
QString Factory::nameToId( const QString& name )
|
||||
{
|
||||
if ( mBackendNameMap.contains( name ) )
|
||||
{
|
||||
return mBackendNameMap[name].id;
|
||||
}
|
||||
else
|
||||
{
|
||||
return "None";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Convert ID to type
|
||||
///
|
||||
Factory::SourceType Factory::idToType( const QString& id )
|
||||
{
|
||||
if ( mBackendIdMap.contains( id ) )
|
||||
{
|
||||
return mBackendIdMap[id].type;
|
||||
}
|
||||
else
|
||||
{
|
||||
return NONE;
|
||||
}
|
||||
}
|
||||
///
|
||||
/// Convert ID to type
|
||||
///
|
||||
Factory::SourceType Factory::idToType( const QString& id )
|
||||
{
|
||||
if ( mBackendIdMap.contains( id ) )
|
||||
{
|
||||
return mBackendIdMap[id].type;
|
||||
}
|
||||
else
|
||||
{
|
||||
return NONE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Lookup ID from index
|
||||
///
|
||||
QString Factory::indexToId( int index )
|
||||
{
|
||||
if ( (index > 0) && (index < mNameList.size()) )
|
||||
{
|
||||
QString name = mNameList[index];
|
||||
|
||||
return mBackendNameMap[ name ].id;
|
||||
}
|
||||
///
|
||||
/// Lookup ID from index
|
||||
///
|
||||
QString Factory::indexToId( int index )
|
||||
{
|
||||
if ( (index > 0) && (index < mNameList.size()) )
|
||||
{
|
||||
QString name = mNameList[index];
|
||||
|
||||
return "None";
|
||||
}
|
||||
return mBackendNameMap[ name ].id;
|
||||
}
|
||||
|
||||
return "None";
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Register backend
|
||||
///
|
||||
void Factory::registerBackend( const QString& id,
|
||||
const QString& name,
|
||||
SourceType type,
|
||||
CreateFct create )
|
||||
{
|
||||
BackendEntry backend;
|
||||
///
|
||||
/// Register backend
|
||||
///
|
||||
void Factory::registerBackend( const QString& id,
|
||||
const QString& name,
|
||||
SourceType type,
|
||||
CreateFct create )
|
||||
{
|
||||
BackendEntry backend;
|
||||
|
||||
backend.id = id;
|
||||
backend.name = name;
|
||||
backend.type = type;
|
||||
backend.create = create;
|
||||
|
||||
mBackendIdMap[ id ] = backend;
|
||||
mBackendNameMap[ name ] = backend;
|
||||
backend.id = id;
|
||||
backend.name = name;
|
||||
backend.type = type;
|
||||
backend.create = create;
|
||||
|
||||
mNameList << name;
|
||||
}
|
||||
mBackendIdMap[ id ] = backend;
|
||||
mBackendNameMap[ name ] = backend;
|
||||
|
||||
} // namespace merge
|
||||
} // namespace glabels
|
||||
mNameList << name;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,110 +0,0 @@
|
||||
/* Merge/Factory.h
|
||||
*
|
||||
* Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef merge_Factory_h
|
||||
#define merge_Factory_h
|
||||
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QStringList>
|
||||
#include <QMap>
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
namespace merge
|
||||
{
|
||||
|
||||
// Forward references
|
||||
class Merge;
|
||||
|
||||
|
||||
///
|
||||
/// Factory
|
||||
///
|
||||
class Factory
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(Factory)
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Source Type
|
||||
/////////////////////////////////
|
||||
public:
|
||||
enum SourceType { NONE, FIXED, FILE };
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
protected:
|
||||
Factory();
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Static methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
static void init();
|
||||
|
||||
static Merge* createMerge( const QString& id );
|
||||
|
||||
static QStringList nameList();
|
||||
static QString idToName( const QString& id );
|
||||
static QString nameToId( const QString& name );
|
||||
static SourceType idToType( const QString& id );
|
||||
static QString indexToId( int index );
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// private methods
|
||||
/////////////////////////////////
|
||||
private:
|
||||
using CreateFct = Merge* (*)();
|
||||
|
||||
static void registerBackend( const QString& id,
|
||||
const QString& name,
|
||||
SourceType type,
|
||||
CreateFct create );
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// private data
|
||||
/////////////////////////////////
|
||||
class BackendEntry
|
||||
{
|
||||
public:
|
||||
QString id;
|
||||
QString name;
|
||||
SourceType type;
|
||||
CreateFct create;
|
||||
};
|
||||
|
||||
static QMap<QString,BackendEntry> mBackendIdMap;
|
||||
static QMap<QString,BackendEntry> mBackendNameMap;
|
||||
|
||||
static QStringList mNameList;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif // merge_Factory_h
|
||||
@@ -0,0 +1,107 @@
|
||||
// Merge/Factory.hpp
|
||||
//
|
||||
// Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt 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 General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#ifndef merge_Factory_hpp
|
||||
#define merge_Factory_hpp
|
||||
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QStringList>
|
||||
#include <QMap>
|
||||
|
||||
|
||||
namespace glabels::merge
|
||||
{
|
||||
|
||||
// Forward references
|
||||
class Merge;
|
||||
|
||||
|
||||
///
|
||||
/// Factory
|
||||
///
|
||||
class Factory
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(Factory)
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Source Type
|
||||
/////////////////////////////////
|
||||
public:
|
||||
enum SourceType { NONE, FIXED, FILE };
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
protected:
|
||||
Factory();
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Static methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
static void init();
|
||||
|
||||
static Merge* createMerge( const QString& id );
|
||||
|
||||
static QStringList nameList();
|
||||
static QString idToName( const QString& id );
|
||||
static QString nameToId( const QString& name );
|
||||
static SourceType idToType( const QString& id );
|
||||
static QString indexToId( int index );
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// private methods
|
||||
/////////////////////////////////
|
||||
private:
|
||||
using CreateFct = Merge* (*)();
|
||||
|
||||
static void registerBackend( const QString& id,
|
||||
const QString& name,
|
||||
SourceType type,
|
||||
CreateFct create );
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// private data
|
||||
/////////////////////////////////
|
||||
class BackendEntry
|
||||
{
|
||||
public:
|
||||
QString id;
|
||||
QString name;
|
||||
SourceType type;
|
||||
CreateFct create;
|
||||
};
|
||||
|
||||
static QMap<QString,BackendEntry> mBackendIdMap;
|
||||
static QMap<QString,BackendEntry> mBackendNameMap;
|
||||
|
||||
static QStringList mNameList;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // merge_Factory_hpp
|
||||
+167
-170
@@ -1,201 +1,198 @@
|
||||
/* Merge/Merge.cpp
|
||||
*
|
||||
* Copyright (C) 2015-2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
// Merge/Merge.cpp
|
||||
//
|
||||
// Copyright (C) 2015-2016 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt 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 General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
|
||||
#include "Merge.h"
|
||||
#include "Merge.hpp"
|
||||
|
||||
|
||||
namespace glabels
|
||||
namespace glabels::merge
|
||||
{
|
||||
namespace merge
|
||||
{
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
Merge::Merge( const Merge* merge )
|
||||
: mId(merge->mId),
|
||||
mSource(merge->mSource),
|
||||
mRecordList(merge->mRecordList)
|
||||
{
|
||||
}
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
Merge::Merge( const Merge* merge )
|
||||
: mId(merge->mId),
|
||||
mSource(merge->mSource),
|
||||
mRecordList(merge->mRecordList)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Get id
|
||||
///
|
||||
QString Merge::id() const
|
||||
{
|
||||
return mId;
|
||||
}
|
||||
///
|
||||
/// Get id
|
||||
///
|
||||
QString Merge::id() const
|
||||
{
|
||||
return mId;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Get source
|
||||
///
|
||||
QString Merge::source() const
|
||||
{
|
||||
return mSource;
|
||||
}
|
||||
///
|
||||
/// Get source
|
||||
///
|
||||
QString Merge::source() const
|
||||
{
|
||||
return mSource;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Set source
|
||||
///
|
||||
void Merge::setSource( const QString& source )
|
||||
{
|
||||
mSource = source;
|
||||
///
|
||||
/// Set source
|
||||
///
|
||||
void Merge::setSource( const QString& source )
|
||||
{
|
||||
mSource = source;
|
||||
|
||||
// Clear out any old records
|
||||
mRecordList.clear();
|
||||
// Clear out any old records
|
||||
mRecordList.clear();
|
||||
|
||||
open();
|
||||
for ( Record record = readNextRecord(); !record.isEmpty(); record = readNextRecord() )
|
||||
{
|
||||
mRecordList.push_back( record );
|
||||
}
|
||||
close();
|
||||
|
||||
emit sourceChanged();
|
||||
}
|
||||
open();
|
||||
for ( Record record = readNextRecord(); !record.isEmpty(); record = readNextRecord() )
|
||||
{
|
||||
mRecordList.push_back( record );
|
||||
}
|
||||
close();
|
||||
|
||||
emit sourceChanged();
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Reload source
|
||||
///
|
||||
void Merge::reloadSource()
|
||||
{
|
||||
// temporary map of original selections
|
||||
QMap<QString,bool> origSelectionMap;
|
||||
///
|
||||
/// Reload source
|
||||
///
|
||||
void Merge::reloadSource()
|
||||
{
|
||||
// temporary map of original selections
|
||||
QMap<QString,bool> origSelectionMap;
|
||||
|
||||
for ( auto& record : mRecordList )
|
||||
{
|
||||
origSelectionMap[ record[ primaryKey() ] ] = record.isSelected();
|
||||
}
|
||||
for ( auto& record : mRecordList )
|
||||
{
|
||||
origSelectionMap[ record[ primaryKey() ] ] = record.isSelected();
|
||||
}
|
||||
|
||||
// Clear the original records
|
||||
mRecordList.clear();
|
||||
// Clear the original records
|
||||
mRecordList.clear();
|
||||
|
||||
// Read the new records, preserve any original selections
|
||||
open();
|
||||
for ( Record record = readNextRecord(); !record.isEmpty(); record = readNextRecord() )
|
||||
{
|
||||
auto key = record[ primaryKey() ];
|
||||
auto it = origSelectionMap.find( key );
|
||||
if ( it != origSelectionMap.end() )
|
||||
{
|
||||
record.setSelected( it.value() );
|
||||
}
|
||||
// Read the new records, preserve any original selections
|
||||
open();
|
||||
for ( Record record = readNextRecord(); !record.isEmpty(); record = readNextRecord() )
|
||||
{
|
||||
auto key = record[ primaryKey() ];
|
||||
auto it = origSelectionMap.find( key );
|
||||
if ( it != origSelectionMap.end() )
|
||||
{
|
||||
record.setSelected( it.value() );
|
||||
}
|
||||
|
||||
mRecordList.push_back( record );
|
||||
}
|
||||
close();
|
||||
mRecordList.push_back( record );
|
||||
}
|
||||
close();
|
||||
|
||||
emit sourceChanged();
|
||||
}
|
||||
emit sourceChanged();
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Get record list
|
||||
///
|
||||
const QList<Record>& Merge::recordList( ) const
|
||||
{
|
||||
return mRecordList;
|
||||
}
|
||||
///
|
||||
/// Get record list
|
||||
///
|
||||
const QList<Record>& Merge::recordList( ) const
|
||||
{
|
||||
return mRecordList;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Select/unselect i'th record
|
||||
///
|
||||
void Merge::setSelected( int i, bool state )
|
||||
{
|
||||
if ( (i >= 0) && (i < mRecordList.size()) )
|
||||
{
|
||||
mRecordList[i].setSelected( state );
|
||||
emit selectionChanged();
|
||||
}
|
||||
}
|
||||
///
|
||||
/// Select/unselect i'th record
|
||||
///
|
||||
void Merge::setSelected( int i, bool state )
|
||||
{
|
||||
if ( (i >= 0) && (i < mRecordList.size()) )
|
||||
{
|
||||
mRecordList[i].setSelected( state );
|
||||
emit selectionChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Select all records
|
||||
///
|
||||
void Merge::selectAll()
|
||||
{
|
||||
for ( auto& record : mRecordList )
|
||||
{
|
||||
record.setSelected( true );
|
||||
}
|
||||
emit selectionChanged();
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Unselect all records
|
||||
///
|
||||
void Merge::unselectAll()
|
||||
{
|
||||
for ( auto& record : mRecordList )
|
||||
{
|
||||
record.setSelected( false );
|
||||
}
|
||||
emit selectionChanged();
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Return count of selected records
|
||||
///
|
||||
int Merge::nSelectedRecords() const
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
for ( const auto& record : mRecordList )
|
||||
{
|
||||
if ( record.isSelected() )
|
||||
{
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
///
|
||||
/// Select all records
|
||||
///
|
||||
void Merge::selectAll()
|
||||
{
|
||||
for ( auto& record : mRecordList )
|
||||
{
|
||||
record.setSelected( true );
|
||||
}
|
||||
emit selectionChanged();
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Return list of selected records
|
||||
///
|
||||
const QList<Record> Merge::selectedRecords() const
|
||||
{
|
||||
QList<Record> list;
|
||||
///
|
||||
/// Unselect all records
|
||||
///
|
||||
void Merge::unselectAll()
|
||||
{
|
||||
for ( auto& record : mRecordList )
|
||||
{
|
||||
record.setSelected( false );
|
||||
}
|
||||
emit selectionChanged();
|
||||
}
|
||||
|
||||
for ( const auto& record : mRecordList )
|
||||
{
|
||||
if ( record.isSelected() )
|
||||
{
|
||||
list.append( record );
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
///
|
||||
/// Return count of selected records
|
||||
///
|
||||
int Merge::nSelectedRecords() const
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
} // namespace merge
|
||||
} // namespace glabels
|
||||
for ( const auto& record : mRecordList )
|
||||
{
|
||||
if ( record.isSelected() )
|
||||
{
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Return list of selected records
|
||||
///
|
||||
const QList<Record> Merge::selectedRecords() const
|
||||
{
|
||||
QList<Record> list;
|
||||
|
||||
for ( const auto& record : mRecordList )
|
||||
{
|
||||
if ( record.isSelected() )
|
||||
{
|
||||
list.append( record );
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,124 +0,0 @@
|
||||
/* Merge/Merge.h
|
||||
*
|
||||
* Copyright (C) 2015-2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef merge_Merge_h
|
||||
#define merge_Merge_h
|
||||
|
||||
|
||||
#include "Record.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QList>
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
namespace merge
|
||||
{
|
||||
|
||||
// Forward references
|
||||
class Record;
|
||||
|
||||
|
||||
///
|
||||
/// Merge Object
|
||||
///
|
||||
class Merge : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
protected:
|
||||
Merge() = default;
|
||||
Merge( const Merge* merge );
|
||||
public:
|
||||
virtual ~Merge() = default;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Object duplication
|
||||
/////////////////////////////////
|
||||
virtual Merge* clone() const = 0;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Properties
|
||||
/////////////////////////////////
|
||||
public:
|
||||
QString id() const;
|
||||
QString source() const;
|
||||
void setSource( const QString& source );
|
||||
void reloadSource();
|
||||
|
||||
const QList<Record>& recordList( ) const;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Selection methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
void setSelected( int i, bool state = true );
|
||||
void selectAll();
|
||||
void unselectAll();
|
||||
|
||||
int nSelectedRecords() const;
|
||||
const QList<Record> selectedRecords() const;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Virtual methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
virtual QStringList keys() const = 0;
|
||||
virtual QString primaryKey() const = 0;
|
||||
protected:
|
||||
virtual void open() = 0;
|
||||
virtual void close() = 0;
|
||||
virtual Record readNextRecord() = 0;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Signals
|
||||
/////////////////////////////////
|
||||
signals:
|
||||
void sourceChanged();
|
||||
void selectionChanged();
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Private data
|
||||
/////////////////////////////////
|
||||
protected:
|
||||
QString mId;
|
||||
private:
|
||||
QString mSource;
|
||||
QList<Record> mRecordList;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif // merge_Merge_h
|
||||
@@ -0,0 +1,121 @@
|
||||
// Merge/Merge.hpp
|
||||
//
|
||||
// Copyright (C) 2015-2016 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt 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 General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#ifndef merge_Merge_hpp
|
||||
#define merge_Merge_hpp
|
||||
|
||||
|
||||
#include "Record.hpp"
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QList>
|
||||
|
||||
|
||||
namespace glabels::merge
|
||||
{
|
||||
|
||||
// Forward references
|
||||
class Record;
|
||||
|
||||
|
||||
///
|
||||
/// Merge Object
|
||||
///
|
||||
class Merge : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
protected:
|
||||
Merge() = default;
|
||||
Merge( const Merge* merge );
|
||||
public:
|
||||
virtual ~Merge() = default;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Object duplication
|
||||
/////////////////////////////////
|
||||
virtual Merge* clone() const = 0;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Properties
|
||||
/////////////////////////////////
|
||||
public:
|
||||
QString id() const;
|
||||
QString source() const;
|
||||
void setSource( const QString& source );
|
||||
void reloadSource();
|
||||
|
||||
const QList<Record>& recordList( ) const;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Selection methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
void setSelected( int i, bool state = true );
|
||||
void selectAll();
|
||||
void unselectAll();
|
||||
|
||||
int nSelectedRecords() const;
|
||||
const QList<Record> selectedRecords() const;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Virtual methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
virtual QStringList keys() const = 0;
|
||||
virtual QString primaryKey() const = 0;
|
||||
protected:
|
||||
virtual void open() = 0;
|
||||
virtual void close() = 0;
|
||||
virtual Record readNextRecord() = 0;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Signals
|
||||
/////////////////////////////////
|
||||
signals:
|
||||
void sourceChanged();
|
||||
void selectionChanged();
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Private data
|
||||
/////////////////////////////////
|
||||
protected:
|
||||
QString mId;
|
||||
private:
|
||||
QString mSource;
|
||||
QList<Record> mRecordList;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // merge_Merge_hpp
|
||||
+92
-94
@@ -1,117 +1,115 @@
|
||||
/* Merge/None.cpp
|
||||
*
|
||||
* Copyright (C) 2015-2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "None.h"
|
||||
// Merge/None.cpp
|
||||
//
|
||||
// Copyright (C) 2015-2016 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt 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 General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
|
||||
namespace glabels
|
||||
#include "None.hpp"
|
||||
|
||||
|
||||
namespace glabels::merge
|
||||
{
|
||||
namespace merge
|
||||
{
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
None::None() : Merge()
|
||||
{
|
||||
mId = "None";
|
||||
}
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
None::None() : Merge()
|
||||
{
|
||||
mId = "None";
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
None::None( const None* merge ) : Merge( merge )
|
||||
{
|
||||
}
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
None::None( const None* merge ) : Merge( merge )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Clone
|
||||
///
|
||||
None* None::clone() const
|
||||
{
|
||||
return new None( this );
|
||||
}
|
||||
///
|
||||
/// Clone
|
||||
///
|
||||
None* None::clone() const
|
||||
{
|
||||
return new None( this );
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Get ID
|
||||
///
|
||||
QString None::id()
|
||||
{
|
||||
return "None";
|
||||
}
|
||||
///
|
||||
/// Get ID
|
||||
///
|
||||
QString None::id()
|
||||
{
|
||||
return "None";
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Create
|
||||
///
|
||||
Merge* None::create()
|
||||
{
|
||||
return new None();
|
||||
}
|
||||
///
|
||||
/// Create
|
||||
///
|
||||
Merge* None::create()
|
||||
{
|
||||
return new None();
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Get key list
|
||||
///
|
||||
QStringList None::keys() const
|
||||
{
|
||||
QStringList emptyList;
|
||||
return emptyList;
|
||||
}
|
||||
///
|
||||
/// Get key list
|
||||
///
|
||||
QStringList None::keys() const
|
||||
{
|
||||
QStringList emptyList;
|
||||
return emptyList;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Get primary key
|
||||
///
|
||||
QString None::primaryKey() const
|
||||
{
|
||||
return "";
|
||||
}
|
||||
///
|
||||
/// Get primary key
|
||||
///
|
||||
QString None::primaryKey() const
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Open source
|
||||
///
|
||||
void None::open()
|
||||
{
|
||||
}
|
||||
///
|
||||
/// Open source
|
||||
///
|
||||
void None::open()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Close source
|
||||
///
|
||||
void None::close()
|
||||
{
|
||||
}
|
||||
///
|
||||
/// Close source
|
||||
///
|
||||
void None::close()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Read next record
|
||||
///
|
||||
Record None::readNextRecord()
|
||||
{
|
||||
return NullRecord();
|
||||
}
|
||||
///
|
||||
/// Read next record
|
||||
///
|
||||
Record None::readNextRecord()
|
||||
{
|
||||
return NullRecord();
|
||||
}
|
||||
|
||||
} // namespace merge
|
||||
} // namespace glabels
|
||||
}
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
/* Merge/None.h
|
||||
*
|
||||
* Copyright (C) 2015-2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef merge_None_h
|
||||
#define merge_None_h
|
||||
|
||||
#include "Merge.h"
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
namespace merge
|
||||
{
|
||||
|
||||
///
|
||||
/// None Merge Backend
|
||||
///
|
||||
struct None : public Merge
|
||||
{
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
public:
|
||||
None();
|
||||
None( const None* merge );
|
||||
virtual ~None() = default;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Object duplication
|
||||
/////////////////////////////////
|
||||
None* clone() const override;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Static methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
static QString id();
|
||||
static Merge* create();
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Implementation of virtual methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
QStringList keys() const override;
|
||||
QString primaryKey() const override;
|
||||
protected:
|
||||
void open() override;
|
||||
void close() override;
|
||||
Record readNextRecord() override;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif // merge_None_h
|
||||
@@ -0,0 +1,76 @@
|
||||
// Merge/None.hpp
|
||||
//
|
||||
// Copyright (C) 2015-2016 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt 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 General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#ifndef merge_None_hpp
|
||||
#define merge_None_hpp
|
||||
|
||||
|
||||
#include "Merge.hpp"
|
||||
|
||||
|
||||
namespace glabels::merge
|
||||
{
|
||||
|
||||
///
|
||||
/// None Merge Backend
|
||||
///
|
||||
struct None : public Merge
|
||||
{
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
public:
|
||||
None();
|
||||
None( const None* merge );
|
||||
virtual ~None() = default;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Object duplication
|
||||
/////////////////////////////////
|
||||
None* clone() const override;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Static methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
static QString id();
|
||||
static Merge* create();
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Implementation of virtual methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
QStringList keys() const override;
|
||||
QString primaryKey() const override;
|
||||
protected:
|
||||
void open() override;
|
||||
void close() override;
|
||||
Record readNextRecord() override;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // merge_None_hpp
|
||||
+38
-40
@@ -1,47 +1,45 @@
|
||||
/* Merge/Record.cpp
|
||||
*
|
||||
* Copyright (C) 2013-2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "Record.h"
|
||||
// Merge/Record.cpp
|
||||
//
|
||||
// Copyright (C) 2013-2016 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt 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 General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
|
||||
namespace glabels
|
||||
#include "Record.hpp"
|
||||
|
||||
|
||||
namespace glabels::merge
|
||||
{
|
||||
namespace merge
|
||||
{
|
||||
|
||||
///
|
||||
/// Is record selected?
|
||||
///
|
||||
bool Record::isSelected() const
|
||||
{
|
||||
return mSelected;
|
||||
}
|
||||
///
|
||||
/// Is record selected?
|
||||
///
|
||||
bool Record::isSelected() const
|
||||
{
|
||||
return mSelected;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Set selected on not selected
|
||||
///
|
||||
void Record::setSelected( bool value )
|
||||
{
|
||||
mSelected = value;
|
||||
}
|
||||
///
|
||||
/// Set selected on not selected
|
||||
///
|
||||
void Record::setSelected( bool value )
|
||||
{
|
||||
mSelected = value;
|
||||
}
|
||||
|
||||
} // namespace merge
|
||||
} // namespace glabels
|
||||
}
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
/* Merge/Record.h
|
||||
*
|
||||
* Copyright (C) 2013-2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef merge_Record_h
|
||||
#define merge_Record_h
|
||||
|
||||
|
||||
#include <QString>
|
||||
#include <QMap>
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
namespace merge
|
||||
{
|
||||
|
||||
///
|
||||
/// Merge Record
|
||||
///
|
||||
class Record : public QMap<QString,QString>
|
||||
{
|
||||
|
||||
/////////////////////////////////
|
||||
// Properties
|
||||
/////////////////////////////////
|
||||
public:
|
||||
bool isSelected() const;
|
||||
void setSelected( bool value );
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Private data
|
||||
/////////////////////////////////
|
||||
private:
|
||||
bool mSelected{ true };
|
||||
|
||||
};
|
||||
|
||||
|
||||
using NullRecord = const Record;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif // merge_Record_h
|
||||
@@ -0,0 +1,59 @@
|
||||
// Merge/Record.hpp
|
||||
//
|
||||
// Copyright (C) 2013-2016 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt 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 General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#ifndef merge_Record_hpp
|
||||
#define merge_Record_hpp
|
||||
|
||||
|
||||
#include <QString>
|
||||
#include <QMap>
|
||||
|
||||
|
||||
namespace glabels::merge
|
||||
{
|
||||
|
||||
///
|
||||
/// Merge Record
|
||||
///
|
||||
class Record : public QMap<QString,QString>
|
||||
{
|
||||
|
||||
/////////////////////////////////
|
||||
// Properties
|
||||
/////////////////////////////////
|
||||
public:
|
||||
bool isSelected() const;
|
||||
void setSelected( bool value );
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Private data
|
||||
/////////////////////////////////
|
||||
private:
|
||||
bool mSelected{ true };
|
||||
|
||||
};
|
||||
|
||||
|
||||
using NullRecord = const Record;
|
||||
}
|
||||
|
||||
|
||||
#endif // merge_Record_hpp
|
||||
+370
-373
@@ -1,419 +1,416 @@
|
||||
/* Merge/Text.cpp
|
||||
*
|
||||
* Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
// Merge/Text.cpp
|
||||
//
|
||||
// Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt 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 General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
|
||||
#include "Text.h"
|
||||
#include "Text.hpp"
|
||||
|
||||
#include "Record.h"
|
||||
#include "Record.hpp"
|
||||
|
||||
#include <QtDebug>
|
||||
#include <QDebug>
|
||||
|
||||
|
||||
namespace glabels
|
||||
namespace glabels::merge
|
||||
{
|
||||
namespace merge
|
||||
{
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
Text::Text( QChar delimiter, bool line1HasKeys )
|
||||
: Merge(),
|
||||
mDelimeter(delimiter),
|
||||
mLine1HasKeys(line1HasKeys),
|
||||
mNFieldsMax(0)
|
||||
{
|
||||
}
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
Text::Text( QChar delimiter, bool line1HasKeys )
|
||||
: Merge(),
|
||||
mDelimeter(delimiter),
|
||||
mLine1HasKeys(line1HasKeys),
|
||||
mNFieldsMax(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
Text::Text( const Text* merge )
|
||||
: Merge( merge ),
|
||||
mDelimeter(merge->mDelimeter),
|
||||
mLine1HasKeys(merge->mLine1HasKeys),
|
||||
mKeys(merge->mKeys),
|
||||
mNFieldsMax(merge->mNFieldsMax)
|
||||
{
|
||||
}
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
Text::Text( const Text* merge )
|
||||
: Merge( merge ),
|
||||
mDelimeter(merge->mDelimeter),
|
||||
mLine1HasKeys(merge->mLine1HasKeys),
|
||||
mKeys(merge->mKeys),
|
||||
mNFieldsMax(merge->mNFieldsMax)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Get key list
|
||||
///
|
||||
QStringList Text::keys() const
|
||||
{
|
||||
QStringList keys;
|
||||
for ( int iField = 0; iField < mNFieldsMax; iField++ )
|
||||
{
|
||||
keys << keyFromIndex(iField);
|
||||
}
|
||||
return keys;
|
||||
}
|
||||
///
|
||||
/// Get key list
|
||||
///
|
||||
QStringList Text::keys() const
|
||||
{
|
||||
QStringList keys;
|
||||
for ( int iField = 0; iField < mNFieldsMax; iField++ )
|
||||
{
|
||||
keys << keyFromIndex(iField);
|
||||
}
|
||||
return keys;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Get primary key
|
||||
///
|
||||
QString Text::primaryKey() const
|
||||
{
|
||||
return keyFromIndex(0);
|
||||
}
|
||||
///
|
||||
/// Get primary key
|
||||
///
|
||||
QString Text::primaryKey() const
|
||||
{
|
||||
return keyFromIndex(0);
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Open source
|
||||
///
|
||||
void Text::open()
|
||||
{
|
||||
mKeys.clear();
|
||||
mNFieldsMax = 0;
|
||||
///
|
||||
/// Open source
|
||||
///
|
||||
void Text::open()
|
||||
{
|
||||
mKeys.clear();
|
||||
mNFieldsMax = 0;
|
||||
|
||||
mFile.setFileName( source() );
|
||||
if (mFile.open( QIODevice::ReadOnly|QIODevice::Text ))
|
||||
{
|
||||
if ( mLine1HasKeys )
|
||||
{
|
||||
mKeys = parseLine();
|
||||
if ( (mKeys.size() == 1) && (mKeys[0] == "") )
|
||||
{
|
||||
mKeys.clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
mNFieldsMax = mKeys.size();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
mFile.setFileName( source() );
|
||||
if (mFile.open( QIODevice::ReadOnly|QIODevice::Text ))
|
||||
{
|
||||
if ( mLine1HasKeys )
|
||||
{
|
||||
mKeys = parseLine();
|
||||
if ( (mKeys.size() == 1) && (mKeys[0] == "") )
|
||||
{
|
||||
mKeys.clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
mNFieldsMax = mKeys.size();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Close source
|
||||
///
|
||||
void Text::close()
|
||||
{
|
||||
if ( mFile.isOpen() )
|
||||
{
|
||||
mFile.close();
|
||||
}
|
||||
}
|
||||
///
|
||||
/// Close source
|
||||
///
|
||||
void Text::close()
|
||||
{
|
||||
if ( mFile.isOpen() )
|
||||
{
|
||||
mFile.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Read next record
|
||||
///
|
||||
Record Text::readNextRecord()
|
||||
{
|
||||
QStringList values = parseLine();
|
||||
if ( !values.isEmpty() )
|
||||
{
|
||||
Record record;
|
||||
///
|
||||
/// Read next record
|
||||
///
|
||||
Record Text::readNextRecord()
|
||||
{
|
||||
QStringList values = parseLine();
|
||||
if ( !values.isEmpty() )
|
||||
{
|
||||
Record record;
|
||||
|
||||
int iField = 0;
|
||||
for ( const auto& value : values )
|
||||
{
|
||||
record[ keyFromIndex(iField) ] = value;
|
||||
iField++;
|
||||
}
|
||||
mNFieldsMax = std::max( mNFieldsMax, iField );
|
||||
int iField = 0;
|
||||
for ( const auto& value : values )
|
||||
{
|
||||
record[ keyFromIndex(iField) ] = value;
|
||||
iField++;
|
||||
}
|
||||
mNFieldsMax = std::max( mNFieldsMax, iField );
|
||||
|
||||
return record;
|
||||
}
|
||||
return record;
|
||||
}
|
||||
|
||||
return NullRecord();
|
||||
}
|
||||
return NullRecord();
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Key from field index
|
||||
///
|
||||
QString Text::keyFromIndex( int iField ) const
|
||||
{
|
||||
if ( mLine1HasKeys && ( iField < mKeys.size() ) )
|
||||
{
|
||||
return mKeys[iField];
|
||||
}
|
||||
else
|
||||
{
|
||||
return QString::number( iField+1 );
|
||||
}
|
||||
}
|
||||
///
|
||||
/// Key from field index
|
||||
///
|
||||
QString Text::keyFromIndex( int iField ) const
|
||||
{
|
||||
if ( mLine1HasKeys && ( iField < mKeys.size() ) )
|
||||
{
|
||||
return mKeys[iField];
|
||||
}
|
||||
else
|
||||
{
|
||||
return QString::number( iField+1 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Parse line.
|
||||
///
|
||||
/// Attempt to be a robust parser of various CSV (and similar) formats.
|
||||
///
|
||||
/// Based on CSV format described in RFC 4180 section 2.
|
||||
///
|
||||
/// Additions to RFC 4180 rules:
|
||||
/// - delimeters and other special characters may be "escaped" by a leading
|
||||
/// backslash (\)
|
||||
/// - C escape sequences for newline (\n) and tab (\t) are also translated.
|
||||
/// - if quoted text is not followed by a delimeter, any additional text is
|
||||
/// concatenated with quoted portion.
|
||||
///
|
||||
/// Returns a list of fields. A blank line is considered a line with one
|
||||
/// empty field. Returns an empty list when done.
|
||||
///
|
||||
QStringList Text::parseLine()
|
||||
{
|
||||
QStringList fields;
|
||||
|
||||
enum State
|
||||
{
|
||||
DELIM, QUOTED, QUOTED_QUOTE1, QUOTED_ESCAPED, SIMPLE, SIMPLE_ESCAPED, DONE
|
||||
} state = DELIM;
|
||||
///
|
||||
/// Parse line.
|
||||
///
|
||||
/// Attempt to be a robust parser of various CSV (and similar) formats.
|
||||
///
|
||||
/// Based on CSV format described in RFC 4180 section 2.
|
||||
///
|
||||
/// Additions to RFC 4180 rules:
|
||||
/// - delimeters and other special characters may be "escaped" by a leading
|
||||
/// backslash (\)
|
||||
/// - C escape sequences for newline (\n) and tab (\t) are also translated.
|
||||
/// - if quoted text is not followed by a delimeter, any additional text is
|
||||
/// concatenated with quoted portion.
|
||||
///
|
||||
/// Returns a list of fields. A blank line is considered a line with one
|
||||
/// empty field. Returns an empty list when done.
|
||||
///
|
||||
QStringList Text::parseLine()
|
||||
{
|
||||
QStringList fields;
|
||||
|
||||
QByteArray field;
|
||||
|
||||
while ( state != DONE )
|
||||
{
|
||||
char c;
|
||||
if ( mFile.getChar( &c ) )
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
enum State
|
||||
{
|
||||
DELIM, QUOTED, QUOTED_QUOTE1, QUOTED_ESCAPED, SIMPLE, SIMPLE_ESCAPED, DONE
|
||||
} state = DELIM;
|
||||
|
||||
case DELIM:
|
||||
switch (c)
|
||||
{
|
||||
case '\n':
|
||||
/* last field is empty. */
|
||||
fields << "";
|
||||
state = DONE;
|
||||
break;
|
||||
case '\r':
|
||||
/* ignore */
|
||||
state = DELIM;
|
||||
break;
|
||||
case '"':
|
||||
/* start a quoted field. */
|
||||
state = QUOTED;
|
||||
break;
|
||||
case '\\':
|
||||
/* simple field, but 1st character is an escape. */
|
||||
state = SIMPLE_ESCAPED;
|
||||
break;
|
||||
default:
|
||||
if ( c == mDelimeter )
|
||||
{
|
||||
/* field is empty. */
|
||||
fields << "";
|
||||
state = DELIM;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* beginning of a simple field. */
|
||||
field.append( c );
|
||||
state = SIMPLE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
QByteArray field;
|
||||
|
||||
case QUOTED:
|
||||
switch (c)
|
||||
{
|
||||
case '"':
|
||||
/* Possible end of field, but could be 1st of a pair. */
|
||||
state = QUOTED_QUOTE1;
|
||||
break;
|
||||
case '\\':
|
||||
/* Escape next character, or special escape, e.g. \n. */
|
||||
state = QUOTED_ESCAPED;
|
||||
break;
|
||||
default:
|
||||
/* Use character literally. */
|
||||
field.append( c );
|
||||
break;
|
||||
}
|
||||
break;
|
||||
while ( state != DONE )
|
||||
{
|
||||
char c;
|
||||
if ( mFile.getChar( &c ) )
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
|
||||
case QUOTED_QUOTE1:
|
||||
switch (c)
|
||||
{
|
||||
case '\n':
|
||||
/* line ended after quoted item */
|
||||
fields << QString( field );
|
||||
state = DONE;
|
||||
break;
|
||||
case '"':
|
||||
/* second quote, insert and stay quoted. */
|
||||
field.append( c );
|
||||
state = QUOTED;
|
||||
break;
|
||||
case '\r':
|
||||
/* ignore and go to fallback */
|
||||
state = SIMPLE;
|
||||
break;
|
||||
default:
|
||||
if ( c == mDelimeter )
|
||||
{
|
||||
/* end of field. */
|
||||
fields << QString( field );
|
||||
field.clear();
|
||||
state = DELIM;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* fallback if not a delim or another quote. */
|
||||
field.append( c );
|
||||
state = SIMPLE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case DELIM:
|
||||
switch (c)
|
||||
{
|
||||
case '\n':
|
||||
/* last field is empty. */
|
||||
fields << "";
|
||||
state = DONE;
|
||||
break;
|
||||
case '\r':
|
||||
/* ignore */
|
||||
state = DELIM;
|
||||
break;
|
||||
case '"':
|
||||
/* start a quoted field. */
|
||||
state = QUOTED;
|
||||
break;
|
||||
case '\\':
|
||||
/* simple field, but 1st character is an escape. */
|
||||
state = SIMPLE_ESCAPED;
|
||||
break;
|
||||
default:
|
||||
if ( c == mDelimeter )
|
||||
{
|
||||
/* field is empty. */
|
||||
fields << "";
|
||||
state = DELIM;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* beginning of a simple field. */
|
||||
field.append( c );
|
||||
state = SIMPLE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case QUOTED_ESCAPED:
|
||||
switch (c)
|
||||
{
|
||||
case 'n':
|
||||
/* Decode "\n" as newline. */
|
||||
field.append( '\n' );
|
||||
state = QUOTED;
|
||||
break;
|
||||
case 't':
|
||||
/* Decode "\t" as tab. */
|
||||
field.append( '\t' );
|
||||
state = QUOTED;
|
||||
break;
|
||||
default:
|
||||
/* Use character literally. */
|
||||
field.append( c );
|
||||
state = QUOTED;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case QUOTED:
|
||||
switch (c)
|
||||
{
|
||||
case '"':
|
||||
/* Possible end of field, but could be 1st of a pair. */
|
||||
state = QUOTED_QUOTE1;
|
||||
break;
|
||||
case '\\':
|
||||
/* Escape next character, or special escape, e.g. \n. */
|
||||
state = QUOTED_ESCAPED;
|
||||
break;
|
||||
default:
|
||||
/* Use character literally. */
|
||||
field.append( c );
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case SIMPLE:
|
||||
switch (c)
|
||||
{
|
||||
case '\n':
|
||||
/* line ended */
|
||||
fields << QString( field );
|
||||
state = DONE;
|
||||
break;
|
||||
case '\r':
|
||||
/* ignore */
|
||||
state = SIMPLE;
|
||||
break;
|
||||
case '\\':
|
||||
/* Escape next character, or special escape, e.g. \n. */
|
||||
state = SIMPLE_ESCAPED;
|
||||
break;
|
||||
default:
|
||||
if ( c == mDelimeter )
|
||||
{
|
||||
/* end of field. */
|
||||
fields << QString( field );
|
||||
field.clear();
|
||||
state = DELIM;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Use character literally. */
|
||||
field.append( c );
|
||||
state = SIMPLE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case QUOTED_QUOTE1:
|
||||
switch (c)
|
||||
{
|
||||
case '\n':
|
||||
/* line ended after quoted item */
|
||||
fields << QString( field );
|
||||
state = DONE;
|
||||
break;
|
||||
case '"':
|
||||
/* second quote, insert and stay quoted. */
|
||||
field.append( c );
|
||||
state = QUOTED;
|
||||
break;
|
||||
case '\r':
|
||||
/* ignore and go to fallback */
|
||||
state = SIMPLE;
|
||||
break;
|
||||
default:
|
||||
if ( c == mDelimeter )
|
||||
{
|
||||
/* end of field. */
|
||||
fields << QString( field );
|
||||
field.clear();
|
||||
state = DELIM;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* fallback if not a delim or another quote. */
|
||||
field.append( c );
|
||||
state = SIMPLE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case SIMPLE_ESCAPED:
|
||||
switch (c)
|
||||
{
|
||||
case 'n':
|
||||
/* Decode "\n" as newline. */
|
||||
field.append( '\n' );
|
||||
state = SIMPLE;
|
||||
break;
|
||||
case 't':
|
||||
/* Decode "\t" as tab. */
|
||||
field.append( '\t' );
|
||||
state = SIMPLE;
|
||||
break;
|
||||
default:
|
||||
/* Use character literally. */
|
||||
field.append( (char)c );
|
||||
state = SIMPLE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case QUOTED_ESCAPED:
|
||||
switch (c)
|
||||
{
|
||||
case 'n':
|
||||
/* Decode "\n" as newline. */
|
||||
field.append( '\n' );
|
||||
state = QUOTED;
|
||||
break;
|
||||
case 't':
|
||||
/* Decode "\t" as tab. */
|
||||
field.append( '\t' );
|
||||
state = QUOTED;
|
||||
break;
|
||||
default:
|
||||
/* Use character literally. */
|
||||
field.append( c );
|
||||
state = QUOTED;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
qWarning( "merge::Text::parseLine()::Should not be reached! #1" );
|
||||
break;
|
||||
}
|
||||
case SIMPLE:
|
||||
switch (c)
|
||||
{
|
||||
case '\n':
|
||||
/* line ended */
|
||||
fields << QString( field );
|
||||
state = DONE;
|
||||
break;
|
||||
case '\r':
|
||||
/* ignore */
|
||||
state = SIMPLE;
|
||||
break;
|
||||
case '\\':
|
||||
/* Escape next character, or special escape, e.g. \n. */
|
||||
state = SIMPLE_ESCAPED;
|
||||
break;
|
||||
default:
|
||||
if ( c == mDelimeter )
|
||||
{
|
||||
/* end of field. */
|
||||
fields << QString( field );
|
||||
field.clear();
|
||||
state = DELIM;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Use character literally. */
|
||||
field.append( c );
|
||||
state = SIMPLE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Handle EOF (could also be an error while reading). */
|
||||
switch (state)
|
||||
{
|
||||
case SIMPLE_ESCAPED:
|
||||
switch (c)
|
||||
{
|
||||
case 'n':
|
||||
/* Decode "\n" as newline. */
|
||||
field.append( '\n' );
|
||||
state = SIMPLE;
|
||||
break;
|
||||
case 't':
|
||||
/* Decode "\t" as tab. */
|
||||
field.append( '\t' );
|
||||
state = SIMPLE;
|
||||
break;
|
||||
default:
|
||||
/* Use character literally. */
|
||||
field.append( (char)c );
|
||||
state = SIMPLE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case DELIM:
|
||||
/* EOF, no more lines. */
|
||||
break;
|
||||
default:
|
||||
qWarning( "merge::Text::parseLine()::Should not be reached! #1" );
|
||||
break;
|
||||
}
|
||||
|
||||
case QUOTED:
|
||||
/* File ended midway through quoted item. Truncate field. */
|
||||
fields << QString( field );
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Handle EOF (could also be an error while reading). */
|
||||
switch (state)
|
||||
{
|
||||
|
||||
case QUOTED_QUOTE1:
|
||||
/* File ended after quoted item. */
|
||||
fields << QString( field );
|
||||
break;
|
||||
case DELIM:
|
||||
/* EOF, no more lines. */
|
||||
break;
|
||||
|
||||
case QUOTED_ESCAPED:
|
||||
/* File ended midway through quoted item. Truncate field. */
|
||||
fields << QString( field );
|
||||
break;
|
||||
case QUOTED:
|
||||
/* File ended midway through quoted item. Truncate field. */
|
||||
fields << QString( field );
|
||||
break;
|
||||
|
||||
case SIMPLE:
|
||||
/* File ended after simple item. */
|
||||
fields << QString( field );
|
||||
break;
|
||||
case QUOTED_QUOTE1:
|
||||
/* File ended after quoted item. */
|
||||
fields << QString( field );
|
||||
break;
|
||||
|
||||
case SIMPLE_ESCAPED:
|
||||
/* File ended midway through escaped item. */
|
||||
fields << QString( field );
|
||||
break;
|
||||
case QUOTED_ESCAPED:
|
||||
/* File ended midway through quoted item. Truncate field. */
|
||||
fields << QString( field );
|
||||
break;
|
||||
|
||||
default:
|
||||
qWarning( "merge::Text::parseLine()::Should not be reached! #2" );
|
||||
break;
|
||||
}
|
||||
|
||||
state = DONE;
|
||||
}
|
||||
}
|
||||
|
||||
case SIMPLE:
|
||||
/* File ended after simple item. */
|
||||
fields << QString( field );
|
||||
break;
|
||||
|
||||
return fields;
|
||||
}
|
||||
case SIMPLE_ESCAPED:
|
||||
/* File ended midway through escaped item. */
|
||||
fields << QString( field );
|
||||
break;
|
||||
|
||||
} // namespace merge
|
||||
} // namespace glabels
|
||||
default:
|
||||
qWarning( "merge::Text::parseLine()::Should not be reached! #2" );
|
||||
break;
|
||||
}
|
||||
|
||||
state = DONE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return fields;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
/* Merge/Text.h
|
||||
*
|
||||
* Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef merge_Text_h
|
||||
#define merge_Text_h
|
||||
|
||||
|
||||
#include "Merge.h"
|
||||
|
||||
#include <QFile>
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
namespace merge
|
||||
{
|
||||
|
||||
///
|
||||
/// Text Merge Backend
|
||||
///
|
||||
struct Text : public Merge
|
||||
{
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
protected:
|
||||
Text( QChar delimiter, bool line1HasKeys );
|
||||
Text( const Text* merge );
|
||||
virtual ~Text() = default;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Implementation of virtual methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
QStringList keys() const override;
|
||||
QString primaryKey() const override;
|
||||
protected:
|
||||
void open() override;
|
||||
void close() override;
|
||||
Record readNextRecord() override;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Private methods
|
||||
/////////////////////////////////
|
||||
QString keyFromIndex( int iField ) const;
|
||||
QStringList parseLine();
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Private data
|
||||
/////////////////////////////////
|
||||
private:
|
||||
QChar mDelimeter;
|
||||
bool mLine1HasKeys;
|
||||
|
||||
QFile mFile;
|
||||
QStringList mKeys;
|
||||
int mNFieldsMax;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif // merge_Text_h
|
||||
@@ -0,0 +1,82 @@
|
||||
// Merge/Text.hpp
|
||||
//
|
||||
// Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt 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 General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#ifndef merge_Text_hpp
|
||||
#define merge_Text_hpp
|
||||
|
||||
|
||||
#include "Merge.hpp"
|
||||
|
||||
#include <QFile>
|
||||
|
||||
|
||||
namespace glabels::merge
|
||||
{
|
||||
|
||||
///
|
||||
/// Text Merge Backend
|
||||
///
|
||||
struct Text : public Merge
|
||||
{
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
protected:
|
||||
Text( QChar delimiter, bool line1HasKeys );
|
||||
Text( const Text* merge );
|
||||
virtual ~Text() = default;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Implementation of virtual methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
QStringList keys() const override;
|
||||
QString primaryKey() const override;
|
||||
protected:
|
||||
void open() override;
|
||||
void close() override;
|
||||
Record readNextRecord() override;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Private methods
|
||||
/////////////////////////////////
|
||||
QString keyFromIndex( int iField ) const;
|
||||
QStringList parseLine();
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Private data
|
||||
/////////////////////////////////
|
||||
private:
|
||||
QChar mDelimeter;
|
||||
bool mLine1HasKeys;
|
||||
|
||||
QFile mFile;
|
||||
QStringList mKeys;
|
||||
int mNFieldsMax;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // merge_Text_hpp
|
||||
@@ -1,76 +1,77 @@
|
||||
/* Merge/TextColon.cpp
|
||||
*
|
||||
* Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "TextColon.h"
|
||||
// Merge/TextColon.cpp
|
||||
//
|
||||
// Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt 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 General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
|
||||
namespace glabels
|
||||
#include "TextColon.hpp"
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
namespace merge
|
||||
{
|
||||
|
||||
static const QString ID = "Text/Colon";
|
||||
static const QString ID = "Text/Colon";
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextColon::TextColon() : Text(':',false)
|
||||
{
|
||||
mId = ID;
|
||||
}
|
||||
namespace glabels::merge
|
||||
{
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextColon::TextColon() : Text(':',false)
|
||||
{
|
||||
mId = ID;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextColon::TextColon( const TextColon* merge ) : Text( merge )
|
||||
{
|
||||
}
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextColon::TextColon( const TextColon* merge ) : Text( merge )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Clone
|
||||
///
|
||||
TextColon* TextColon::clone() const
|
||||
{
|
||||
return new TextColon( this );
|
||||
}
|
||||
///
|
||||
/// Clone
|
||||
///
|
||||
TextColon* TextColon::clone() const
|
||||
{
|
||||
return new TextColon( this );
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Get ID
|
||||
///
|
||||
QString TextColon::id()
|
||||
{
|
||||
return ID;
|
||||
}
|
||||
///
|
||||
/// Get ID
|
||||
///
|
||||
QString TextColon::id()
|
||||
{
|
||||
return ID;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Create
|
||||
///
|
||||
Merge* TextColon::create()
|
||||
{
|
||||
return new TextColon();
|
||||
}
|
||||
///
|
||||
/// Create
|
||||
///
|
||||
Merge* TextColon::create()
|
||||
{
|
||||
return new TextColon();
|
||||
}
|
||||
|
||||
} // namespace merge
|
||||
} // namespace glabels
|
||||
}
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
/* Merge/TextColon.h
|
||||
*
|
||||
* Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef merge_TextColon_h
|
||||
#define merge_TextColon_h
|
||||
|
||||
|
||||
#include "Text.h"
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
namespace merge
|
||||
{
|
||||
|
||||
///
|
||||
/// TextColon Merge Backend
|
||||
///
|
||||
struct TextColon : public Text
|
||||
{
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
private:
|
||||
TextColon();
|
||||
TextColon( const TextColon* merge );
|
||||
virtual ~TextColon() = default;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Object duplication
|
||||
/////////////////////////////////
|
||||
public:
|
||||
TextColon* clone() const override;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Static methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
static QString id();
|
||||
static Merge* create();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif // merge_TextColon_h
|
||||
@@ -0,0 +1,65 @@
|
||||
// Merge/TextColon.hpp
|
||||
//
|
||||
// Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt 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 General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#ifndef merge_TextColon_hpp
|
||||
#define merge_TextColon_hpp
|
||||
|
||||
|
||||
#include "Text.hpp"
|
||||
|
||||
|
||||
namespace glabels::merge
|
||||
{
|
||||
|
||||
///
|
||||
/// TextColon Merge Backend
|
||||
///
|
||||
struct TextColon : public Text
|
||||
{
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
private:
|
||||
TextColon();
|
||||
TextColon( const TextColon* merge );
|
||||
virtual ~TextColon() = default;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Object duplication
|
||||
/////////////////////////////////
|
||||
public:
|
||||
TextColon* clone() const override;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Static methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
static QString id();
|
||||
static Merge* create();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // merge_TextColon_hpp
|
||||
@@ -1,76 +1,77 @@
|
||||
/* Merge/TextColonKeys.cpp
|
||||
*
|
||||
* Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "TextColonKeys.h"
|
||||
// Merge/TextColonKeys.cpp
|
||||
//
|
||||
// Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt 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 General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
|
||||
namespace glabels
|
||||
#include "TextColonKeys.hpp"
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
namespace merge
|
||||
{
|
||||
|
||||
static const QString ID = "Text/Colon/Line1Keys";
|
||||
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextColonKeys::TextColonKeys() : Text(':',true)
|
||||
{
|
||||
mId = ID;
|
||||
}
|
||||
static const QString ID = "Text/Colon/Line1Keys";
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextColonKeys::TextColonKeys( const TextColonKeys* merge ) : Text( merge )
|
||||
{
|
||||
}
|
||||
namespace glabels::merge
|
||||
{
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextColonKeys::TextColonKeys() : Text(':',true)
|
||||
{
|
||||
mId = ID;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Clone
|
||||
///
|
||||
TextColonKeys* TextColonKeys::clone() const
|
||||
{
|
||||
return new TextColonKeys( this );
|
||||
}
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextColonKeys::TextColonKeys( const TextColonKeys* merge ) : Text( merge )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Get ID
|
||||
///
|
||||
QString TextColonKeys::id()
|
||||
{
|
||||
return ID;
|
||||
}
|
||||
///
|
||||
/// Clone
|
||||
///
|
||||
TextColonKeys* TextColonKeys::clone() const
|
||||
{
|
||||
return new TextColonKeys( this );
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Create
|
||||
///
|
||||
Merge* TextColonKeys::create()
|
||||
{
|
||||
return new TextColonKeys();
|
||||
}
|
||||
///
|
||||
/// Get ID
|
||||
///
|
||||
QString TextColonKeys::id()
|
||||
{
|
||||
return ID;
|
||||
}
|
||||
|
||||
} // namespace merge
|
||||
} // namespace glabels
|
||||
|
||||
///
|
||||
/// Create
|
||||
///
|
||||
Merge* TextColonKeys::create()
|
||||
{
|
||||
return new TextColonKeys();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
/* Merge/TextColonKeys.h
|
||||
*
|
||||
* Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef merge_TextColonKeys_h
|
||||
#define merge_TextColonKeys_h
|
||||
|
||||
|
||||
#include "Text.h"
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
namespace merge
|
||||
{
|
||||
|
||||
///
|
||||
/// TextColonKeys Merge Backend
|
||||
///
|
||||
struct TextColonKeys : public Text
|
||||
{
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
private:
|
||||
TextColonKeys();
|
||||
TextColonKeys( const TextColonKeys* merge );
|
||||
virtual ~TextColonKeys() = default;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Object duplication
|
||||
/////////////////////////////////
|
||||
public:
|
||||
TextColonKeys* clone() const override;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Static methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
static QString id();
|
||||
static Merge* create();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif // merge_TextColonKeys_h
|
||||
@@ -0,0 +1,65 @@
|
||||
// Merge/TextColonKeys.hpp
|
||||
//
|
||||
// Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt 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 General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#ifndef merge_TextColonKeys_hpp
|
||||
#define merge_TextColonKeys_hpp
|
||||
|
||||
|
||||
#include "Text.hpp"
|
||||
|
||||
|
||||
namespace glabels::merge
|
||||
{
|
||||
|
||||
///
|
||||
/// TextColonKeys Merge Backend
|
||||
///
|
||||
struct TextColonKeys : public Text
|
||||
{
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
private:
|
||||
TextColonKeys();
|
||||
TextColonKeys( const TextColonKeys* merge );
|
||||
virtual ~TextColonKeys() = default;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Object duplication
|
||||
/////////////////////////////////
|
||||
public:
|
||||
TextColonKeys* clone() const override;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Static methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
static QString id();
|
||||
static Merge* create();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // merge_TextColonKeys_hpp
|
||||
+65
-64
@@ -1,76 +1,77 @@
|
||||
/* Merge/TextCsv.cpp
|
||||
*
|
||||
* Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "TextCsv.h"
|
||||
// Merge/TextCsv.cpp
|
||||
//
|
||||
// Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt 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 General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
|
||||
namespace glabels
|
||||
#include "TextCsv.hpp"
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
namespace merge
|
||||
{
|
||||
|
||||
static const QString ID = "Text/Comma";
|
||||
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextCsv::TextCsv() : Text(',',false)
|
||||
{
|
||||
mId = ID;
|
||||
}
|
||||
static const QString ID = "Text/Comma";
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextCsv::TextCsv( const TextCsv* merge ) : Text( merge )
|
||||
{
|
||||
}
|
||||
namespace glabels::merge
|
||||
{
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextCsv::TextCsv() : Text(',',false)
|
||||
{
|
||||
mId = ID;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Clone
|
||||
///
|
||||
TextCsv* TextCsv::clone() const
|
||||
{
|
||||
return new TextCsv( this );
|
||||
}
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextCsv::TextCsv( const TextCsv* merge ) : Text( merge )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Get ID
|
||||
///
|
||||
QString TextCsv::id()
|
||||
{
|
||||
return ID;
|
||||
}
|
||||
///
|
||||
/// Clone
|
||||
///
|
||||
TextCsv* TextCsv::clone() const
|
||||
{
|
||||
return new TextCsv( this );
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Create
|
||||
///
|
||||
Merge* TextCsv::create()
|
||||
{
|
||||
return new TextCsv();
|
||||
}
|
||||
///
|
||||
/// Get ID
|
||||
///
|
||||
QString TextCsv::id()
|
||||
{
|
||||
return ID;
|
||||
}
|
||||
|
||||
} // namespace merge
|
||||
} // namespace glabels
|
||||
|
||||
///
|
||||
/// Create
|
||||
///
|
||||
Merge* TextCsv::create()
|
||||
{
|
||||
return new TextCsv();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
/* Merge/TextCsv.h
|
||||
*
|
||||
* Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef merge_TextCsv_h
|
||||
#define merge_TextCsv_h
|
||||
|
||||
|
||||
#include "Text.h"
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
namespace merge
|
||||
{
|
||||
|
||||
///
|
||||
/// TextCsv Merge Backend
|
||||
///
|
||||
struct TextCsv : public Text
|
||||
{
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
private:
|
||||
TextCsv();
|
||||
TextCsv( const TextCsv* merge );
|
||||
virtual ~TextCsv() = default;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Object duplication
|
||||
/////////////////////////////////
|
||||
public:
|
||||
TextCsv* clone() const override;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Static methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
static QString id();
|
||||
static Merge* create();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif // merge_TextCsv_h
|
||||
@@ -0,0 +1,65 @@
|
||||
// Merge/TextCsv.hpp
|
||||
//
|
||||
// Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt 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 General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#ifndef merge_TextCsv_hpp
|
||||
#define merge_TextCsv_hpp
|
||||
|
||||
|
||||
#include "Text.hpp"
|
||||
|
||||
|
||||
namespace glabels::merge
|
||||
{
|
||||
|
||||
///
|
||||
/// TextCsv Merge Backend
|
||||
///
|
||||
struct TextCsv : public Text
|
||||
{
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
private:
|
||||
TextCsv();
|
||||
TextCsv( const TextCsv* merge );
|
||||
virtual ~TextCsv() = default;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Object duplication
|
||||
/////////////////////////////////
|
||||
public:
|
||||
TextCsv* clone() const override;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Static methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
static QString id();
|
||||
static Merge* create();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // merge_TextCsv_hpp
|
||||
@@ -1,76 +1,77 @@
|
||||
/* Merge/TextCsvKeys.cpp
|
||||
*
|
||||
* Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "TextCsvKeys.h"
|
||||
// Merge/TextCsvKeys.cpp
|
||||
//
|
||||
// Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt 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 General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
|
||||
namespace glabels
|
||||
#include "TextCsvKeys.hpp"
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
namespace merge
|
||||
{
|
||||
|
||||
static const QString ID = "Text/Comma/Line1Keys";
|
||||
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextCsvKeys::TextCsvKeys() : Text(',',true)
|
||||
{
|
||||
mId = ID;
|
||||
}
|
||||
static const QString ID = "Text/Comma/Line1Keys";
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextCsvKeys::TextCsvKeys( const TextCsvKeys* merge ) : Text( merge )
|
||||
{
|
||||
}
|
||||
namespace glabels::merge
|
||||
{
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextCsvKeys::TextCsvKeys() : Text(',',true)
|
||||
{
|
||||
mId = ID;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Clone
|
||||
///
|
||||
TextCsvKeys* TextCsvKeys::clone() const
|
||||
{
|
||||
return new TextCsvKeys( this );
|
||||
}
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextCsvKeys::TextCsvKeys( const TextCsvKeys* merge ) : Text( merge )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Get ID
|
||||
///
|
||||
QString TextCsvKeys::id()
|
||||
{
|
||||
return ID;
|
||||
}
|
||||
///
|
||||
/// Clone
|
||||
///
|
||||
TextCsvKeys* TextCsvKeys::clone() const
|
||||
{
|
||||
return new TextCsvKeys( this );
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Create
|
||||
///
|
||||
Merge* TextCsvKeys::create()
|
||||
{
|
||||
return new TextCsvKeys();
|
||||
}
|
||||
///
|
||||
/// Get ID
|
||||
///
|
||||
QString TextCsvKeys::id()
|
||||
{
|
||||
return ID;
|
||||
}
|
||||
|
||||
} // namespace merge
|
||||
} // namespace glabels
|
||||
|
||||
///
|
||||
/// Create
|
||||
///
|
||||
Merge* TextCsvKeys::create()
|
||||
{
|
||||
return new TextCsvKeys();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
/* Merge/TextCsvKeys.h
|
||||
*
|
||||
* Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef merge_TextCsvKeys_h
|
||||
#define merge_TextCsvKeys_h
|
||||
|
||||
|
||||
#include "Text.h"
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
namespace merge
|
||||
{
|
||||
|
||||
///
|
||||
/// TextCsvKeys Merge Backend
|
||||
///
|
||||
struct TextCsvKeys : public Text
|
||||
{
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
private:
|
||||
TextCsvKeys();
|
||||
TextCsvKeys( const TextCsvKeys* merge );
|
||||
virtual ~TextCsvKeys() = default;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Object duplication
|
||||
/////////////////////////////////
|
||||
public:
|
||||
TextCsvKeys* clone() const override;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Static methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
static QString id();
|
||||
static Merge* create();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif // merge_TextCsvKeys_h
|
||||
@@ -0,0 +1,65 @@
|
||||
// Merge/TextCsvKeys.hpp
|
||||
//
|
||||
// Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt 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 General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#ifndef merge_TextCsvKeys_hpp
|
||||
#define merge_TextCsvKeys_hpp
|
||||
|
||||
|
||||
#include "Text.hpp"
|
||||
|
||||
|
||||
namespace glabels::merge
|
||||
{
|
||||
|
||||
///
|
||||
/// TextCsvKeys Merge Backend
|
||||
///
|
||||
struct TextCsvKeys : public Text
|
||||
{
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
private:
|
||||
TextCsvKeys();
|
||||
TextCsvKeys( const TextCsvKeys* merge );
|
||||
virtual ~TextCsvKeys() = default;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Object duplication
|
||||
/////////////////////////////////
|
||||
public:
|
||||
TextCsvKeys* clone() const override;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Static methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
static QString id();
|
||||
static Merge* create();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // merge_TextCsvKeys_hpp
|
||||
@@ -1,76 +1,77 @@
|
||||
/* Merge/TextSemicolon.cpp
|
||||
*
|
||||
* Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "TextSemicolon.h"
|
||||
// Merge/TextSemicolon.cpp
|
||||
//
|
||||
// Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt 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 General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
|
||||
namespace glabels
|
||||
#include "TextSemicolon.hpp"
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
namespace merge
|
||||
{
|
||||
|
||||
static const QString ID = "Text/Semicolon";
|
||||
static const QString ID = "Text/Semicolon";
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextSemicolon::TextSemicolon() : Text(';',false)
|
||||
{
|
||||
mId = ID;
|
||||
}
|
||||
namespace glabels::merge
|
||||
{
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextSemicolon::TextSemicolon() : Text(';',false)
|
||||
{
|
||||
mId = ID;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextSemicolon::TextSemicolon( const TextSemicolon* merge ) : Text( merge )
|
||||
{
|
||||
}
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextSemicolon::TextSemicolon( const TextSemicolon* merge ) : Text( merge )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Clone
|
||||
///
|
||||
TextSemicolon* TextSemicolon::clone() const
|
||||
{
|
||||
return new TextSemicolon( this );
|
||||
}
|
||||
///
|
||||
/// Clone
|
||||
///
|
||||
TextSemicolon* TextSemicolon::clone() const
|
||||
{
|
||||
return new TextSemicolon( this );
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Get ID
|
||||
///
|
||||
QString TextSemicolon::id()
|
||||
{
|
||||
return ID;
|
||||
}
|
||||
///
|
||||
/// Get ID
|
||||
///
|
||||
QString TextSemicolon::id()
|
||||
{
|
||||
return ID;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Create
|
||||
///
|
||||
Merge* TextSemicolon::create()
|
||||
{
|
||||
return new TextSemicolon();
|
||||
}
|
||||
///
|
||||
/// Create
|
||||
///
|
||||
Merge* TextSemicolon::create()
|
||||
{
|
||||
return new TextSemicolon();
|
||||
}
|
||||
|
||||
} // namespace merge
|
||||
} // namespace glabels
|
||||
}
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
/* Merge/TextSemicolon.h
|
||||
*
|
||||
* Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef merge_TextSemicolon_h
|
||||
#define merge_TextSemicolon_h
|
||||
|
||||
|
||||
#include "Text.h"
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
namespace merge
|
||||
{
|
||||
|
||||
///
|
||||
/// TextSemicolon Merge Backend
|
||||
///
|
||||
struct TextSemicolon : public Text
|
||||
{
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
private:
|
||||
TextSemicolon();
|
||||
TextSemicolon( const TextSemicolon* merge );
|
||||
virtual ~TextSemicolon() = default;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Object duplication
|
||||
/////////////////////////////////
|
||||
public:
|
||||
TextSemicolon* clone() const override;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Static methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
static QString id();
|
||||
static Merge* create();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif // merge_TextSemicolon_h
|
||||
@@ -0,0 +1,65 @@
|
||||
// Merge/TextSemicolon.hpp
|
||||
//
|
||||
// Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt 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 General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#ifndef merge_TextSemicolon_hpp
|
||||
#define merge_TextSemicolon_hpp
|
||||
|
||||
|
||||
#include "Text.hpp"
|
||||
|
||||
|
||||
namespace glabels::merge
|
||||
{
|
||||
|
||||
///
|
||||
/// TextSemicolon Merge Backend
|
||||
///
|
||||
struct TextSemicolon : public Text
|
||||
{
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
private:
|
||||
TextSemicolon();
|
||||
TextSemicolon( const TextSemicolon* merge );
|
||||
virtual ~TextSemicolon() = default;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Object duplication
|
||||
/////////////////////////////////
|
||||
public:
|
||||
TextSemicolon* clone() const override;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Static methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
static QString id();
|
||||
static Merge* create();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // merge_TextSemicolon_hpp
|
||||
@@ -1,76 +1,77 @@
|
||||
/* Merge/TextSemicolonKeys.cpp
|
||||
*
|
||||
* Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "TextSemicolonKeys.h"
|
||||
// Merge/TextSemicolonKeys.cpp
|
||||
//
|
||||
// Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt 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 General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
|
||||
namespace glabels
|
||||
#include "TextSemicolonKeys.hpp"
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
namespace merge
|
||||
{
|
||||
|
||||
static const QString ID = "Text/Semicolon/Keys";
|
||||
static const QString ID = "Text/Semicolon/Keys";
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextSemicolonKeys::TextSemicolonKeys() : Text(';',true)
|
||||
{
|
||||
mId = ID;
|
||||
}
|
||||
namespace glabels::merge
|
||||
{
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextSemicolonKeys::TextSemicolonKeys() : Text(';',true)
|
||||
{
|
||||
mId = ID;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextSemicolonKeys::TextSemicolonKeys( const TextSemicolonKeys* merge ) : Text( merge )
|
||||
{
|
||||
}
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextSemicolonKeys::TextSemicolonKeys( const TextSemicolonKeys* merge ) : Text( merge )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Clone
|
||||
///
|
||||
TextSemicolonKeys* TextSemicolonKeys::clone() const
|
||||
{
|
||||
return new TextSemicolonKeys( this );
|
||||
}
|
||||
///
|
||||
/// Clone
|
||||
///
|
||||
TextSemicolonKeys* TextSemicolonKeys::clone() const
|
||||
{
|
||||
return new TextSemicolonKeys( this );
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Get ID
|
||||
///
|
||||
QString TextSemicolonKeys::id()
|
||||
{
|
||||
return ID;
|
||||
}
|
||||
///
|
||||
/// Get ID
|
||||
///
|
||||
QString TextSemicolonKeys::id()
|
||||
{
|
||||
return ID;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Create
|
||||
///
|
||||
Merge* TextSemicolonKeys::create()
|
||||
{
|
||||
return new TextSemicolonKeys();
|
||||
}
|
||||
///
|
||||
/// Create
|
||||
///
|
||||
Merge* TextSemicolonKeys::create()
|
||||
{
|
||||
return new TextSemicolonKeys();
|
||||
}
|
||||
|
||||
} // namespace merge
|
||||
} // namespace glabels
|
||||
}
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
/* Merge/TextSemicolonKeys.h
|
||||
*
|
||||
* Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef merge_TextSemicolonKeys_h
|
||||
#define merge_TextSemicolonKeys_h
|
||||
|
||||
|
||||
#include "Text.h"
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
namespace merge
|
||||
{
|
||||
|
||||
///
|
||||
/// TextSemicolonKeys Merge Backend
|
||||
///
|
||||
struct TextSemicolonKeys : public Text
|
||||
{
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
private:
|
||||
TextSemicolonKeys();
|
||||
TextSemicolonKeys( const TextSemicolonKeys* merge );
|
||||
virtual ~TextSemicolonKeys() = default;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Object duplication
|
||||
/////////////////////////////////
|
||||
public:
|
||||
TextSemicolonKeys* clone() const override;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Static methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
static QString id();
|
||||
static Merge* create();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif // merge_TextSemicolonKeys_h
|
||||
@@ -0,0 +1,65 @@
|
||||
// Merge/TextSemicolonKeys.hpp
|
||||
//
|
||||
// Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt 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 General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#ifndef merge_TextSemicolonKeys_hpp
|
||||
#define merge_TextSemicolonKeys_hpp
|
||||
|
||||
|
||||
#include "Text.hpp"
|
||||
|
||||
|
||||
namespace glabels::merge
|
||||
{
|
||||
|
||||
///
|
||||
/// TextSemicolonKeys Merge Backend
|
||||
///
|
||||
struct TextSemicolonKeys : public Text
|
||||
{
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
private:
|
||||
TextSemicolonKeys();
|
||||
TextSemicolonKeys( const TextSemicolonKeys* merge );
|
||||
virtual ~TextSemicolonKeys() = default;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Object duplication
|
||||
/////////////////////////////////
|
||||
public:
|
||||
TextSemicolonKeys* clone() const override;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Static methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
static QString id();
|
||||
static Merge* create();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // merge_TextSemicolonKeys_hpp
|
||||
+65
-64
@@ -1,76 +1,77 @@
|
||||
/* Merge/TextTsv.cpp
|
||||
*
|
||||
* Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "TextTsv.h"
|
||||
// Merge/TextTsv.cpp
|
||||
//
|
||||
// Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt 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 General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
|
||||
namespace glabels
|
||||
#include "TextTsv.hpp"
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
namespace merge
|
||||
{
|
||||
|
||||
static const QString ID = "Text/Tab";
|
||||
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextTsv::TextTsv() : Text('\t',false)
|
||||
{
|
||||
mId = ID;
|
||||
}
|
||||
static const QString ID = "Text/Tab";
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextTsv::TextTsv( const TextTsv* merge ) : Text( merge )
|
||||
{
|
||||
}
|
||||
namespace glabels::merge
|
||||
{
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextTsv::TextTsv() : Text('\t',false)
|
||||
{
|
||||
mId = ID;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Clone
|
||||
///
|
||||
TextTsv* TextTsv::clone() const
|
||||
{
|
||||
return new TextTsv( this );
|
||||
}
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextTsv::TextTsv( const TextTsv* merge ) : Text( merge )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Get ID
|
||||
///
|
||||
QString TextTsv::id()
|
||||
{
|
||||
return ID;
|
||||
}
|
||||
///
|
||||
/// Clone
|
||||
///
|
||||
TextTsv* TextTsv::clone() const
|
||||
{
|
||||
return new TextTsv( this );
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Create
|
||||
///
|
||||
Merge* TextTsv::create()
|
||||
{
|
||||
return new TextTsv();
|
||||
}
|
||||
///
|
||||
/// Get ID
|
||||
///
|
||||
QString TextTsv::id()
|
||||
{
|
||||
return ID;
|
||||
}
|
||||
|
||||
} // namespace merge
|
||||
} // namespace glabels
|
||||
|
||||
///
|
||||
/// Create
|
||||
///
|
||||
Merge* TextTsv::create()
|
||||
{
|
||||
return new TextTsv();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
/* Merge/TextTsv.h
|
||||
*
|
||||
* Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef merge_TextTsv_h
|
||||
#define merge_TextTsv_h
|
||||
|
||||
|
||||
#include "Text.h"
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
namespace merge
|
||||
{
|
||||
|
||||
///
|
||||
/// TextTsv Merge Backend
|
||||
///
|
||||
struct TextTsv : public Text
|
||||
{
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
private:
|
||||
TextTsv();
|
||||
TextTsv( const TextTsv* merge );
|
||||
virtual ~TextTsv() = default;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Object duplication
|
||||
/////////////////////////////////
|
||||
public:
|
||||
TextTsv* clone() const override;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Static methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
static QString id();
|
||||
static Merge* create();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif // merge_TextTsv_h
|
||||
@@ -0,0 +1,65 @@
|
||||
// Merge/TextTsv.hpp
|
||||
//
|
||||
// Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt 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 General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#ifndef merge_TextTsv_hpp
|
||||
#define merge_TextTsv_hpp
|
||||
|
||||
|
||||
#include "Text.hpp"
|
||||
|
||||
|
||||
namespace glabels::merge
|
||||
{
|
||||
|
||||
///
|
||||
/// TextTsv Merge Backend
|
||||
///
|
||||
struct TextTsv : public Text
|
||||
{
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
private:
|
||||
TextTsv();
|
||||
TextTsv( const TextTsv* merge );
|
||||
virtual ~TextTsv() = default;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Object duplication
|
||||
/////////////////////////////////
|
||||
public:
|
||||
TextTsv* clone() const override;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Static methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
static QString id();
|
||||
static Merge* create();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // merge_TextTsv_hpp
|
||||
@@ -1,76 +1,78 @@
|
||||
/* Merge/TextTsvKeys.cpp
|
||||
*
|
||||
* Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "TextTsvKeys.h"
|
||||
// Merge/TextTsvKeys.cpp
|
||||
//
|
||||
// Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt 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 General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
|
||||
namespace glabels
|
||||
#include "TextTsvKeys.hpp"
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
namespace merge
|
||||
{
|
||||
|
||||
static const QString ID = "Text/Tab/Line1Keys";
|
||||
static const QString ID = "Text/Tab/Line1Keys";
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextTsvKeys::TextTsvKeys() : Text('\t',true)
|
||||
{
|
||||
mId = ID;
|
||||
}
|
||||
namespace glabels::merge
|
||||
{
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextTsvKeys::TextTsvKeys() : Text('\t',true)
|
||||
{
|
||||
mId = ID;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextTsvKeys::TextTsvKeys( const TextTsvKeys* merge ) : Text( merge )
|
||||
{
|
||||
}
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextTsvKeys::TextTsvKeys( const TextTsvKeys* merge ) : Text( merge )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Clone
|
||||
///
|
||||
TextTsvKeys* TextTsvKeys::clone() const
|
||||
{
|
||||
return new TextTsvKeys( this );
|
||||
}
|
||||
///
|
||||
/// Clone
|
||||
///
|
||||
TextTsvKeys* TextTsvKeys::clone() const
|
||||
{
|
||||
return new TextTsvKeys( this );
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Get ID
|
||||
///
|
||||
QString TextTsvKeys::id()
|
||||
{
|
||||
return ID;
|
||||
}
|
||||
///
|
||||
/// Get ID
|
||||
///
|
||||
QString TextTsvKeys::id()
|
||||
{
|
||||
return ID;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Create
|
||||
///
|
||||
Merge* TextTsvKeys::create()
|
||||
{
|
||||
return new TextTsvKeys();
|
||||
}
|
||||
///
|
||||
/// Create
|
||||
///
|
||||
Merge* TextTsvKeys::create()
|
||||
{
|
||||
return new TextTsvKeys();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} // namespace merge
|
||||
} // namespace glabels
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
/* Merge/TextTsvKeys.h
|
||||
*
|
||||
* Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef merge_TextTsvKeys_h
|
||||
#define merge_TextTsvKeys_h
|
||||
|
||||
|
||||
#include "Text.h"
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
namespace merge
|
||||
{
|
||||
|
||||
///
|
||||
/// TextTsvKeys Merge Backend
|
||||
///
|
||||
struct TextTsvKeys : public Text
|
||||
{
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
private:
|
||||
TextTsvKeys();
|
||||
TextTsvKeys( const TextTsvKeys* merge );
|
||||
virtual ~TextTsvKeys() = default;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Object duplication
|
||||
/////////////////////////////////
|
||||
public:
|
||||
TextTsvKeys* clone() const override;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Static methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
static QString id();
|
||||
static Merge* create();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif // merge_TextTsvKeys_h
|
||||
@@ -0,0 +1,65 @@
|
||||
// Merge/TextTsvKeys.hpp
|
||||
//
|
||||
// Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt 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 General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#ifndef merge_TextTsvKeys_hpp
|
||||
#define merge_TextTsvKeys_hpp
|
||||
|
||||
|
||||
#include "Text.hpp"
|
||||
|
||||
|
||||
namespace glabels::merge
|
||||
{
|
||||
|
||||
///
|
||||
/// TextTsvKeys Merge Backend
|
||||
///
|
||||
struct TextTsvKeys : public Text
|
||||
{
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
private:
|
||||
TextTsvKeys();
|
||||
TextTsvKeys( const TextTsvKeys* merge );
|
||||
virtual ~TextTsvKeys() = default;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Object duplication
|
||||
/////////////////////////////////
|
||||
public:
|
||||
TextTsvKeys* clone() const override;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Static methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
static QString id();
|
||||
static Merge* create();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // merge_TextTsvKeys_hpp
|
||||
Reference in New Issue
Block a user