JtReader: Fix header uniformity and trailing whitespace (#7919)

* also remove unused boolean
This commit is contained in:
luzpaz
2022-12-01 18:47:00 -05:00
committed by GitHub
parent e00a5243ec
commit 654d82d91c
15 changed files with 236 additions and 241 deletions

View File

@@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (c) Juergen Riegel (juergen.riegel@web.de) 2014 *
/**************************************************************************
* Copyright (c) 2014 Juergen Riegel <juergen.riegel@web.de> *
* *
* This file is part of the FreeCAD CAx development system. *
* *

View File

@@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (c) Juergen Riegel (juergen.riegel@web.de) 2014 *
/**************************************************************************
* Copyright (c) 2014 Juergen Riegel <juergen.riegel@web.de> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
@@ -28,7 +28,7 @@
class FcLodHandler: public LodHandler
{
public:
virtual void startLod();
virtual void startLod();

View File

@@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (c) Juergen Riegel (juergen.riegel@web.de) 2014 *
/**************************************************************************
* Copyright (c) 2014 Juergen Riegel <juergen.riegel@web.de> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
@@ -32,13 +32,11 @@ using namespace std;
class Context
{
public:
Context(istream &s) :Strm(s){};
uint8_t VersionMinor;
uint8_t VersionMajor;
Context(istream &s) :Strm(s){};
uint8_t VersionMinor;
uint8_t VersionMajor;
bool Endiness;
istream & Strm;
istream & Strm;
};

View File

@@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (c) Juergen Riegel (juergen.riegel@web.de) 2014 *
/**************************************************************************
* Copyright (c) 2014 Juergen Riegel <juergen.riegel@web.de> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
@@ -39,26 +39,26 @@ using namespace std;
struct Element_Header
{
Element_Header(){};
Element_Header(){};
Element_Header(Context& cont, bool zLib=false)
{
read(cont, zLib);
};
Element_Header(Context& cont, bool zLib=false)
{
read(cont, zLib);
};
inline void read(Context& cont ,bool zLib=false)
{
// only zip less implemented so far...
assert(zLib == false);
inline void read(Context& cont ,bool zLib=false)
{
// only zip less implemented so far...
assert(zLib == false);
Element_Length.read(cont);
Object_Type_ID.read(cont);
Object_Base_Type.read(cont);
};
Element_Length.read(cont);
Object_Type_ID.read(cont);
Object_Base_Type.read(cont);
};
I32 Element_Length;
GUID Object_Type_ID;
UChar Object_Base_Type;
I32 Element_Length;
GUID Object_Type_ID;
UChar Object_Base_Type;
};

View File

@@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (c) Juergen Riegel (juergen.riegel@web.de) 2014 *
* Copyright (c) 2014 Juergen Riegel <juergen.riegel@web.de> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
@@ -35,76 +35,76 @@
using namespace std;
#undef _C2
#undef _C2
struct GUID
{
GUID(){};
GUID(){};
GUID(uint32_t a1, uint16_t b1, uint16_t b2, uint8_t c1, uint8_t c2, uint8_t c3, uint8_t c4, uint8_t c5, uint8_t c6, uint8_t c7, uint8_t c8)
:_A1(a1), _B1(b1), _B2(b2), _C1(c1), _C2(c2), _C3(c3), _C4(c4), _C5(c5), _C6(c6), _C7(c7), _C8(c8)
{}
GUID(uint32_t a1, uint16_t b1, uint16_t b2, uint8_t c1, uint8_t c2, uint8_t c3, uint8_t c4, uint8_t c5, uint8_t c6, uint8_t c7, uint8_t c8)
:_A1(a1), _B1(b1), _B2(b2), _C1(c1), _C2(c2), _C3(c3), _C4(c4), _C5(c5), _C6(c6), _C7(c7), _C8(c8)
{}
GUID(Context& cont)
{
read(cont);
}
GUID(Context& cont)
{
read(cont);
}
bool operator!=(const GUID& other) const {
return !operator == (other);
}
bool operator==(const GUID& other) const {
return
_A1 == other._A1
&& _B1 == other._B1
&& _B2 == other._B2
&& _C1 == other._C1
&& _C2 == other._C2
&& _C3 == other._C3
&& _C4 == other._C4
&& _C5 == other._C5
&& _C6 == other._C6
&& _C7 == other._C7
&& _C8 == other._C8;
}
bool operator!=(const GUID& other) const {
return !operator == (other);
}
inline void read(Context& cont)
{
_A1.read(cont);
bool operator==(const GUID& other) const {
return
_A1 == other._A1
&& _B1 == other._B1
&& _B2 == other._B2
&& _C1 == other._C1
&& _C2 == other._C2
&& _C3 == other._C3
&& _C4 == other._C4
&& _C5 == other._C5
&& _C6 == other._C6
&& _C7 == other._C7
&& _C8 == other._C8;
}
_B1.read(cont);
_B2.read(cont);
inline void read(Context& cont)
{
_A1.read(cont);
_C1.read(cont);
_C2.read(cont);
_C3.read(cont);
_C4.read(cont);
_C5.read(cont);
_C6.read(cont);
_C7.read(cont);
_C8.read(cont);
}
_B1.read(cont);
_B2.read(cont);
std::string toString()const{
std::stringstream strm;
strm << "{" << std::hex << _A1 << "-" << _B1 << _B2 << "-" << _C1 << _C2 << _C3 << _C4 << _C5 << _C6 << _C7 << _C8 << "}";
return strm.str();
}
_C1.read(cont);
_C2.read(cont);
_C3.read(cont);
_C4.read(cont);
_C5.read(cont);
_C6.read(cont);
_C7.read(cont);
_C8.read(cont);
}
U32 _A1;
std::string toString()const{
std::stringstream strm;
strm << "{" << std::hex << _A1 << "-" << _B1 << _B2 << "-" << _C1 << _C2 << _C3 << _C4 << _C5 << _C6 << _C7 << _C8 << "}";
return strm.str();
}
U16 _B1;
U16 _B2;
U32 _A1;
U8 _C1;
U8 _C2;
U8 _C3;
U8 _C4;
U8 _C5;
U8 _C6;
U8 _C7;
U8 _C8;
U16 _B1;
U16 _B2;
U8 _C1;
U8 _C2;
U8 _C3;
U8 _C4;
U8 _C5;
U8 _C6;
U8 _C7;
U8 _C8;
};

View File

@@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (c) Juergen Riegel (juergen.riegel@web.de) 2014 *
/**************************************************************************
* Copyright (c) 2014 Juergen Riegel <juergen.riegel@web.de> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
@@ -30,24 +30,24 @@ using namespace std;
struct I32
{
I32(){};
I32(){};
I32(Context& cont)
{
read(cont);
}
I32(Context& cont)
{
read(cont);
}
inline operator int32_t() const
{
return _I32;
}
inline operator int32_t() const
{
return _I32;
}
inline void read(Context& cont)
{
cont.Strm.read((char*)&_I32, 4);
}
inline void read(Context& cont)
{
cont.Strm.read((char*)&_I32, 4);
}
int32_t _I32;
int32_t _I32;
};

View File

@@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (c) Juergen Riegel (juergen.riegel@web.de) 2014 *
/**************************************************************************
* Copyright (c) 2014 Juergen Riegel <juergen.riegel@web.de> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
@@ -28,7 +28,7 @@
class LodHandler
{
public:
virtual void startLod(){};
virtual void startLod(){};

View File

@@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (c) Juergen Riegel (juergen.riegel@web.de) 2014 *
/**************************************************************************
* Copyright (c) 2014 Juergen Riegel <juergen.riegel@web.de> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
@@ -39,23 +39,23 @@ using namespace std;
struct Segment_Header
{
Segment_Header(){};
Segment_Header(){};
Segment_Header(Context& cont)
{
read(cont);
};
Segment_Header(Context& cont)
{
read(cont);
};
inline void read(Context& cont)
{
Segment_ID.read(cont);
Segment_Type.read(cont);
Segment_Length.read(cont);
};
inline void read(Context& cont)
{
Segment_ID.read(cont);
Segment_Type.read(cont);
Segment_Length.read(cont);
};
GUID Segment_ID;
I32 Segment_Type;
I32 Segment_Length;
GUID Segment_ID;
I32 Segment_Type;
I32 Segment_Length;
};

View File

@@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (c) Juergen Riegel (juergen.riegel@web.de) 2014 *
/**************************************************************************
* Copyright (c) 2014 Juergen Riegel <juergen.riegel@web.de> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
@@ -39,37 +39,37 @@ using namespace std;
struct TOC_Entry
{
TOC_Entry(){};
TOC_Entry(){};
TOC_Entry(Context& cont)
{
read(cont);
};
TOC_Entry(Context& cont)
{
read(cont);
};
inline void read(Context& cont)
{
Segment_ID.read(cont);
Segment_Offset.read(cont);
Segment_Length.read(cont);
Segment_Attributes.read(cont);
};
inline void read(Context& cont)
{
Segment_ID.read(cont);
Segment_Offset.read(cont);
Segment_Length.read(cont);
Segment_Attributes.read(cont);
};
uint8_t getSegmentType()const
{
return Segment_Attributes >> 24;
}
uint8_t getSegmentType()const
{
return Segment_Attributes >> 24;
}
std::string toString()const{
stringstream strm;
strm << getSegmentType() << ":" << Segment_Offset << ":" << Segment_Length << ":" << Segment_ID.toString();
return strm.str();
}
std::string toString()const{
stringstream strm;
strm << getSegmentType() << ":" << Segment_Offset << ":" << Segment_Length << ":" << Segment_ID.toString();
GUID Segment_ID;
I32 Segment_Offset;
I32 Segment_Length;
U32 Segment_Attributes;
return strm.str();
}
GUID Segment_ID;
I32 Segment_Offset;
I32 Segment_Length;
U32 Segment_Attributes;
};

View File

@@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (c) Juergen Riegel (juergen.riegel@web.de) 2014 *
/**************************************************************************
* Copyright (c) 2014 Juergen Riegel <juergen.riegel@web.de> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
@@ -30,26 +30,26 @@ using namespace std;
struct U16
{
U16(){};
U16(){};
U16(uint16_t ui) :_U16(ui){}
U16(uint16_t ui) :_U16(ui){}
U16(Context& cont)
{
read(cont);
}
U16(Context& cont)
{
read(cont);
}
inline void read(Context& cont)
{
cont.Strm.read((char*)&_U16, 2);
}
inline void read(Context& cont)
{
cont.Strm.read((char*)&_U16, 2);
}
inline operator uint16_t() const
{
return _U16;
}
inline operator uint16_t() const
{
return _U16;
}
uint16_t _U16;
uint16_t _U16;
};

View File

@@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (c) Juergen Riegel (juergen.riegel@web.de) 2014 *
/**************************************************************************
* Copyright (c) 2014 Juergen Riegel <juergen.riegel@web.de> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
@@ -30,26 +30,26 @@ using namespace std;
struct U32
{
U32(){};
U32(){};
U32(uint32_t ui) :_U32(ui){}
U32(uint32_t ui) :_U32(ui){}
U32(Context& cont)
{
read(cont);
}
U32(Context& cont)
{
read(cont);
}
inline operator uint32_t() const
{
return _U32;
}
inline operator uint32_t() const
{
return _U32;
}
inline void read(Context& cont)
{
cont.Strm.read((char*)&_U32, 4);
}
inline void read(Context& cont)
{
cont.Strm.read((char*)&_U32, 4);
}
uint32_t _U32;
uint32_t _U32;
};

View File

@@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (c) Juergen Riegel (juergen.riegel@web.de) 2014 *
/**************************************************************************
* Copyright (c) 2014 Juergen Riegel <juergen.riegel@web.de> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
@@ -31,28 +31,28 @@ using namespace std;
struct U8
{
U8(){};
U8(){};
U8(uint8_t ui) :_U8(ui){}
U8(uint8_t ui) :_U8(ui){}
U8(Context& cont)
{
read(cont);
}
U8(Context& cont)
{
read(cont);
}
inline void read(Context& cont)
{
cont.Strm.read((char*)&_U8, 1);
}
inline void read(Context& cont)
{
cont.Strm.read((char*)&_U8, 1);
}
inline operator uint8_t() const
{
return _U8;
}
inline operator uint8_t() const
{
return _U8;
}
uint8_t _U8;
uint8_t _U8;
};

View File

@@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (c) Juergen Riegel (juergen.riegel@web.de) 2014 *
/**************************************************************************
* Copyright (c) 2014 Juergen Riegel <juergen.riegel@web.de> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
@@ -31,24 +31,24 @@ using namespace std;
struct UChar
{
UChar(){};
UChar(){};
UChar(Context& cont)
{
read(cont);
}
UChar(Context& cont)
{
read(cont);
}
inline operator uint8_t() const
{
return _UChar;
}
inline operator uint8_t() const
{
return _UChar;
}
inline void read(Context& cont)
{
cont.Strm.read((char*)&_UChar, 1);
}
inline void read(Context& cont)
{
cont.Strm.read((char*)&_UChar, 1);
}
uint8_t _UChar;
uint8_t _UChar;
};

View File

@@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (c) Juergen Riegel <juergen.riegel@web.de> *
/**************************************************************************
* Copyright (c) 2014 Juergen Riegel <juergen.riegel@web.de> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
@@ -43,22 +43,22 @@ TestJtReader::~TestJtReader()
void TestJtReader::read(void)
{
//const std::vector<TOC_Entry>& toc = readToc();
//const std::vector<TOC_Entry>& toc = readToc();
for (std::vector<TOC_Entry>::const_iterator i = TocEntries.begin(); i != TocEntries.end(); ++i){
int segType = i->getSegmentType();
for (std::vector<TOC_Entry>::const_iterator i = TocEntries.begin(); i != TocEntries.end(); ++i){
int segType = i->getSegmentType();
if (segType == 7){
FcLodHandler handler;
if (segType == 7){
FcLodHandler handler;
readLodSegment(*i, handler);
readLodSegment(*i, handler);
}
}
Base::Console().Log(i->toString().c_str());
}
Base::Console().Log(i->toString().c_str());
}

View File

@@ -1,12 +1,5 @@
# JtReader gui init module
# (c) 2003 Juergen Riegel
#
# Gathering all the information to start FreeCAD
# This is the second one of three init scripts, the third one
# runs when the gui is up
#***************************************************************************
#* (c) Juergen Riegel (juergen.riegel@web.de) 2002 *
#* Copyright (c) 2002,2003 Juergen Riegel <juergen.riegel@web.de> *
#* *
#* This file is part of the FreeCAD CAx development system. *
#* *
@@ -26,7 +19,11 @@
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
#* USA *
#* *
#* Juergen Riegel 2002 *
#***************************************************************************/
#***************************************************************************
# JtReader gui init module
#
# Gathering all the information to start FreeCAD
# This is the second one of three init scripts, the third one
# runs when the gui is up