Removed C++17 nested namespace definitions. Should build on trusty again.

This commit is contained in:
Jim Evins
2017-11-24 15:49:26 -05:00
parent 4821e103bc
commit c9f2b91daf
129 changed files with 18995 additions and 18592 deletions
+158 -155
View File
@@ -31,189 +31,192 @@
#include "TextSemicolonKeys.h"
namespace glabels::merge
namespace glabels
{
//
// Static data
//
QMap<QString,Factory::BackendEntry> Factory::mBackendIdMap;
QMap<QString,Factory::BackendEntry> Factory::mBackendNameMap;
QStringList Factory::mNameList;
///
/// Constructor
///
Factory::Factory()
namespace merge
{
registerBackend( None::id(),
tr("None"),
NONE,
&None::create );
//
// 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 );
registerBackend( TextCsv::id(),
tr("Text: Comma Separated Values (CSV)"),
FILE,
&TextCsv::create );
registerBackend( TextCsvKeys::id(),
tr("Text: Comma Separated Values (CSV), keys on line 1"),
FILE,
&TextCsvKeys::create );
registerBackend( TextCsvKeys::id(),
tr("Text: Comma Separated Values (CSV), keys on line 1"),
FILE,
&TextCsvKeys::create );
registerBackend( TextTsv::id(),
tr("Text: Tab Separated Values (TSV)"),
FILE,
&TextTsv::create );
registerBackend( TextTsv::id(),
tr("Text: Tab Separated Values (TSV)"),
FILE,
&TextTsv::create );
registerBackend( TextTsvKeys::id(),
tr("Text: Tab Separated Values (TSV), keys on line 1"),
FILE,
&TextTsvKeys::create );
registerBackend( TextTsvKeys::id(),
tr("Text: Tab Separated Values (TSV), keys on line 1"),
FILE,
&TextTsvKeys::create );
registerBackend( TextColon::id(),
tr("Text: Colon Separated Values"),
FILE,
&TextColon::create );
registerBackend( TextColon::id(),
tr("Text: Colon Separated Values"),
FILE,
&TextColon::create );
registerBackend( TextColonKeys::id(),
tr("Text: Colon Separated Values, keys on line 1"),
FILE,
&TextColonKeys::create );
registerBackend( TextColonKeys::id(),
tr("Text: Colon Separated Values, keys on line 1"),
FILE,
&TextColonKeys::create );
registerBackend( TextSemicolon::id(),
tr("Text: Semicolon Separated Values"),
FILE,
&TextSemicolon::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();
registerBackend( TextSemicolonKeys::id(),
tr("Text: Semicolon Separated Values, keys on line 1"),
FILE,
&TextSemicolonKeys::create );
}
}
///
/// Create Merge object
///
Merge* Factory::createMerge( const QString& id )
{
QMap<QString,BackendEntry>::iterator iBackend = mBackendIdMap.find( id );
if ( iBackend != mBackendIdMap.end() )
///
/// Initialize
///
void Factory::init()
{
return iBackend->create();
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();
}
///
/// 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;
return None::create();
}
else
{
return tr("None");
}
}
///
/// Convert name to ID
///
QString Factory::nameToId( const QString& name )
{
if ( mBackendNameMap.contains( name ) )
///
/// Get name list
///
QStringList Factory::nameList()
{
return mBackendNameMap[name].id;
return mNameList;
}
else
///
/// 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 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;
}
return "None";
}
}
///
/// Convert ID to type
///
Factory::SourceType Factory::idToType( const QString& id )
{
if ( mBackendIdMap.contains( id ) )
///
/// Register backend
///
void Factory::registerBackend( const QString& id,
const QString& name,
SourceType type,
CreateFct create )
{
return mBackendIdMap[id].type;
}
else
{
return NONE;
}
}
BackendEntry backend;
///
/// Lookup ID from index
///
QString Factory::indexToId( int index )
{
if ( (index > 0) && (index < mNameList.size()) )
{
QString name = mNameList[index];
return mBackendNameMap[ name ].id;
}
return "None";
}
///
/// 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;
backend.id = id;
backend.name = name;
backend.type = type;
backend.create = create;
mBackendIdMap[ id ] = backend;
mBackendNameMap[ name ] = backend;
mBackendIdMap[ id ] = backend;
mBackendNameMap[ name ] = backend;
mNameList << name;
}
mNameList << name;
}
} // namespace glabels::merge
} // namespace merge
} // namespace glabels
+70 -67
View File
@@ -27,80 +27,83 @@
#include <QMap>
namespace glabels::merge
namespace glabels
{
// Forward references
class Merge;
///
/// Factory
///
class Factory
namespace merge
{
Q_DECLARE_TR_FUNCTIONS(Factory)
// Forward references
class Merge;
/////////////////////////////////
// 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:
typedef Merge* (*CreateFct)();
static void registerBackend( const QString& id,
const QString& name,
SourceType type,
CreateFct create );
/////////////////////////////////
// private data
/////////////////////////////////
class BackendEntry
///
/// Factory
///
class Factory
{
public:
QString id;
QString name;
SourceType type;
CreateFct create;
};
Q_DECLARE_TR_FUNCTIONS(Factory)
static QMap<QString,BackendEntry> mBackendIdMap;
static QMap<QString,BackendEntry> mBackendNameMap;
static QStringList mNameList;
};
/////////////////////////////////
// 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:
typedef Merge* (*CreateFct)();
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;
};
}
}
+148 -145
View File
@@ -23,188 +23,191 @@
#include "Record.h"
namespace glabels::merge
namespace glabels
{
namespace merge
{
///
/// Constructor
///
Merge::Merge()
{
}
///
/// Constructor
///
Merge::Merge( const Merge* merge ) : mSource(merge->mSource)
{
foreach ( Record* record, merge->mRecordList )
///
/// Constructor
///
Merge::Merge()
{
mRecordList << record->clone();
}
}
///
/// Destructor
///
Merge::~Merge()
{
foreach ( Record* record, mRecordList )
///
/// Constructor
///
Merge::Merge( const Merge* merge ) : mSource(merge->mSource)
{
delete record;
foreach ( Record* record, merge->mRecordList )
{
mRecordList << record->clone();
}
}
mRecordList.clear();
}
///
/// Get id
///
QString Merge::id() const
{
return mId;
}
///
/// Get source
///
QString Merge::source() const
{
return mSource;
}
///
/// Set source
///
void Merge::setSource( const QString& source )
{
mSource = source;
// Clear out any old records
foreach ( Record* record, mRecordList )
///
/// Destructor
///
Merge::~Merge()
{
delete record;
foreach ( Record* record, mRecordList )
{
delete record;
}
mRecordList.clear();
}
mRecordList.clear();
open();
for ( Record* record = readNextRecord(); record != nullptr; record = readNextRecord() )
///
/// Get id
///
QString Merge::id() const
{
mRecordList.append( record );
return mId;
}
close();
///
/// Get source
///
QString Merge::source() const
{
return mSource;
}
///
/// Set source
///
void Merge::setSource( const QString& source )
{
mSource = source;
// Clear out any old records
foreach ( Record* record, mRecordList )
{
delete record;
}
mRecordList.clear();
open();
for ( Record* record = readNextRecord(); record != nullptr; record = readNextRecord() )
{
mRecordList.append( record );
}
close();
emit sourceChanged();
}
///
/// Get record list
///
const QList<Record*>& Merge::recordList( ) const
{
return mRecordList;
}
///
/// Select matching record
///
void Merge::select( Record* record )
{
record->setSelected( true );
emit selectionChanged();
}
///
/// Unselect matching record
///
void Merge::unselect( Record* record )
{
record->setSelected( false );
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();
emit sourceChanged();
}
}
///
/// Select all records
///
void Merge::selectAll()
{
foreach ( Record* record, mRecordList )
///
/// Get record list
///
const QList<Record*>& Merge::recordList( ) const
{
return mRecordList;
}
///
/// Select matching record
///
void Merge::select( Record* record )
{
record->setSelected( true );
emit selectionChanged();
}
emit selectionChanged();
}
///
/// Unselect all records
///
void Merge::unselectAll()
{
foreach ( Record* record, mRecordList )
///
/// Unselect matching record
///
void Merge::unselect( Record* record )
{
record->setSelected( false );
emit selectionChanged();
}
emit selectionChanged();
}
///
/// Return count of selected records
///
int Merge::nSelectedRecords() const
{
int count = 0;
foreach ( Record* record, mRecordList )
///
/// Select/unselect i'th record
///
void Merge::setSelected( int i, bool state )
{
if ( record->isSelected() )
if ( (i >= 0) && (i < mRecordList.size()) )
{
count++;
mRecordList[i]->setSelected( state );
emit selectionChanged();
}
}
return count;
}
///
/// Return list of selected records
///
const QList<Record*> Merge::selectedRecords() const
{
QList<Record*> list;
foreach ( Record* record, mRecordList )
///
/// Select all records
///
void Merge::selectAll()
{
if ( record->isSelected() )
foreach ( Record* record, mRecordList )
{
list.append( record );
record->setSelected( true );
}
emit selectionChanged();
}
return list;
}
///
/// Unselect all records
///
void Merge::unselectAll()
{
foreach ( Record* record, mRecordList )
{
record->setSelected( false );
}
emit selectionChanged();
}
} // namespace glabels::merge
///
/// Return count of selected records
///
int Merge::nSelectedRecords() const
{
int count = 0;
foreach ( Record* record, mRecordList )
{
if ( record->isSelected() )
{
count++;
}
}
return count;
}
///
/// Return list of selected records
///
const QList<Record*> Merge::selectedRecords() const
{
QList<Record*> list;
foreach ( Record* record, mRecordList )
{
if ( record->isSelected() )
{
list.append( record );
}
}
return list;
}
} // namespace merge
} // namespace glabels
+78 -75
View File
@@ -28,92 +28,95 @@
#include <QList>
namespace glabels::merge
namespace glabels
{
// Forward references
class Record;
///
/// Merge Object
///
struct Merge : QObject
namespace merge
{
Q_OBJECT
/////////////////////////////////
// Life Cycle
/////////////////////////////////
protected:
Merge();
Merge( const Merge* merge );
public:
~Merge() override;
/////////////////////////////////
// Object duplication
/////////////////////////////////
virtual Merge* clone() const = 0;
/////////////////////////////////
// Properties
/////////////////////////////////
public:
QString id() const;
QString source() const;
void setSource( const QString& source );
const QList<Record*>& recordList( void ) const;
/////////////////////////////////
// Selection methods
/////////////////////////////////
public:
void select( Record* record );
void unselect( Record* record );
void setSelected( int i, bool state = true );
void selectAll();
void unselectAll();
// Forward references
class Record;
int nSelectedRecords() const;
const QList<Record*> selectedRecords() const;
///
/// Merge Object
///
struct Merge : QObject
{
Q_OBJECT
/////////////////////////////////
// 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;
/////////////////////////////////
// Life Cycle
/////////////////////////////////
protected:
Merge();
Merge( const Merge* merge );
public:
~Merge() override;
/////////////////////////////////
// Object duplication
/////////////////////////////////
virtual Merge* clone() const = 0;
/////////////////////////////////
// Properties
/////////////////////////////////
public:
QString id() const;
QString source() const;
void setSource( const QString& source );
const QList<Record*>& recordList( void ) const;
/////////////////////////////////
// Selection methods
/////////////////////////////////
public:
void select( Record* record );
void unselect( Record* record );
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();
/////////////////////////////////
// Signals
/////////////////////////////////
signals:
void sourceChanged();
void selectionChanged();
/////////////////////////////////
// Private data
/////////////////////////////////
protected:
QString mId;
private:
QString mSource;
QList<Record*> mRecordList;
};
/////////////////////////////////
// Private data
/////////////////////////////////
protected:
QString mId;
private:
QString mSource;
QList<Record*> mRecordList;
};
}
}
+79 -76
View File
@@ -21,102 +21,105 @@
#include "None.h"
namespace glabels::merge
namespace glabels
{
///
/// Constructor
///
None::None() : Merge()
namespace 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 )
{
}
///
/// Destructor
///
None::~None()
{
}
///
/// Destructor
///
None::~None()
{
}
///
/// 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 nullptr;
}
///
/// Read next record
///
Record* None::readNextRecord()
{
return nullptr;
}
} // namespace glabels::merge
} // namespace merge
} // namespace glabels
+37 -34
View File
@@ -24,51 +24,54 @@
#include "Merge.h"
namespace glabels::merge
namespace glabels
{
///
/// None Merge Backend
///
struct None : public Merge
namespace merge
{
/////////////////////////////////
// Life Cycle
/////////////////////////////////
public:
None();
None( const None* merge );
~None() override;
///
/// None Merge Backend
///
struct None : public Merge
{
/////////////////////////////////
// Life Cycle
/////////////////////////////////
public:
None();
None( const None* merge );
~None() override;
/////////////////////////////////
// Object duplication
/////////////////////////////////
None* clone() const override;
/////////////////////////////////
// Object duplication
/////////////////////////////////
None* clone() const override;
/////////////////////////////////
// Static methods
/////////////////////////////////
public:
static QString id();
static Merge* create();
/////////////////////////////////
// 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;
/////////////////////////////////
// Implementation of virtual methods
/////////////////////////////////
public:
QStringList keys() const override;
QString primaryKey() const override;
protected:
void open() override;
void close() override;
Record* readNextRecord() override;
};
};
}
}
+39 -36
View File
@@ -21,50 +21,53 @@
#include "Record.h"
namespace glabels::merge
namespace glabels
{
///
/// Constructor
///
Record::Record() : mSelected( true )
namespace merge
{
}
///
/// Constructor
///
Record::Record() : mSelected( true )
{
}
///
/// Constructor
///
Record::Record( const Record* record )
: QMap<QString,QString>(*record), mSelected(record->mSelected)
{
}
///
/// Constructor
///
Record::Record( const Record* record )
: QMap<QString,QString>(*record), mSelected(record->mSelected)
{
}
///
/// Clone
///
Record* Record::clone() const
{
return new Record( this );
}
///
/// Clone
///
Record* Record::clone() const
{
return new Record( this );
}
///
/// 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 glabels::merge
} // namespace merge
} // namespace glabels
+31 -28
View File
@@ -26,45 +26,48 @@
#include <QMap>
namespace glabels::merge
namespace glabels
{
///
/// Merge Record
///
struct Record : public QMap<QString,QString>
namespace merge
{
/////////////////////////////////
// Life Cycle
/////////////////////////////////
public:
Record();
Record( const Record* record );
///
/// Merge Record
///
struct Record : public QMap<QString,QString>
{
/////////////////////////////////
// Life Cycle
/////////////////////////////////
public:
Record();
Record( const Record* record );
/////////////////////////////////
// Object duplication
/////////////////////////////////
Record* clone() const;
/////////////////////////////////
// Object duplication
/////////////////////////////////
Record* clone() const;
/////////////////////////////////
// Properties
/////////////////////////////////
public:
bool isSelected() const;
void setSelected( bool value );
/////////////////////////////////
// Properties
/////////////////////////////////
public:
bool isSelected() const;
void setSelected( bool value );
/////////////////////////////////
// Private data
/////////////////////////////////
private:
bool mSelected;
/////////////////////////////////
// Private data
/////////////////////////////////
private:
bool mSelected;
};
};
}
}
+339 -336
View File
@@ -25,392 +25,395 @@
#include <QtDebug>
namespace glabels::merge
namespace glabels
{
///
/// Constructor
///
Text::Text( QChar delimiter, bool line1HasKeys )
: mDelimeter(delimiter), mLine1HasKeys(line1HasKeys), mNFieldsMax(0)
namespace merge
{
}
///
/// Constructor
///
Text::Text( const Text* merge )
: Merge( merge ),
mDelimeter(merge->mDelimeter), mLine1HasKeys(merge->mLine1HasKeys),
mNFieldsMax(merge->mNFieldsMax)
{
}
///
/// Destructor
///
Text::~Text()
{
}
///
/// Get key list
///
QStringList Text::keys() const
{
QStringList keys;
for ( int iField = 0; iField < mNFieldsMax; iField++ )
///
/// Constructor
///
Text::Text( QChar delimiter, bool line1HasKeys )
: mDelimeter(delimiter), mLine1HasKeys(line1HasKeys), mNFieldsMax(0)
{
keys << keyFromIndex(iField);
}
return keys;
}
///
/// Get primary key
///
QString Text::primaryKey() const
{
return keyFromIndex(0);
}
///
/// Open source
///
void Text::open()
{
mFile.setFileName( source() );
mFile.open( QIODevice::ReadOnly|QIODevice::Text );
mKeys.clear();
mNFieldsMax = 0;
if ( mLine1HasKeys && mFile.isOpen() )
///
/// Constructor
///
Text::Text( const Text* merge )
: Merge( merge ),
mDelimeter(merge->mDelimeter), mLine1HasKeys(merge->mLine1HasKeys),
mNFieldsMax(merge->mNFieldsMax)
{
mKeys = parseLine();
if ( (mKeys.size() == 1) && (mKeys[0] == "") )
}
///
/// Destructor
///
Text::~Text()
{
}
///
/// Get key list
///
QStringList Text::keys() const
{
QStringList keys;
for ( int iField = 0; iField < mNFieldsMax; iField++ )
{
mKeys.clear();
keys << keyFromIndex(iField);
}
return keys;
}
///
/// Get primary key
///
QString Text::primaryKey() const
{
return keyFromIndex(0);
}
///
/// Open source
///
void Text::open()
{
mFile.setFileName( source() );
mFile.open( QIODevice::ReadOnly|QIODevice::Text );
mKeys.clear();
mNFieldsMax = 0;
if ( mLine1HasKeys && mFile.isOpen() )
{
mKeys = parseLine();
if ( (mKeys.size() == 1) && (mKeys[0] == "") )
{
mKeys.clear();
}
else
{
mNFieldsMax = mKeys.size();
}
}
}
///
/// Close source
///
void Text::close()
{
if ( mFile.isOpen() )
{
mFile.close();
}
}
///
/// Read next record
///
Record* Text::readNextRecord()
{
QStringList values = parseLine();
if ( !values.isEmpty() )
{
Record* record = new Record();
int iField = 0;
foreach ( QString value, values )
{
(*record)[ keyFromIndex(iField) ] = value;
iField++;
}
mNFieldsMax = std::max( mNFieldsMax, iField );
return record;
}
return nullptr;
}
///
/// Key from field index
///
QString Text::keyFromIndex( int iField ) const
{
if ( mLine1HasKeys && ( iField < mKeys.size() ) )
{
return mKeys[iField];
}
else
{
mNFieldsMax = mKeys.size();
return QString::number( iField+1 );
}
}
}
///
/// Close source
///
void Text::close()
{
if ( mFile.isOpen() )
///
/// 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()
{
mFile.close();
}
}
///
/// Read next record
///
Record* Text::readNextRecord()
{
QStringList values = parseLine();
if ( !values.isEmpty() )
{
Record* record = new Record();
int iField = 0;
foreach ( QString value, values )
{
(*record)[ keyFromIndex(iField) ] = value;
iField++;
}
mNFieldsMax = std::max( mNFieldsMax, iField );
return record;
}
return nullptr;
}
///
/// 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;
QStringList fields;
enum State
{
DELIM, QUOTED, QUOTED_QUOTE1, QUOTED_ESCAPED, SIMPLE, SIMPLE_ESCAPED, DONE
} state = DELIM;
QByteArray field;
while ( state != DONE )
{
char c;
if ( mFile.getChar( &c ) )
enum State
{
switch (state)
DELIM, QUOTED, QUOTED_QUOTE1, QUOTED_ESCAPED, SIMPLE, SIMPLE_ESCAPED, DONE
} state = DELIM;
QByteArray field;
while ( state != DONE )
{
char c;
if ( mFile.getChar( &c ) )
{
case DELIM:
switch (c)
switch (state)
{
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 )
case DELIM:
switch (c)
{
/* field is empty. */
case '\n':
/* last field is empty. */
fields << "";
state = DONE;
break;
case '\r':
/* ignore */
state = DELIM;
}
else
{
/* begining of a simple field. */
field.append( c );
state = SIMPLE;
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
{
/* begining of a simple field. */
field.append( c );
state = SIMPLE;
}
break;
}
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 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 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 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
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 );
state = SIMPLE;
break;
}
break;
}
break;
case SIMPLE_ESCAPED:
switch (c)
{
case 'n':
/* Decode "\n" as newline. */
field.append( '\n' );
state = SIMPLE;
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 't':
/* Decode "\t" as tab. */
field.append( '\t' );
state = SIMPLE;
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 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 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;
default:
/* Use character literally. */
field.append( (char)c );
state = SIMPLE;
qWarning( "merge::Text::parseLine()::Should not be reached! #1" );
break;
}
break;
default:
qWarning( "merge::Text::parseLine()::Should not be reached! #1" );
break;
}
}
else
{
/* Handle EOF (could also be an error while reading). */
switch (state)
else
{
/* Handle EOF (could also be an error while reading). */
switch (state)
{
case DELIM:
/* EOF, no more lines. */
break;
case DELIM:
/* EOF, no more lines. */
break;
case QUOTED:
/* 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 QUOTED_QUOTE1:
/* File ended after quoted item. */
fields << QString( field );
break;
case QUOTED_QUOTE1:
/* File ended after quoted item. */
fields << QString( field );
break;
case QUOTED_ESCAPED:
/* File ended midway through quoted item. Truncate field. */
fields << QString( field );
break;
case QUOTED_ESCAPED:
/* File ended midway through quoted item. Truncate field. */
fields << QString( field );
break;
case SIMPLE:
/* File ended after simple item. */
fields << QString( field );
break;
case SIMPLE:
/* File ended after simple item. */
fields << QString( field );
break;
case SIMPLE_ESCAPED:
/* File ended midway through escaped item. */
fields << QString( field );
break;
case SIMPLE_ESCAPED:
/* File ended midway through escaped item. */
fields << QString( field );
break;
default:
qWarning( "merge::Text::parseLine()::Should not be reached! #2" );
break;
}
default:
qWarning( "merge::Text::parseLine()::Should not be reached! #2" );
break;
}
state = DONE;
state = DONE;
}
}
}
return fields;
}
return fields;
}
} // namespace glabels::merge
} // namespace merge
} // namespace glabels
+41 -38
View File
@@ -26,55 +26,58 @@
#include <QFile>
namespace glabels::merge
namespace glabels
{
///
/// Text Merge Backend
///
struct Text : public Merge
namespace merge
{
/////////////////////////////////
// Life Cycle
/////////////////////////////////
protected:
Text( QChar delimiter, bool line1HasKeys );
Text( const Text* merge );
~Text() override;
///
/// Text Merge Backend
///
struct Text : public Merge
{
/////////////////////////////////
// Life Cycle
/////////////////////////////////
protected:
Text( QChar delimiter, bool line1HasKeys );
Text( const Text* merge );
~Text() override;
/////////////////////////////////
// Implementation of virtual methods
/////////////////////////////////
public:
QStringList keys() const override;
QString primaryKey() const override;
protected:
void open() override;
void close() override;
Record* readNextRecord() override;
/////////////////////////////////
// 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 methods
/////////////////////////////////
QString keyFromIndex( int iField ) const;
QStringList parseLine();
/////////////////////////////////
// Private data
/////////////////////////////////
private:
QChar mDelimeter;
bool mLine1HasKeys;
/////////////////////////////////
// Private data
/////////////////////////////////
private:
QChar mDelimeter;
bool mLine1HasKeys;
QFile mFile;
QStringList mKeys;
int mNFieldsMax;
};
QFile mFile;
QStringList mKeys;
int mNFieldsMax;
};
}
}
+48 -45
View File
@@ -21,61 +21,64 @@
#include "TextColon.h"
namespace glabels::merge
namespace glabels
{
static const QString ID = "Text/Colon";
///
/// Constructor
///
TextColon::TextColon() : Text(':',false)
namespace merge
{
mId = ID;
}
static const QString ID = "Text/Colon";
///
/// Constructor
///
TextColon::TextColon( const TextColon* merge ) : Text( merge )
{
}
///
/// Constructor
///
TextColon::TextColon() : Text(':',false)
{
mId = ID;
}
///
/// Destructor
///
TextColon::~TextColon()
{
}
///
/// Constructor
///
TextColon::TextColon( const TextColon* merge ) : Text( merge )
{
}
///
/// Clone
///
TextColon* TextColon::clone() const
{
return new TextColon( this );
}
///
/// Destructor
///
TextColon::~TextColon()
{
}
///
/// Get ID
///
QString TextColon::id()
{
return ID;
}
///
/// Clone
///
TextColon* TextColon::clone() const
{
return new TextColon( this );
}
///
/// Create
///
Merge* TextColon::create()
{
return new TextColon();
}
///
/// Get ID
///
QString TextColon::id()
{
return ID;
}
} // namespace glabels::merge
///
/// Create
///
Merge* TextColon::create()
{
return new TextColon();
}
} // namespace merge
} // namespace glabels
+28 -25
View File
@@ -25,40 +25,43 @@
#include "Text.h"
namespace glabels::merge
namespace glabels
{
///
/// TextColon Merge Backend
///
struct TextColon : public Text
namespace merge
{
/////////////////////////////////
// Life Cycle
/////////////////////////////////
private:
TextColon();
TextColon( const TextColon* merge );
~TextColon() override;
///
/// TextColon Merge Backend
///
struct TextColon : public Text
{
/////////////////////////////////
// Life Cycle
/////////////////////////////////
private:
TextColon();
TextColon( const TextColon* merge );
~TextColon() override;
/////////////////////////////////
// Object duplication
/////////////////////////////////
public:
TextColon* clone() const override;
/////////////////////////////////
// Object duplication
/////////////////////////////////
public:
TextColon* clone() const override;
/////////////////////////////////
// Static methods
/////////////////////////////////
public:
static QString id();
static Merge* create();
/////////////////////////////////
// Static methods
/////////////////////////////////
public:
static QString id();
static Merge* create();
};
};
}
}
+46 -43
View File
@@ -21,61 +21,64 @@
#include "TextColonKeys.h"
namespace glabels::merge
namespace glabels
{
namespace merge
{
static const QString ID = "Text/Colon/Line1Keys";
static const QString ID = "Text/Colon/Line1Keys";
///
/// Constructor
///
TextColonKeys::TextColonKeys() : Text(':',true)
{
mId = ID;
}
///
/// Constructor
///
TextColonKeys::TextColonKeys() : Text(':',true)
{
mId = ID;
}
///
/// Constructor
///
TextColonKeys::TextColonKeys( const TextColonKeys* merge ) : Text( merge )
{
}
///
/// Constructor
///
TextColonKeys::TextColonKeys( const TextColonKeys* merge ) : Text( merge )
{
}
///
/// Destructor
///
TextColonKeys::~TextColonKeys()
{
}
///
/// Destructor
///
TextColonKeys::~TextColonKeys()
{
}
///
/// Clone
///
TextColonKeys* TextColonKeys::clone() const
{
return new TextColonKeys( this );
}
///
/// Clone
///
TextColonKeys* TextColonKeys::clone() const
{
return new TextColonKeys( this );
}
///
/// Get ID
///
QString TextColonKeys::id()
{
return ID;
}
///
/// Get ID
///
QString TextColonKeys::id()
{
return ID;
}
///
/// Create
///
Merge* TextColonKeys::create()
{
return new TextColonKeys();
}
///
/// Create
///
Merge* TextColonKeys::create()
{
return new TextColonKeys();
}
} // namespace glabels::merge
} // namespace merge
} // namespace glabels
+28 -25
View File
@@ -25,40 +25,43 @@
#include "Text.h"
namespace glabels::merge
namespace glabels
{
///
/// TextColonKeys Merge Backend
///
struct TextColonKeys : public Text
namespace merge
{
/////////////////////////////////
// Life Cycle
/////////////////////////////////
private:
TextColonKeys();
TextColonKeys( const TextColonKeys* merge );
~TextColonKeys() override;
///
/// TextColonKeys Merge Backend
///
struct TextColonKeys : public Text
{
/////////////////////////////////
// Life Cycle
/////////////////////////////////
private:
TextColonKeys();
TextColonKeys( const TextColonKeys* merge );
~TextColonKeys() override;
/////////////////////////////////
// Object duplication
/////////////////////////////////
public:
TextColonKeys* clone() const override;
/////////////////////////////////
// Object duplication
/////////////////////////////////
public:
TextColonKeys* clone() const override;
/////////////////////////////////
// Static methods
/////////////////////////////////
public:
static QString id();
static Merge* create();
/////////////////////////////////
// Static methods
/////////////////////////////////
public:
static QString id();
static Merge* create();
};
};
}
}
+46 -43
View File
@@ -21,61 +21,64 @@
#include "TextCsv.h"
namespace glabels::merge
namespace glabels
{
namespace merge
{
static const QString ID = "Text/Comma";
static const QString ID = "Text/Comma";
///
/// Constructor
///
TextCsv::TextCsv() : Text(',',false)
{
mId = ID;
}
///
/// Constructor
///
TextCsv::TextCsv() : Text(',',false)
{
mId = ID;
}
///
/// Constructor
///
TextCsv::TextCsv( const TextCsv* merge ) : Text( merge )
{
}
///
/// Constructor
///
TextCsv::TextCsv( const TextCsv* merge ) : Text( merge )
{
}
///
/// Destructor
///
TextCsv::~TextCsv()
{
}
///
/// Destructor
///
TextCsv::~TextCsv()
{
}
///
/// Clone
///
TextCsv* TextCsv::clone() const
{
return new TextCsv( this );
}
///
/// Clone
///
TextCsv* TextCsv::clone() const
{
return new TextCsv( this );
}
///
/// Get ID
///
QString TextCsv::id()
{
return ID;
}
///
/// Get ID
///
QString TextCsv::id()
{
return ID;
}
///
/// Create
///
Merge* TextCsv::create()
{
return new TextCsv();
}
///
/// Create
///
Merge* TextCsv::create()
{
return new TextCsv();
}
} // namespace glabels::merge
} // namespace merge
} // namespace glabels
+28 -25
View File
@@ -25,40 +25,43 @@
#include "Text.h"
namespace glabels::merge
namespace glabels
{
///
/// TextCsv Merge Backend
///
struct TextCsv : public Text
namespace merge
{
/////////////////////////////////
// Life Cycle
/////////////////////////////////
private:
TextCsv();
TextCsv( const TextCsv* merge );
~TextCsv() override;
///
/// TextCsv Merge Backend
///
struct TextCsv : public Text
{
/////////////////////////////////
// Life Cycle
/////////////////////////////////
private:
TextCsv();
TextCsv( const TextCsv* merge );
~TextCsv() override;
/////////////////////////////////
// Object duplication
/////////////////////////////////
public:
TextCsv* clone() const override;
/////////////////////////////////
// Object duplication
/////////////////////////////////
public:
TextCsv* clone() const override;
/////////////////////////////////
// Static methods
/////////////////////////////////
public:
static QString id();
static Merge* create();
/////////////////////////////////
// Static methods
/////////////////////////////////
public:
static QString id();
static Merge* create();
};
};
}
}
+46 -43
View File
@@ -21,61 +21,64 @@
#include "TextCsvKeys.h"
namespace glabels::merge
namespace glabels
{
namespace merge
{
static const QString ID = "Text/Comma/Line1Keys";
static const QString ID = "Text/Comma/Line1Keys";
///
/// Constructor
///
TextCsvKeys::TextCsvKeys() : Text(',',true)
{
mId = ID;
}
///
/// Constructor
///
TextCsvKeys::TextCsvKeys() : Text(',',true)
{
mId = ID;
}
///
/// Constructor
///
TextCsvKeys::TextCsvKeys( const TextCsvKeys* merge ) : Text( merge )
{
}
///
/// Constructor
///
TextCsvKeys::TextCsvKeys( const TextCsvKeys* merge ) : Text( merge )
{
}
///
/// Destructor
///
TextCsvKeys::~TextCsvKeys()
{
}
///
/// Destructor
///
TextCsvKeys::~TextCsvKeys()
{
}
///
/// Clone
///
TextCsvKeys* TextCsvKeys::clone() const
{
return new TextCsvKeys( this );
}
///
/// Clone
///
TextCsvKeys* TextCsvKeys::clone() const
{
return new TextCsvKeys( this );
}
///
/// Get ID
///
QString TextCsvKeys::id()
{
return ID;
}
///
/// Get ID
///
QString TextCsvKeys::id()
{
return ID;
}
///
/// Create
///
Merge* TextCsvKeys::create()
{
return new TextCsvKeys();
}
///
/// Create
///
Merge* TextCsvKeys::create()
{
return new TextCsvKeys();
}
} // namespace glabels::merge
} // namespace merge
} // namespace glabels
+28 -25
View File
@@ -25,40 +25,43 @@
#include "Text.h"
namespace glabels::merge
namespace glabels
{
///
/// TextCsvKeys Merge Backend
///
struct TextCsvKeys : public Text
namespace merge
{
/////////////////////////////////
// Life Cycle
/////////////////////////////////
private:
TextCsvKeys();
TextCsvKeys( const TextCsvKeys* merge );
~TextCsvKeys() override;
///
/// TextCsvKeys Merge Backend
///
struct TextCsvKeys : public Text
{
/////////////////////////////////
// Life Cycle
/////////////////////////////////
private:
TextCsvKeys();
TextCsvKeys( const TextCsvKeys* merge );
~TextCsvKeys() override;
/////////////////////////////////
// Object duplication
/////////////////////////////////
public:
TextCsvKeys* clone() const override;
/////////////////////////////////
// Object duplication
/////////////////////////////////
public:
TextCsvKeys* clone() const override;
/////////////////////////////////
// Static methods
/////////////////////////////////
public:
static QString id();
static Merge* create();
/////////////////////////////////
// Static methods
/////////////////////////////////
public:
static QString id();
static Merge* create();
};
};
}
}
+48 -45
View File
@@ -21,61 +21,64 @@
#include "TextSemicolon.h"
namespace glabels::merge
namespace glabels
{
static const QString ID = "Text/Semicolon";
///
/// Constructor
///
TextSemicolon::TextSemicolon() : Text(';',false)
namespace merge
{
mId = ID;
}
static const QString ID = "Text/Semicolon";
///
/// Constructor
///
TextSemicolon::TextSemicolon( const TextSemicolon* merge ) : Text( merge )
{
}
///
/// Constructor
///
TextSemicolon::TextSemicolon() : Text(';',false)
{
mId = ID;
}
///
/// Destructor
///
TextSemicolon::~TextSemicolon()
{
}
///
/// Constructor
///
TextSemicolon::TextSemicolon( const TextSemicolon* merge ) : Text( merge )
{
}
///
/// Clone
///
TextSemicolon* TextSemicolon::clone() const
{
return new TextSemicolon( this );
}
///
/// Destructor
///
TextSemicolon::~TextSemicolon()
{
}
///
/// Get ID
///
QString TextSemicolon::id()
{
return ID;
}
///
/// Clone
///
TextSemicolon* TextSemicolon::clone() const
{
return new TextSemicolon( this );
}
///
/// Create
///
Merge* TextSemicolon::create()
{
return new TextSemicolon();
}
///
/// Get ID
///
QString TextSemicolon::id()
{
return ID;
}
} // namespace glabels::merge
///
/// Create
///
Merge* TextSemicolon::create()
{
return new TextSemicolon();
}
} // namespace merge
} // namespace glabels
+28 -25
View File
@@ -25,40 +25,43 @@
#include "Text.h"
namespace glabels::merge
namespace glabels
{
///
/// TextSemicolon Merge Backend
///
struct TextSemicolon : public Text
namespace merge
{
/////////////////////////////////
// Life Cycle
/////////////////////////////////
private:
TextSemicolon();
TextSemicolon( const TextSemicolon* merge );
~TextSemicolon() override;
///
/// TextSemicolon Merge Backend
///
struct TextSemicolon : public Text
{
/////////////////////////////////
// Life Cycle
/////////////////////////////////
private:
TextSemicolon();
TextSemicolon( const TextSemicolon* merge );
~TextSemicolon() override;
/////////////////////////////////
// Object duplication
/////////////////////////////////
public:
TextSemicolon* clone() const override;
/////////////////////////////////
// Object duplication
/////////////////////////////////
public:
TextSemicolon* clone() const override;
/////////////////////////////////
// Static methods
/////////////////////////////////
public:
static QString id();
static Merge* create();
/////////////////////////////////
// Static methods
/////////////////////////////////
public:
static QString id();
static Merge* create();
};
};
}
}
+48 -45
View File
@@ -21,61 +21,64 @@
#include "TextSemicolonKeys.h"
namespace glabels::merge
namespace glabels
{
static const QString ID = "Text/Semicolon/Keys";
///
/// Constructor
///
TextSemicolonKeys::TextSemicolonKeys() : Text(';',true)
namespace merge
{
mId = ID;
}
static const QString ID = "Text/Semicolon/Keys";
///
/// Constructor
///
TextSemicolonKeys::TextSemicolonKeys( const TextSemicolonKeys* merge ) : Text( merge )
{
}
///
/// Constructor
///
TextSemicolonKeys::TextSemicolonKeys() : Text(';',true)
{
mId = ID;
}
///
/// Destructor
///
TextSemicolonKeys::~TextSemicolonKeys()
{
}
///
/// Constructor
///
TextSemicolonKeys::TextSemicolonKeys( const TextSemicolonKeys* merge ) : Text( merge )
{
}
///
/// Clone
///
TextSemicolonKeys* TextSemicolonKeys::clone() const
{
return new TextSemicolonKeys( this );
}
///
/// Destructor
///
TextSemicolonKeys::~TextSemicolonKeys()
{
}
///
/// Get ID
///
QString TextSemicolonKeys::id()
{
return ID;
}
///
/// Clone
///
TextSemicolonKeys* TextSemicolonKeys::clone() const
{
return new TextSemicolonKeys( this );
}
///
/// Create
///
Merge* TextSemicolonKeys::create()
{
return new TextSemicolonKeys();
}
///
/// Get ID
///
QString TextSemicolonKeys::id()
{
return ID;
}
} // namespace glabels::merge
///
/// Create
///
Merge* TextSemicolonKeys::create()
{
return new TextSemicolonKeys();
}
} // namespace merge
} // namespace glabels
+28 -25
View File
@@ -25,40 +25,43 @@
#include "Text.h"
namespace glabels::merge
namespace glabels
{
///
/// TextSemicolonKeys Merge Backend
///
struct TextSemicolonKeys : public Text
namespace merge
{
/////////////////////////////////
// Life Cycle
/////////////////////////////////
private:
TextSemicolonKeys();
TextSemicolonKeys( const TextSemicolonKeys* merge );
~TextSemicolonKeys() override;
///
/// TextSemicolonKeys Merge Backend
///
struct TextSemicolonKeys : public Text
{
/////////////////////////////////
// Life Cycle
/////////////////////////////////
private:
TextSemicolonKeys();
TextSemicolonKeys( const TextSemicolonKeys* merge );
~TextSemicolonKeys() override;
/////////////////////////////////
// Object duplication
/////////////////////////////////
public:
TextSemicolonKeys* clone() const override;
/////////////////////////////////
// Object duplication
/////////////////////////////////
public:
TextSemicolonKeys* clone() const override;
/////////////////////////////////
// Static methods
/////////////////////////////////
public:
static QString id();
static Merge* create();
/////////////////////////////////
// Static methods
/////////////////////////////////
public:
static QString id();
static Merge* create();
};
};
}
}
+46 -43
View File
@@ -21,61 +21,64 @@
#include "TextTsv.h"
namespace glabels::merge
namespace glabels
{
namespace merge
{
static const QString ID = "Text/Tab";
static const QString ID = "Text/Tab";
///
/// Constructor
///
TextTsv::TextTsv() : Text('\t',false)
{
mId = ID;
}
///
/// Constructor
///
TextTsv::TextTsv() : Text('\t',false)
{
mId = ID;
}
///
/// Constructor
///
TextTsv::TextTsv( const TextTsv* merge ) : Text( merge )
{
}
///
/// Constructor
///
TextTsv::TextTsv( const TextTsv* merge ) : Text( merge )
{
}
///
/// Destructor
///
TextTsv::~TextTsv()
{
}
///
/// Destructor
///
TextTsv::~TextTsv()
{
}
///
/// Clone
///
TextTsv* TextTsv::clone() const
{
return new TextTsv( this );
}
///
/// Clone
///
TextTsv* TextTsv::clone() const
{
return new TextTsv( this );
}
///
/// Get ID
///
QString TextTsv::id()
{
return ID;
}
///
/// Get ID
///
QString TextTsv::id()
{
return ID;
}
///
/// Create
///
Merge* TextTsv::create()
{
return new TextTsv();
}
///
/// Create
///
Merge* TextTsv::create()
{
return new TextTsv();
}
} // namespace glabels::merge
} // namespace merge
} // namespace glabels
+28 -25
View File
@@ -25,40 +25,43 @@
#include "Text.h"
namespace glabels::merge
namespace glabels
{
///
/// TextTsv Merge Backend
///
struct TextTsv : public Text
namespace merge
{
/////////////////////////////////
// Life Cycle
/////////////////////////////////
private:
TextTsv();
TextTsv( const TextTsv* merge );
~TextTsv() override;
///
/// TextTsv Merge Backend
///
struct TextTsv : public Text
{
/////////////////////////////////
// Life Cycle
/////////////////////////////////
private:
TextTsv();
TextTsv( const TextTsv* merge );
~TextTsv() override;
/////////////////////////////////
// Object duplication
/////////////////////////////////
public:
TextTsv* clone() const override;
/////////////////////////////////
// Object duplication
/////////////////////////////////
public:
TextTsv* clone() const override;
/////////////////////////////////
// Static methods
/////////////////////////////////
public:
static QString id();
static Merge* create();
/////////////////////////////////
// Static methods
/////////////////////////////////
public:
static QString id();
static Merge* create();
};
};
}
}
+48 -45
View File
@@ -21,61 +21,64 @@
#include "TextTsvKeys.h"
namespace glabels::merge
namespace glabels
{
static const QString ID = "Text/Tab/Line1Keys";
///
/// Constructor
///
TextTsvKeys::TextTsvKeys() : Text('\t',true)
namespace merge
{
mId = ID;
}
static const QString ID = "Text/Tab/Line1Keys";
///
/// Constructor
///
TextTsvKeys::TextTsvKeys( const TextTsvKeys* merge ) : Text( merge )
{
}
///
/// Constructor
///
TextTsvKeys::TextTsvKeys() : Text('\t',true)
{
mId = ID;
}
///
/// Destructor
///
TextTsvKeys::~TextTsvKeys()
{
}
///
/// Constructor
///
TextTsvKeys::TextTsvKeys( const TextTsvKeys* merge ) : Text( merge )
{
}
///
/// Clone
///
TextTsvKeys* TextTsvKeys::clone() const
{
return new TextTsvKeys( this );
}
///
/// Destructor
///
TextTsvKeys::~TextTsvKeys()
{
}
///
/// Get ID
///
QString TextTsvKeys::id()
{
return ID;
}
///
/// Clone
///
TextTsvKeys* TextTsvKeys::clone() const
{
return new TextTsvKeys( this );
}
///
/// Create
///
Merge* TextTsvKeys::create()
{
return new TextTsvKeys();
}
///
/// Get ID
///
QString TextTsvKeys::id()
{
return ID;
}
} // namespace glabels::merge
///
/// Create
///
Merge* TextTsvKeys::create()
{
return new TextTsvKeys();
}
} // namespace merge
} // namespace glabels
+28 -25
View File
@@ -25,40 +25,43 @@
#include "Text.h"
namespace glabels::merge
namespace glabels
{
///
/// TextTsvKeys Merge Backend
///
struct TextTsvKeys : public Text
namespace merge
{
/////////////////////////////////
// Life Cycle
/////////////////////////////////
private:
TextTsvKeys();
TextTsvKeys( const TextTsvKeys* merge );
~TextTsvKeys() override;
///
/// TextTsvKeys Merge Backend
///
struct TextTsvKeys : public Text
{
/////////////////////////////////
// Life Cycle
/////////////////////////////////
private:
TextTsvKeys();
TextTsvKeys( const TextTsvKeys* merge );
~TextTsvKeys() override;
/////////////////////////////////
// Object duplication
/////////////////////////////////
public:
TextTsvKeys* clone() const override;
/////////////////////////////////
// Object duplication
/////////////////////////////////
public:
TextTsvKeys* clone() const override;
/////////////////////////////////
// Static methods
/////////////////////////////////
public:
static QString id();
static Merge* create();
/////////////////////////////////
// Static methods
/////////////////////////////////
public:
static QString id();
static Merge* create();
};
};
}
}