Skip to content

Commit

Permalink
Sync some libdxfrw files with the upstream versions
Browse files Browse the repository at this point in the history
Syncs some files with their counterparts from https://github.com/LibreCAD/libdxfrw
Basically this undoes the QGIS specific styling applied to these
files and excludes them from the astyle script. Apart from the
whitespace changes there's only very minor code modernization
changes.

But the goal here is to reduce the diffs between us and upstream
so that we can more easily push fixes upstream and pull them
downstream.
  • Loading branch information
nyalldawson committed Aug 5, 2021
1 parent 298c78f commit 52b9c02
Show file tree
Hide file tree
Showing 8 changed files with 62,326 additions and 62,494 deletions.
15,579 changes: 7,788 additions & 7,791 deletions external/libdxfrw/intern/drw_cptable932.h

Large diffs are not rendered by default.

43,847 changes: 21,922 additions & 21,925 deletions external/libdxfrw/intern/drw_cptable936.h

Large diffs are not rendered by default.

34,359 changes: 17,178 additions & 17,181 deletions external/libdxfrw/intern/drw_cptable949.h

Large diffs are not rendered by default.

27,269 changes: 13,633 additions & 13,636 deletions external/libdxfrw/intern/drw_cptable950.h

Large diffs are not rendered by default.

2,590 changes: 1,290 additions & 1,300 deletions external/libdxfrw/intern/drw_cptables.h

Large diffs are not rendered by default.

1,050 changes: 454 additions & 596 deletions external/libdxfrw/intern/drw_textcodec.cpp

Large diffs are not rendered by default.

124 changes: 60 additions & 64 deletions external/libdxfrw/intern/drw_textcodec.h
Expand Up @@ -2,98 +2,94 @@
#define DRW_TEXTCODEC_H

#include <string>
#include <memory>

class DRW_Converter;

class DRW_TextCodec
{
public:
public:
DRW_TextCodec();
~DRW_TextCodec();
std::string fromUtf8( std::string s );
std::string toUtf8( std::string s );
int getVersion() {return version;}
void setVersion( std::string *v, bool dxfFormat );
void setVersion( int v, bool dxfFormat );
void setCodePage( std::string *c, bool dxfFormat );
void setCodePage( std::string c, bool dxfFormat ) {setCodePage( &c, dxfFormat );}
std::string getCodePage() {return cp;}
std::string fromUtf8(std::string s);
std::string toUtf8(std::string s);
int getVersion(){return version;}
void setVersion(std::string *v, bool dxfFormat);
void setVersion(int v, bool dxfFormat);
void setCodePage(std::string *c, bool dxfFormat);
void setCodePage(std::string c, bool dxfFormat){setCodePage(&c, dxfFormat);}
std::string getCodePage(){return cp;}

private:
std::string correctCodePage( const std::string &s );
private:
std::string correctCodePage(const std::string& s);

private:
private:
int version;
std::string cp;
DRW_Converter *conv = nullptr;
std::unique_ptr< DRW_Converter> conv;
};

class DRW_Converter
{
public:
DRW_Converter( const int *t, int l )
{
table = t;
cpLength = l;
}
virtual ~DRW_Converter() = default;
virtual std::string fromUtf8( std::string *s ) {return *s;}
virtual std::string toUtf8( std::string *s );
std::string encodeText( std::string stmp );
std::string decodeText( int c );
std::string encodeNum( int c );
int decodeNum( std::string s, int *b );
public:
DRW_Converter(const int *t, int l)
:table{t }
,cpLength{l}
{}
virtual ~DRW_Converter(){}
virtual std::string fromUtf8(std::string *s) {return *s;}
virtual std::string toUtf8(std::string *s);
std::string encodeText(std::string stmp);
std::string decodeText(int c);
std::string encodeNum(int c);
int decodeNum(std::string s, int *b);
const int *table = nullptr;
int cpLength;
};

class DRW_ConvUTF16 : public DRW_Converter
{
public:
DRW_ConvUTF16(): DRW_Converter( nullptr, 0 ) {}
virtual std::string fromUtf8( std::string *s );
virtual std::string toUtf8( std::string *s );
class DRW_ConvUTF16 : public DRW_Converter {
public:
DRW_ConvUTF16():DRW_Converter(nullptr, 0) {}
virtual std::string fromUtf8(std::string *s);
virtual std::string toUtf8(std::string *s);
};

class DRW_ConvTable : public DRW_Converter
{
public:
DRW_ConvTable( const int *t, int l ): DRW_Converter( t, l ) {}
virtual std::string fromUtf8( std::string *s );
virtual std::string toUtf8( std::string *s );
class DRW_ConvTable : public DRW_Converter {
public:
DRW_ConvTable(const int *t, int l):DRW_Converter(t, l) {}
virtual std::string fromUtf8(std::string *s);
virtual std::string toUtf8(std::string *s);
};

class DRW_ConvDBCSTable : public DRW_Converter
{
public:
DRW_ConvDBCSTable( const int *t, const int *lt, const int dt[][2], int l ): DRW_Converter( t, l )
{
leadTable = lt;
doubleTable = dt;
}
class DRW_ConvDBCSTable : public DRW_Converter {
public:
DRW_ConvDBCSTable(const int *t, const int *lt, const int dt[][2], int l)
:DRW_Converter(t, l)
,leadTable{lt}
,doubleTable{dt}
{}

virtual std::string fromUtf8( std::string *s );
virtual std::string toUtf8( std::string *s );
private:
const int *leadTable = nullptr;
const int ( *doubleTable )[2];
virtual std::string fromUtf8(std::string *s);
virtual std::string toUtf8(std::string *s);
private:
const int *leadTable;
const int (*doubleTable)[2];

};

class DRW_Conv932Table : public DRW_Converter
{
public:
DRW_Conv932Table( const int *t, const int *lt, const int dt[][2], int l ): DRW_Converter( t, l )
{
leadTable = lt;
doubleTable = dt;
}
class DRW_Conv932Table : public DRW_Converter {
public:
DRW_Conv932Table(const int *t, const int *lt, const int dt[][2], int l)
:DRW_Converter(t, l)
,leadTable{lt}
,doubleTable{dt}
{}

virtual std::string fromUtf8( std::string *s );
virtual std::string toUtf8( std::string *s );
private:
const int *leadTable = nullptr;
const int ( *doubleTable )[2];
virtual std::string fromUtf8(std::string *s);
virtual std::string toUtf8(std::string *s);
private:
const int *leadTable;
const int (*doubleTable)[2];

};

Expand Down
2 changes: 1 addition & 1 deletion scripts/astyle.sh
Expand Up @@ -105,7 +105,7 @@ astyleit() {

for f in "$@"; do
case "$f" in
src/plugins/grass/qtermwidget/*|external/untwine/*|external/qwt*|external/o2/*|external/odbccpp/*|external/qt-unix-signals/*|external/rtree/*|external/astyle/*|external/kdbush/*|external/poly2tri/*|external/wintoast/*|external/qt3dextra-headers/*|external/laz-perf/*|external/meshOptimizer/*|external/mapbox-vector-tile/*|python/ext-libs/*|ui_*.py|*.astyle|tests/testdata/*|editors/*)
src/plugins/grass/qtermwidget/*|external/libdxfrw/*|external/untwine/*|external/qwt*|external/o2/*|external/odbccpp/*|external/qt-unix-signals/*|external/rtree/*|external/astyle/*|external/kdbush/*|external/poly2tri/*|external/wintoast/*|external/qt3dextra-headers/*|external/laz-perf/*|external/meshOptimizer/*|external/mapbox-vector-tile/*|python/ext-libs/*|ui_*.py|*.astyle|tests/testdata/*|editors/*)
echo -ne "$f skipped $elcr"
continue
;;
Expand Down

0 comments on commit 52b9c02

Please sign in to comment.