From 654d82d91cca93adbbdf2f63c750991bbf838092 Mon Sep 17 00:00:00 2001 From: luzpaz Date: Thu, 1 Dec 2022 18:47:00 -0500 Subject: [PATCH] JtReader: Fix header uniformity and trailing whitespace (#7919) * also remove unused boolean --- src/Mod/JtReader/App/FcLodHandler.cpp | 4 +- src/Mod/JtReader/App/FcLodHandler.h | 6 +- src/Mod/JtReader/App/JrJt/Context.h | 14 ++- src/Mod/JtReader/App/JrJt/Element_Header.h | 36 +++---- src/Mod/JtReader/App/JrJt/GUID.h | 116 ++++++++++----------- src/Mod/JtReader/App/JrJt/I32.h | 32 +++--- src/Mod/JtReader/App/JrJt/LodHandler.h | 6 +- src/Mod/JtReader/App/JrJt/Segment_Header.h | 32 +++--- src/Mod/JtReader/App/JrJt/TOC_Entry.h | 56 +++++----- src/Mod/JtReader/App/JrJt/U16.h | 34 +++--- src/Mod/JtReader/App/JrJt/U32.h | 34 +++--- src/Mod/JtReader/App/JrJt/U8.h | 34 +++--- src/Mod/JtReader/App/JrJt/UChar.h | 32 +++--- src/Mod/JtReader/App/TestJtReader.cpp | 24 ++--- src/Mod/JtReader/InitGui.py | 17 ++- 15 files changed, 236 insertions(+), 241 deletions(-) diff --git a/src/Mod/JtReader/App/FcLodHandler.cpp b/src/Mod/JtReader/App/FcLodHandler.cpp index 4a03139969..1f6315b850 100644 --- a/src/Mod/JtReader/App/FcLodHandler.cpp +++ b/src/Mod/JtReader/App/FcLodHandler.cpp @@ -1,5 +1,5 @@ -/*************************************************************************** -* Copyright (c) Juergen Riegel (juergen.riegel@web.de) 2014 * +/************************************************************************** +* Copyright (c) 2014 Juergen Riegel * * * * This file is part of the FreeCAD CAx development system. * * * diff --git a/src/Mod/JtReader/App/FcLodHandler.h b/src/Mod/JtReader/App/FcLodHandler.h index bd4fad3d70..f564743d57 100644 --- a/src/Mod/JtReader/App/FcLodHandler.h +++ b/src/Mod/JtReader/App/FcLodHandler.h @@ -1,5 +1,5 @@ -/*************************************************************************** -* Copyright (c) Juergen Riegel (juergen.riegel@web.de) 2014 * +/************************************************************************** +* Copyright (c) 2014 Juergen Riegel * * * * 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(); diff --git a/src/Mod/JtReader/App/JrJt/Context.h b/src/Mod/JtReader/App/JrJt/Context.h index e43f035dfe..5151f0f259 100644 --- a/src/Mod/JtReader/App/JrJt/Context.h +++ b/src/Mod/JtReader/App/JrJt/Context.h @@ -1,5 +1,5 @@ -/*************************************************************************** -* Copyright (c) Juergen Riegel (juergen.riegel@web.de) 2014 * +/************************************************************************** +* Copyright (c) 2014 Juergen Riegel * * * * 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; }; diff --git a/src/Mod/JtReader/App/JrJt/Element_Header.h b/src/Mod/JtReader/App/JrJt/Element_Header.h index 65e5523be1..832a92451b 100644 --- a/src/Mod/JtReader/App/JrJt/Element_Header.h +++ b/src/Mod/JtReader/App/JrJt/Element_Header.h @@ -1,5 +1,5 @@ -/*************************************************************************** -* Copyright (c) Juergen Riegel (juergen.riegel@web.de) 2014 * +/************************************************************************** +* Copyright (c) 2014 Juergen Riegel * * * * 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; }; diff --git a/src/Mod/JtReader/App/JrJt/GUID.h b/src/Mod/JtReader/App/JrJt/GUID.h index 3afcd55df9..2d75da3e60 100644 --- a/src/Mod/JtReader/App/JrJt/GUID.h +++ b/src/Mod/JtReader/App/JrJt/GUID.h @@ -1,5 +1,5 @@ /*************************************************************************** -* Copyright (c) Juergen Riegel (juergen.riegel@web.de) 2014 * +* Copyright (c) 2014 Juergen Riegel * * * * 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; }; diff --git a/src/Mod/JtReader/App/JrJt/I32.h b/src/Mod/JtReader/App/JrJt/I32.h index 2416a98e0c..fbac085c2d 100644 --- a/src/Mod/JtReader/App/JrJt/I32.h +++ b/src/Mod/JtReader/App/JrJt/I32.h @@ -1,5 +1,5 @@ -/*************************************************************************** -* Copyright (c) Juergen Riegel (juergen.riegel@web.de) 2014 * +/************************************************************************** +* Copyright (c) 2014 Juergen Riegel * * * * 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; }; diff --git a/src/Mod/JtReader/App/JrJt/LodHandler.h b/src/Mod/JtReader/App/JrJt/LodHandler.h index 0d830e1c3b..c61c2d5d3c 100644 --- a/src/Mod/JtReader/App/JrJt/LodHandler.h +++ b/src/Mod/JtReader/App/JrJt/LodHandler.h @@ -1,5 +1,5 @@ -/*************************************************************************** -* Copyright (c) Juergen Riegel (juergen.riegel@web.de) 2014 * +/************************************************************************** +* Copyright (c) 2014 Juergen Riegel * * * * This file is part of the FreeCAD CAx development system. * * * @@ -28,7 +28,7 @@ class LodHandler { public: - virtual void startLod(){}; + virtual void startLod(){}; diff --git a/src/Mod/JtReader/App/JrJt/Segment_Header.h b/src/Mod/JtReader/App/JrJt/Segment_Header.h index 3dd4d6f34e..bde3d139df 100644 --- a/src/Mod/JtReader/App/JrJt/Segment_Header.h +++ b/src/Mod/JtReader/App/JrJt/Segment_Header.h @@ -1,5 +1,5 @@ -/*************************************************************************** -* Copyright (c) Juergen Riegel (juergen.riegel@web.de) 2014 * +/************************************************************************** +* Copyright (c) 2014 Juergen Riegel * * * * 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; }; diff --git a/src/Mod/JtReader/App/JrJt/TOC_Entry.h b/src/Mod/JtReader/App/JrJt/TOC_Entry.h index 0605c7558b..73f9f0e985 100644 --- a/src/Mod/JtReader/App/JrJt/TOC_Entry.h +++ b/src/Mod/JtReader/App/JrJt/TOC_Entry.h @@ -1,5 +1,5 @@ -/*************************************************************************** -* Copyright (c) Juergen Riegel (juergen.riegel@web.de) 2014 * +/************************************************************************** +* Copyright (c) 2014 Juergen Riegel * * * * 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; }; diff --git a/src/Mod/JtReader/App/JrJt/U16.h b/src/Mod/JtReader/App/JrJt/U16.h index 422f830c91..3bb5488e1c 100644 --- a/src/Mod/JtReader/App/JrJt/U16.h +++ b/src/Mod/JtReader/App/JrJt/U16.h @@ -1,5 +1,5 @@ -/*************************************************************************** -* Copyright (c) Juergen Riegel (juergen.riegel@web.de) 2014 * +/************************************************************************** +* Copyright (c) 2014 Juergen Riegel * * * * 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; }; diff --git a/src/Mod/JtReader/App/JrJt/U32.h b/src/Mod/JtReader/App/JrJt/U32.h index f1d30e3117..ccf258d724 100644 --- a/src/Mod/JtReader/App/JrJt/U32.h +++ b/src/Mod/JtReader/App/JrJt/U32.h @@ -1,5 +1,5 @@ -/*************************************************************************** -* Copyright (c) Juergen Riegel (juergen.riegel@web.de) 2014 * +/************************************************************************** +* Copyright (c) 2014 Juergen Riegel * * * * 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; }; diff --git a/src/Mod/JtReader/App/JrJt/U8.h b/src/Mod/JtReader/App/JrJt/U8.h index 5ed935758b..a6131565c0 100644 --- a/src/Mod/JtReader/App/JrJt/U8.h +++ b/src/Mod/JtReader/App/JrJt/U8.h @@ -1,5 +1,5 @@ -/*************************************************************************** -* Copyright (c) Juergen Riegel (juergen.riegel@web.de) 2014 * +/************************************************************************** +* Copyright (c) 2014 Juergen Riegel * * * * 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; }; diff --git a/src/Mod/JtReader/App/JrJt/UChar.h b/src/Mod/JtReader/App/JrJt/UChar.h index 610af8089c..32831bf1a9 100644 --- a/src/Mod/JtReader/App/JrJt/UChar.h +++ b/src/Mod/JtReader/App/JrJt/UChar.h @@ -1,5 +1,5 @@ -/*************************************************************************** -* Copyright (c) Juergen Riegel (juergen.riegel@web.de) 2014 * +/************************************************************************** +* Copyright (c) 2014 Juergen Riegel * * * * 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; }; diff --git a/src/Mod/JtReader/App/TestJtReader.cpp b/src/Mod/JtReader/App/TestJtReader.cpp index d81f428219..a59efa2595 100644 --- a/src/Mod/JtReader/App/TestJtReader.cpp +++ b/src/Mod/JtReader/App/TestJtReader.cpp @@ -1,5 +1,5 @@ -/*************************************************************************** -* Copyright (c) Juergen Riegel * +/************************************************************************** +* Copyright (c) 2014 Juergen Riegel * * * * This file is part of the FreeCAD CAx development system. * * * @@ -43,22 +43,22 @@ TestJtReader::~TestJtReader() void TestJtReader::read(void) { - //const std::vector& toc = readToc(); + //const std::vector& toc = readToc(); - for (std::vector::const_iterator i = TocEntries.begin(); i != TocEntries.end(); ++i){ - int segType = i->getSegmentType(); + for (std::vector::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()); + } diff --git a/src/Mod/JtReader/InitGui.py b/src/Mod/JtReader/InitGui.py index 9c2869e1fd..826f9602a1 100644 --- a/src/Mod/JtReader/InitGui.py +++ b/src/Mod/JtReader/InitGui.py @@ -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 * #* * #* 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