From bb012ad5f5e8adc529c29d72acb4a12ba5c81dfd Mon Sep 17 00:00:00 2001 From: Dominik Wernberger Date: Thu, 4 Jul 2024 17:29:06 +0200 Subject: [PATCH] Apply clang-format --- src/CfbfStreamLocation.hpp | 23 +- src/Container.cpp | 53 ++- src/Container.hpp | 9 +- src/ContainerContext.cpp | 28 +- src/ContainerContext.hpp | 18 +- src/ContainerExtractor.cpp | 71 ++-- src/ContainerExtractor.hpp | 10 +- src/DataStream.cpp | 42 +-- src/DataStream.hpp | 13 +- src/Database.hpp | 21 +- src/Enums/Color.hpp | 35 +- src/Enums/ComponentType.hpp | 61 ++-- src/Enums/DirectoryType.hpp | 13 +- src/Enums/FillStyle.hpp | 17 +- src/Enums/HatchStyle.hpp | 27 +- src/Enums/ImplementationType.hpp | 15 +- src/Enums/LineStyle.hpp | 15 +- src/Enums/LineWidth.hpp | 19 +- src/Enums/PortType.hpp | 15 +- src/Enums/Primitive.hpp | 15 +- src/Enums/Rotation.hpp | 15 +- src/Enums/StreamType.hpp | 13 +- src/Enums/Structure.hpp | 125 ++++--- src/Exception.hpp | 43 ++- src/FutureData.hpp | 94 +++-- src/General.hpp | 75 ++-- src/GenericParser.cpp | 145 +++----- src/GenericParser.hpp | 15 +- src/GetStreamHelper.hpp | 24 +- src/Misc.cpp | 13 +- src/PageSettings.cpp | 3 +- src/PageSettings.hpp | 54 +-- src/PinShape.hpp | 46 +-- src/Primitives/Point.cpp | 1 - src/Primitives/Point.hpp | 21 +- src/Primitives/PrimArc.cpp | 13 +- src/Primitives/PrimArc.hpp | 31 +- src/Primitives/PrimBase.hpp | 12 +- src/Primitives/PrimBezier.cpp | 14 +- src/Primitives/PrimBezier.hpp | 23 +- src/Primitives/PrimBitmap.cpp | 30 +- src/Primitives/PrimBitmap.hpp | 29 +- src/Primitives/PrimCommentText.cpp | 18 +- src/Primitives/PrimCommentText.hpp | 27 +- src/Primitives/PrimEllipse.cpp | 17 +- src/Primitives/PrimEllipse.hpp | 39 +- src/Primitives/PrimLine.cpp | 13 +- src/Primitives/PrimLine.hpp | 25 +- src/Primitives/PrimPolygon.cpp | 6 +- src/Primitives/PrimPolygon.hpp | 27 +- src/Primitives/PrimPolyline.cpp | 10 +- src/Primitives/PrimPolyline.hpp | 24 +- src/Primitives/PrimRect.cpp | 6 +- src/Primitives/PrimRect.hpp | 29 +- src/Primitives/PrimSymbolVector.cpp | 18 +- src/Primitives/PrimSymbolVector.hpp | 26 +- src/Record.hpp | 29 +- src/RecordFactory.cpp | 224 ++++++++---- src/RecordFactory.hpp | 3 - src/Stream.hpp | 17 +- src/StreamContext.hpp | 20 +- src/StreamFactory.cpp | 34 +- src/StreamFactory.hpp | 3 - src/Streams/StreamAdminData.cpp | 5 +- src/Streams/StreamAdminData.hpp | 19 +- src/Streams/StreamBOMDataStream.cpp | 4 +- src/Streams/StreamBOMDataStream.hpp | 19 +- src/Streams/StreamCache.cpp | 39 +- src/Streams/StreamCache.hpp | 19 +- src/Streams/StreamDTypeD.cpp | 3 +- src/Streams/StreamDTypeD.hpp | 40 +-- src/Streams/StreamDirectoryStruct.cpp | 14 +- src/Streams/StreamDirectoryStruct.hpp | 86 ++--- src/Streams/StreamDsnStream.cpp | 1 - src/Streams/StreamDsnStream.hpp | 21 +- src/Streams/StreamERC.cpp | 1 - src/Streams/StreamERC.hpp | 20 +- src/Streams/StreamHSObjects.cpp | 1 - src/Streams/StreamHSObjects.hpp | 19 +- src/Streams/StreamHierarchy.cpp | 5 +- src/Streams/StreamHierarchy.hpp | 35 +- src/Streams/StreamLibrary.cpp | 5 +- src/Streams/StreamLibrary.hpp | 30 +- src/Streams/StreamNetBundleMapData.cpp | 5 +- src/Streams/StreamNetBundleMapData.hpp | 19 +- src/Streams/StreamPackage.cpp | 1 - src/Streams/StreamPackage.hpp | 29 +- src/Streams/StreamPage.cpp | 3 +- src/Streams/StreamPage.hpp | 59 ++-- src/Streams/StreamSchematic.cpp | 1 - src/Streams/StreamSchematic.hpp | 19 +- src/Streams/StreamSymbol.cpp | 1 - src/Streams/StreamSymbol.hpp | 23 +- src/Structures/StructAlias.cpp | 1 - src/Structures/StructAlias.hpp | 31 +- src/Structures/StructBookMarkSymbolInst.cpp | 1 - src/Structures/StructBookMarkSymbolInst.hpp | 19 +- src/Structures/StructBusEntry.cpp | 1 - src/Structures/StructBusEntry.hpp | 35 +- src/Structures/StructDevice.cpp | 9 +- src/Structures/StructDevice.hpp | 31 +- src/Structures/StructERCObject.cpp | 1 - src/Structures/StructERCObject.hpp | 22 +- src/Structures/StructERCSymbol.cpp | 1 - src/Structures/StructERCSymbol.hpp | 20 +- src/Structures/StructGeneralProperties.cpp | 10 +- src/Structures/StructGeneralProperties.hpp | 29 +- src/Structures/StructGlobal.cpp | 1 - src/Structures/StructGlobal.hpp | 19 +- src/Structures/StructGlobalSymbol.cpp | 1 - src/Structures/StructGlobalSymbol.hpp | 24 +- src/Structures/StructGraphicArcInst.cpp | 1 - src/Structures/StructGraphicArcInst.hpp | 19 +- src/Structures/StructGraphicBezierInst.cpp | 1 - src/Structures/StructGraphicBezierInst.hpp | 19 +- src/Structures/StructGraphicBitMapInst.cpp | 1 - src/Structures/StructGraphicBitMapInst.hpp | 19 +- src/Structures/StructGraphicBoxInst.cpp | 1 - src/Structures/StructGraphicBoxInst.hpp | 19 +- .../StructGraphicCommentTextInst.cpp | 1 - .../StructGraphicCommentTextInst.hpp | 19 +- src/Structures/StructGraphicEllipseInst.cpp | 1 - src/Structures/StructGraphicEllipseInst.hpp | 19 +- src/Structures/StructGraphicInst.cpp | 7 +- src/Structures/StructGraphicInst.hpp | 32 +- src/Structures/StructGraphicLineInst.cpp | 1 - src/Structures/StructGraphicLineInst.hpp | 19 +- src/Structures/StructGraphicOleEmbedInst.cpp | 1 - src/Structures/StructGraphicOleEmbedInst.hpp | 19 +- src/Structures/StructGraphicPolygonInst.cpp | 1 - src/Structures/StructGraphicPolygonInst.hpp | 19 +- src/Structures/StructGraphicPolylineInst.cpp | 1 - src/Structures/StructGraphicPolylineInst.hpp | 19 +- src/Structures/StructLibraryPart.cpp | 3 +- src/Structures/StructLibraryPart.hpp | 28 +- src/Structures/StructNetDbIdMapping.cpp | 1 - src/Structures/StructNetDbIdMapping.hpp | 20 +- src/Structures/StructOffPageConnector.cpp | 1 - src/Structures/StructOffPageConnector.hpp | 19 +- src/Structures/StructOffPageSymbol.cpp | 1 - src/Structures/StructOffPageSymbol.hpp | 24 +- src/Structures/StructPackage.cpp | 1 - src/Structures/StructPackage.hpp | 22 +- src/Structures/StructPartCell.cpp | 12 +- src/Structures/StructPartCell.hpp | 23 +- src/Structures/StructPinShapeSymbol.cpp | 1 - src/Structures/StructPinShapeSymbol.hpp | 24 +- src/Structures/StructPlacedInstance.cpp | 1 - src/Structures/StructPlacedInstance.hpp | 24 +- src/Structures/StructPort.cpp | 1 - src/Structures/StructPort.hpp | 19 +- src/Structures/StructPortSymbol.cpp | 1 - src/Structures/StructPortSymbol.hpp | 19 +- src/Structures/StructSomeHierarchyBase.hpp | 19 +- src/Structures/StructSthInHierarchy1.cpp | 1 - src/Structures/StructSthInHierarchy1.hpp | 20 +- src/Structures/StructSthInHierarchy2.cpp | 1 - src/Structures/StructSthInHierarchy2.hpp | 20 +- src/Structures/StructSthInHierarchy3.cpp | 1 - src/Structures/StructSthInHierarchy3.hpp | 19 +- src/Structures/StructSthInPages0.cpp | 2 - src/Structures/StructSthInPages0.hpp | 26 +- src/Structures/StructSymbol.hpp | 19 +- src/Structures/StructSymbolBBox.cpp | 1 - src/Structures/StructSymbolBBox.hpp | 23 +- src/Structures/StructSymbolDisplayProp.cpp | 9 +- src/Structures/StructSymbolDisplayProp.hpp | 25 +- src/Structures/StructSymbolPin.cpp | 3 - src/Structures/StructSymbolPin.hpp | 28 +- src/Structures/StructSymbolPinBus.hpp | 10 +- src/Structures/StructSymbolPinScalar.hpp | 10 +- src/Structures/StructT0x10.cpp | 1 - src/Structures/StructT0x10.hpp | 20 +- src/Structures/StructT0x34.cpp | 1 - src/Structures/StructT0x34.hpp | 28 +- src/Structures/StructT0x35.cpp | 4 +- src/Structures/StructT0x35.hpp | 28 +- src/Structures/StructT0x45.cpp | 1 - src/Structures/StructT0x45.hpp | 19 +- src/Structures/StructT0x5b.cpp | 1 - src/Structures/StructT0x5b.hpp | 19 +- src/Structures/StructTitleBlock.cpp | 1 - src/Structures/StructTitleBlock.hpp | 19 +- src/Structures/StructTitleBlockSymbol.cpp | 5 +- src/Structures/StructTitleBlockSymbol.hpp | 24 +- src/Structures/StructWire.cpp | 1 - src/Structures/StructWire.hpp | 42 +-- src/Structures/StructWireBus.hpp | 10 +- src/Structures/StructWireScalar.hpp | 10 +- src/VisitorPattern.hpp | 163 +++++---- src/Win32/LOGFONTA.hpp | 32 +- src/XmlExporter.cpp | 42 +-- src/XmlExporter.hpp | 333 ++++++++++++++---- src/main.cpp | 80 +++-- 194 files changed, 1984 insertions(+), 2397 deletions(-) diff --git a/src/CfbfStreamLocation.hpp b/src/CfbfStreamLocation.hpp index 83c9db61..e4e6d1c8 100644 --- a/src/CfbfStreamLocation.hpp +++ b/src/CfbfStreamLocation.hpp @@ -1,7 +1,6 @@ #ifndef CFBFSTREAMLOCATION_HPP #define CFBFSTREAMLOCATION_HPP - #include #include #include @@ -12,15 +11,12 @@ #include "General.hpp" - namespace fs = std::filesystem; - class CfbfStreamLocation { public: - CfbfStreamLocation( - const fs::path& aStreamPath, const fs::path& aExtractedCfbfPath) + CfbfStreamLocation(const fs::path& aStreamPath, const fs::path& aExtractedCfbfPath) { std::vector streamLocation{}; @@ -65,7 +61,7 @@ class CfbfStreamLocation * Check if the CfbfStreamLocation matches the given pattern. Note * that the vector size needs to be equal and all given string parts * need to match. As a wildcard part, you can use std::nullopt - */ + */ bool matches_pattern(const std::vector>& aPattern) { if(get_vector().size() != aPattern.size()) @@ -93,13 +89,10 @@ class CfbfStreamLocation } private: - std::vector mStreamLocation{}; }; - -[[maybe_unused]] -static std::string to_string(const CfbfStreamLocation& aLocation) +[[maybe_unused]] static std::string to_string(const CfbfStreamLocation& aLocation) { std::string locStr{}; for(const auto& locPart : aLocation.get_vector()) @@ -110,23 +103,19 @@ static std::string to_string(const CfbfStreamLocation& aLocation) return locStr; } -[[maybe_unused]] -static bool operator==(const CfbfStreamLocation& aLhs, const std::vector& aRhs) +[[maybe_unused]] static bool operator==(const CfbfStreamLocation& aLhs, const std::vector& aRhs) { return aLhs.get_vector() == aRhs; } -[[maybe_unused]] -static bool operator==(const std::vector& aLhs, const CfbfStreamLocation& aRhs) +[[maybe_unused]] static bool operator==(const std::vector& aLhs, const CfbfStreamLocation& aRhs) { return aRhs == aLhs; } -[[maybe_unused]] -static bool operator==(const CfbfStreamLocation& aLhs, const CfbfStreamLocation& aRhs) +[[maybe_unused]] static bool operator==(const CfbfStreamLocation& aLhs, const CfbfStreamLocation& aRhs) { return aLhs.get_vector() == aRhs.get_vector(); } - #endif // CFBFSTREAMLOCATION_HPP \ No newline at end of file diff --git a/src/Container.cpp b/src/Container.cpp index 970397f2..ec29528c 100644 --- a/src/Container.cpp +++ b/src/Container.cpp @@ -36,12 +36,14 @@ #include "Stream.hpp" #include "StreamFactory.hpp" - namespace fs = std::filesystem; - -Container::Container(const fs::path& aCfbfContainer, ParserConfig aCfg) : - mDb{}, mFileCtr{0U}, mFileErrCtr{0U}, mCtx{aCfbfContainer, "", aCfg, mDb}, mCfg{aCfg} +Container::Container(const fs::path& aCfbfContainer, ParserConfig aCfg) + : mDb{}, + mFileCtr{0U}, + mFileErrCtr{0U}, + mCtx{aCfbfContainer, "", aCfg, mDb}, + mCfg{aCfg} { // Extract to a unique folder in case two similar named files // are extracted at the same time. E.g. in parallel execution. @@ -51,7 +53,7 @@ Container::Container(const fs::path& aCfbfContainer, ParserConfig aCfg) : const std::string uuid = fmt::format("{:08x}{:08x}{:08x}{:08x}", gen(), gen(), gen(), gen()); const fs::path extractTo = fs::temp_directory_path() / "OpenOrCadParser" / uuid; - mCtx.mExtractedCfbfPath = extractContainer(aCfbfContainer, extractTo); + mCtx.mExtractedCfbfPath = extractContainer(aCfbfContainer, extractTo); // @todo This is a hack, since mExtractedCfbfPath is not available at construction of the context const fs::path logPath = extractTo / "logs" / "OpenOrCadParser.log"; @@ -61,7 +63,6 @@ Container::Container(const fs::path& aCfbfContainer, ParserConfig aCfg) : mCtx.mLogger.debug(to_string(mCfg)); } - Container::~Container() { if(!mCfg.mKeepTmpFiles) @@ -73,7 +74,6 @@ Container::~Container() } } - void Container::parseDatabaseFileThread(std::deque> aStreamList) { for(auto& stream : aStreamList) @@ -96,10 +96,8 @@ void Container::parseDatabaseFileThread(std::deque> aStr } } - // Equally distribute elements into new lists of pointers to the original elements -void distributeStreamsToThreadJobsForParsing( - std::size_t aNumberParallelJobs, +void distributeStreamsToThreadJobsForParsing(std::size_t aNumberParallelJobs, const std::vector>& aStreams, //!< Streams to distribute std::deque>& aSequentialJobList, std::vector>>& aParallelJobLists) @@ -138,7 +136,6 @@ void distributeStreamsToThreadJobsForParsing( } } - /** * @brief Parse the whole database file. */ @@ -192,8 +189,8 @@ void Container::parseDatabaseFile() // Print sequential job assignment { - mCtx.mLogger.info("Assigning main thread with the following {}/{} jobs (sequential):", - sequentialJobList.size(), mFileCtr); + mCtx.mLogger.info( + "Assigning main thread with the following {}/{} jobs (sequential):", sequentialJobList.size(), mFileCtr); for(const auto& job : sequentialJobList) { @@ -204,8 +201,8 @@ void Container::parseDatabaseFile() // Print parallel job assignment for(std::size_t i{0U}; i < parallelJobsLists.size(); ++i) { - mCtx.mLogger.info("Assigning thread {} with the following {}/{} jobs (parallel):", - i, parallelJobsLists.at(i).size(), mFileCtr); + mCtx.mLogger.info("Assigning thread {} with the following {}/{} jobs (parallel):", i, + parallelJobsLists.at(i).size(), mFileCtr); const auto& parallelJobList = parallelJobsLists.at(i); @@ -246,15 +243,13 @@ void Container::parseDatabaseFile() std::string errCtrStr = fmt::format("Errors in {}/{} files!", mFileErrCtr, mFileCtr); - errCtrStr = fmt::format((mFileErrCtr == 0u) ? fg(fmt::color::green) : fg(fmt::color::crimson), - errCtrStr); + errCtrStr = fmt::format((mFileErrCtr == 0u) ? fg(fmt::color::green) : fg(fmt::color::crimson), errCtrStr); mCtx.mLogger.info(errCtrStr); // mCtx.mLogger.info(to_string(mLibrary)); } - fs::path Container::extractContainer(const fs::path& aFile, const fs::path& aOutDir) const { ContainerExtractor extractor{aFile}; @@ -264,35 +259,31 @@ fs::path Container::extractContainer(const fs::path& aFile, const fs::path& aOut return extractor.extract(aOutDir); } - fs::path Container::extractContainer(const fs::path& aOutDir) const { return extractContainer(mCtx.mInputCfbfFile, aOutDir); } - void Container::printContainerTree() const { ContainerExtractor extractor{mCtx.mInputCfbfFile}; extractor.printContainerTree(); } - std::optional Container::getDatabaseTypeByFileExtension(const fs::path& aFile) const { std::string extension = aFile.extension().string(); // Ignore case of extension - std::transform(extension.begin(), extension.end(), extension.begin(), - [] (unsigned char c) { return std::toupper(c); }); - - const std::map extensionFileTypeMap = - { - {".DSN", DatabaseType::Design}, - {".DBK", DatabaseType::Design}, // Backup file - {".OLB", DatabaseType::Library}, - {".OBK", DatabaseType::Library} // Backup file - }; + std::transform( + extension.begin(), extension.end(), extension.begin(), [](unsigned char c) { return std::toupper(c); }); + + const std::map extensionFileTypeMap = { + {".DSN", DatabaseType::Design }, + {".DBK", DatabaseType::Design }, // Backup file + {".OLB", DatabaseType::Library}, + {".OBK", DatabaseType::Library} // Backup file + }; if(extensionFileTypeMap.count(extension) == 0U) { diff --git a/src/Container.hpp b/src/Container.hpp index ec5adb91..ea640fde 100644 --- a/src/Container.hpp +++ b/src/Container.hpp @@ -1,7 +1,6 @@ #ifndef CONTAINER_HPP #define CONTAINER_HPP - #include #include #include @@ -12,8 +11,8 @@ #include #include "ContainerContext.hpp" -#include "Database.hpp" #include "DataStream.hpp" +#include "Database.hpp" #include "Enums/Primitive.hpp" #include "Enums/Structure.hpp" #include "FutureData.hpp" @@ -21,16 +20,12 @@ #include "Primitives/PrimBase.hpp" #include "Stream.hpp" - - namespace fs = std::filesystem; - // @todo rename to DatabaseParser class Container { public: - Container(const fs::path& aFile, ParserConfig aCfg); ~Container(); @@ -91,7 +86,6 @@ class Container void parseDatabaseFile(); private: - Database mDb; size_t mFileCtr; //!< Counts all files that were opened for parsing @@ -102,5 +96,4 @@ class Container ParserConfig mCfg; }; - #endif // CONTAINER_HPP \ No newline at end of file diff --git a/src/ContainerContext.cpp b/src/ContainerContext.cpp index 66985c36..ca6d68eb 100644 --- a/src/ContainerContext.cpp +++ b/src/ContainerContext.cpp @@ -14,34 +14,34 @@ // #include "Database.hpp" #include "General.hpp" - class Database; - namespace fs = std::filesystem; - -ContainerContext::ContainerContext(const fs::path& aInputCfbfFile, - const fs::path& aExtractedCfbfPath, ParserConfig aCfg, Database& aDb) : mDb{aDb}, - mLogger{"tmp"} +ContainerContext::ContainerContext( + const fs::path& aInputCfbfFile, const fs::path& aExtractedCfbfPath, ParserConfig aCfg, Database& aDb) + : mDb{aDb}, + mLogger{"tmp"} { - mInputCfbfFile = aInputCfbfFile; + mInputCfbfFile = aInputCfbfFile; mExtractedCfbfPath = aExtractedCfbfPath; - mCfg = aCfg; + mCfg = aCfg; mFileFormatVersion = FileFormatVersion::C; - mLogLevel = spdlog::level::trace; + mLogLevel = spdlog::level::trace; const fs::path logPath = mExtractedCfbfPath / "logs" / "OpenOrCadParser.log"; configureLogger(logPath); } -ContainerContext::ContainerContext(const ContainerContext& aCtx) : mDb{aCtx.mDb}, mLogger{"tmp"} +ContainerContext::ContainerContext(const ContainerContext& aCtx) + : mDb{aCtx.mDb}, + mLogger{"tmp"} { - mInputCfbfFile = aCtx.mInputCfbfFile; + mInputCfbfFile = aCtx.mInputCfbfFile; mExtractedCfbfPath = aCtx.mExtractedCfbfPath; - mCfg = aCtx.mCfg; + mCfg = aCtx.mCfg; mFileFormatVersion = aCtx.mFileFormatVersion; - mLogLevel = aCtx.mLogLevel; + mLogLevel = aCtx.mLogLevel; } void ContainerContext::configureLogger(const fs::path& aLogPath) @@ -52,7 +52,7 @@ void ContainerContext::configureLogger(const fs::path& aLogPath) } auto file_sink = std::make_shared(aLogPath.string()); - mLogger = spdlog::logger{"file logger", {file_sink}}; + mLogger = spdlog::logger{"file logger", {file_sink}}; mLogger.set_pattern("[%^%l%$] %v"); mLogger.set_level(mLogLevel); diff --git a/src/ContainerContext.hpp b/src/ContainerContext.hpp index 989d24d2..dece2c6c 100644 --- a/src/ContainerContext.hpp +++ b/src/ContainerContext.hpp @@ -1,7 +1,6 @@ #ifndef CONTAINERCONTEXT_HPP #define CONTAINERCONTEXT_HPP - #include #include #include @@ -16,16 +15,14 @@ // #include "Database.hpp" #include "General.hpp" - class Database; - namespace fs = std::filesystem; - struct ParserConfig { - std::size_t mThreadCount{std::thread::hardware_concurrency()}; //!< Number of threads used for parsing streams in parallel + std::size_t mThreadCount{ + std::thread::hardware_concurrency()}; //!< Number of threads used for parsing streams in parallel bool mSkipUnknownPrim{true}; //!< Unknown primitives should be skipped during parsing bool mSkipInvalidPrim{true}; //!< Invalid primitives should be skipped during parsing @@ -36,9 +33,7 @@ struct ParserConfig bool mKeepTmpFiles{true}; //!< Do not delete temporary files after parser completed }; - -[[maybe_unused]] -static std::string to_string(const ParserConfig& aCfg) +[[maybe_unused]] static std::string to_string(const ParserConfig& aCfg) { std::string str; str += fmt::format("mSkipUnknownPrim = {}\n", aCfg.mSkipUnknownPrim); @@ -50,13 +45,11 @@ static std::string to_string(const ParserConfig& aCfg) return str; } - class ContainerContext { public: - - ContainerContext(const fs::path& aInputCfbfFile, - const fs::path& aExtractedCfbfPath, ParserConfig aCfg, Database& aDb); + ContainerContext( + const fs::path& aInputCfbfFile, const fs::path& aExtractedCfbfPath, ParserConfig aCfg, Database& aDb); ContainerContext(const ContainerContext& aCtx); @@ -75,5 +68,4 @@ class ContainerContext spdlog::logger mLogger; }; - #endif // CONTAINERCONTEXT_HPP \ No newline at end of file diff --git a/src/ContainerExtractor.cpp b/src/ContainerExtractor.cpp index 35676291..12c616d8 100644 --- a/src/ContainerExtractor.cpp +++ b/src/ContainerExtractor.cpp @@ -16,10 +16,8 @@ #include "ContainerExtractor.hpp" - namespace fs = std::filesystem; - ContainerExtractor::ContainerExtractor(const fs::path& aContainer) { mContainer = aContainer; @@ -42,7 +40,7 @@ ContainerExtractor::ContainerExtractor(const fs::path& aContainer) } const size_t len = fs::file_size(mContainer); - mBuffer = std::make_unique(len); + mBuffer = std::make_unique(len); mBufferLen = std::fread(mBuffer.get(), 1, len, fp); std::fclose(fp); @@ -52,35 +50,33 @@ ContainerExtractor::ContainerExtractor(const fs::path& aContainer) // mReader->GetFileInfo(); } - void ContainerExtractor::outputFileInfo() const { const CFB::COMPOUND_FILE_HDR* hdr = mReader->GetFileInfo(); - std::clog - << "file version: " << hdr->majorVersion << "." << hdr->minorVersion << std::endl - << "difat sector: " << hdr->numDIFATSector << std::endl - << "directory sector: " << hdr->numDirectorySector << std::endl - << "fat sector: " << hdr->numFATSector << std::endl - << "mini fat sector: " << hdr->numMiniFATSector << std::endl; + std::clog << "file version: " << hdr->majorVersion << "." << hdr->minorVersion << std::endl + << "difat sector: " << hdr->numDIFATSector << std::endl + << "directory sector: " << hdr->numDirectorySector << std::endl + << "fat sector: " << hdr->numFATSector << std::endl + << "mini fat sector: " << hdr->numMiniFATSector << std::endl; } - void ContainerExtractor::outputEntryInfo(const CFB::COMPOUND_FILE_ENTRY* aEntry) const { - std::clog - << "entry type: " << (mReader->IsPropertyStream(aEntry) ? "property" : (mReader->IsStream(aEntry) ? "stream" : "directory")) << std::endl - << "color flag: " << aEntry->colorFlag << std::endl - << "creation time: " << aEntry->creationTime << std::endl - << "modified time: " << aEntry->modifiedTime << std::endl - << "child ID: " << aEntry->childID << std::endl - << "left sibling ID: " << aEntry->leftSiblingID << std::endl - << "right sibling ID: " << aEntry->startSectorLocation << aEntry->rightSiblingID << std::endl - << "start sector: " << aEntry->startSectorLocation << std::endl - << "size: " << aEntry->size << std::endl; + std::clog << "entry type: " + << (mReader->IsPropertyStream(aEntry) ? "property" : (mReader->IsStream(aEntry) ? "stream" : "directory")) + << std::endl + << "color flag: " << aEntry->colorFlag << std::endl + << "creation time: " << aEntry->creationTime << std::endl + << "modified time: " << aEntry->modifiedTime << std::endl + << "child ID: " << aEntry->childID << std::endl + << "left sibling ID: " << aEntry->leftSiblingID << std::endl + << "right sibling ID: " << aEntry->startSectorLocation << aEntry->rightSiblingID << std::endl + << "start sector: " << aEntry->startSectorLocation << std::endl + << "size: " << aEntry->size << std::endl; } - -std::vector ContainerExtractor::getSiblings(const CFB::COMPOUND_FILE_ENTRY* aChild) const +std::vector ContainerExtractor::getSiblings( + const CFB::COMPOUND_FILE_ENTRY* aChild) const { std::vector siblings; @@ -102,7 +98,6 @@ std::vector ContainerExtractor::getSiblings(con return siblings; } - const CFB::COMPOUND_FILE_ENTRY* ContainerExtractor::getParent(const CFB::COMPOUND_FILE_ENTRY* aChild) const { if(aChild == mReader->GetRootEntry() || aChild == nullptr) @@ -119,7 +114,8 @@ const CFB::COMPOUND_FILE_ENTRY* ContainerExtractor::getParent(const CFB::COMPOUN { const auto& siblings = getSiblings(mReader->GetEntry(entry->childID)); - if(std::any_of(siblings.begin(), siblings.end(), [&](const CFB::COMPOUND_FILE_ENTRY* sibling){ return aChild == sibling; })) + if(std::any_of(siblings.begin(), siblings.end(), + [&](const CFB::COMPOUND_FILE_ENTRY* sibling) { return aChild == sibling; })) { parent = entry; } @@ -129,7 +125,6 @@ const CFB::COMPOUND_FILE_ENTRY* ContainerExtractor::getParent(const CFB::COMPOUN return parent; } - void ContainerExtractor::printContainerTree() const { mReader->EnumFiles(mReader->GetRootEntry(), -1, @@ -156,11 +151,9 @@ void ContainerExtractor::printContainerTree() const } spdlog::info("{} {} ({} Byte)", prefix, UTF16ToUTF8(entry->name), entry->size); - } - ); + }); } - std::string ContainerExtractor::getInternalPath(const CFB::COMPOUND_FILE_ENTRY* aEntry) const { if(aEntry == nullptr) @@ -169,7 +162,7 @@ std::string ContainerExtractor::getInternalPath(const CFB::COMPOUND_FILE_ENTRY* } const CFB::COMPOUND_FILE_ENTRY* currEntry = aEntry; - std::string internalPath = UTF16ToUTF8(currEntry->name); + std::string internalPath = UTF16ToUTF8(currEntry->name); while(currEntry != nullptr) { @@ -186,7 +179,6 @@ std::string ContainerExtractor::getInternalPath(const CFB::COMPOUND_FILE_ENTRY* return internalPath; } - fs::path ContainerExtractor::extract(const fs::path& aOutputDir) { const fs::path baseOutputDir = aOutputDir / mContainer.filename(); @@ -203,12 +195,10 @@ fs::path ContainerExtractor::extract(const fs::path& aOutputDir) const fs::path internalPath{getInternalPath(entry)}; const size_t contentSize = static_cast(entry->size); //!< Data size in byte - const size_t maxSize = 16777216u; //!< equals 2^24 = 16 MiB + const size_t maxSize = 16777216u; //!< equals 2^24 = 16 MiB const auto isDirectory = [&, this](const CFB::COMPOUND_FILE_ENTRY* entry) - { - return !mReader->IsStream(entry) && !mReader->IsPropertyStream(entry); - }; + { return !mReader->IsStream(entry) && !mReader->IsPropertyStream(entry); }; if(!isDirectory(entry)) { @@ -216,11 +206,11 @@ fs::path ContainerExtractor::extract(const fs::path& aOutputDir) if(contentSize > maxSize) { - // @todo OrCAD is able to read those files. Maybe the filesize is corrupted but OrCAD just parses them - // and stops when it thinks that the stream ended. But maybe there is some different information - // hidden in the size value? + // @todo OrCAD is able to read those files. Maybe the filesize is corrupted but OrCAD just parses + // them and stops when it thinks that the stream ended. But maybe there is some different + // information hidden in the size value? spdlog::error("Stream {} has size of {} Byte which is too large." - " Skipping stream! The original container might be corrupted!", + " Skipping stream! The original container might be corrupted!", internalPath.string(), contentSize); return; @@ -243,7 +233,7 @@ fs::path ContainerExtractor::extract(const fs::path& aOutputDir) if(contentSize > 0u) { spdlog::error("Directory {} has size of {} Byte but should be 0 Byte!" - " Creating the directory anyway but the original container might be corrupted!", + " Creating the directory anyway but the original container might be corrupted!", internalPath.string(), contentSize); return; @@ -257,7 +247,6 @@ fs::path ContainerExtractor::extract(const fs::path& aOutputDir) return baseOutputDir; } - void ContainerExtractor::dumpBuffer(const fs::path& aPath, const void* aBuffer, size_t aLen) { FILE* fp = std::fopen(aPath.string().c_str(), "wb"); diff --git a/src/ContainerExtractor.hpp b/src/ContainerExtractor.hpp index 01dac077..04a955bc 100644 --- a/src/ContainerExtractor.hpp +++ b/src/ContainerExtractor.hpp @@ -1,7 +1,6 @@ #ifndef CONTAINEREXTRACTOR_HPP #define CONTAINEREXTRACTOR_HPP - #include #include #include @@ -12,15 +11,12 @@ #include #endif // COMPOUNDFILEREADER_H - namespace fs = std::filesystem; - class ContainerExtractor { public: - ContainerExtractor() = delete; ContainerExtractor(const fs::path& aContainer); @@ -67,7 +63,6 @@ class ContainerExtractor */ std::string getInternalPath(const CFB::COMPOUND_FILE_ENTRY* aEntry) const; - /** * @brief Extract CFBF container. * @@ -76,7 +71,6 @@ class ContainerExtractor */ fs::path extract(const fs::path& aOutputDir); - /** * @brief Get path of container. * @@ -88,7 +82,6 @@ class ContainerExtractor } private: - /** * @brief Write buffer to file. * @@ -101,8 +94,7 @@ class ContainerExtractor fs::path mContainer; //!< Path to the container file std::unique_ptr mReader; std::unique_ptr mBuffer; //!< Contains the content of the container - size_t mBufferLen; //!< Container length + size_t mBufferLen; //!< Container length }; - #endif // CONTAINEREXTRACTOR_HPP \ No newline at end of file diff --git a/src/DataStream.cpp b/src/DataStream.cpp index 1c4766cd..d2aaff29 100644 --- a/src/DataStream.cpp +++ b/src/DataStream.cpp @@ -1,6 +1,6 @@ #include -#include #include +#include #include #include @@ -10,13 +10,11 @@ #include "General.hpp" #include "StreamContext.hpp" - void DataStream::discardBytes(size_t aLen) { seekg(aLen, std::ios_base::cur); } - std::vector DataStream::readBytes(size_t aLen) { std::vector data; @@ -30,7 +28,6 @@ std::vector DataStream::readBytes(size_t aLen) return data; } - std::string DataStream::readStringZeroTerm() { std::string str; @@ -57,7 +54,8 @@ std::string DataStream::readStringZeroTerm() if(str.length() == max_chars) { const std::string msg = fmt::format("Loop canceled because the string is unexpectedly large.\n" - "More than {} characters! The following string was read until now:\n{}", max_chars, str); + "More than {} characters! The following string was read until now:\n{}", + max_chars, str); mCtx.mLogger.error(msg); @@ -69,7 +67,6 @@ std::string DataStream::readStringZeroTerm() return str; } - std::string DataStream::readStringLenTerm() { const uint16_t len = readUint16(); @@ -101,8 +98,8 @@ std::string DataStream::readStringLenTerm() // stable because strings can actually be very long. if(str.length() == max_chars) { - const std::string msg = "Loop cancled because the string is unexpectedly large. More than " - + std::to_string(max_chars) + " characters!"; + const std::string msg = "Loop cancled because the string is unexpectedly large. More than " + + std::to_string(max_chars) + " characters!"; mCtx.mLogger.error(msg); @@ -114,7 +111,6 @@ std::string DataStream::readStringLenTerm() return str; } - std::string DataStream::readStringLenZeroTerm() { const uint16_t len = readUint16(); @@ -123,9 +119,8 @@ std::string DataStream::readStringLenZeroTerm() if(str.length() != len) { - const std::string msg = "Zero terminated string length (" + std::to_string(str.length()) - + ") does not match the preceding length (" - + std::to_string(len) + ") definition!"; + const std::string msg = "Zero terminated string length (" + std::to_string(str.length()) + + ") does not match the preceding length (" + std::to_string(len) + ") definition!"; mCtx.mLogger.error(msg); @@ -137,7 +132,6 @@ std::string DataStream::readStringLenZeroTerm() return str; } - void DataStream::printUnknownData(size_t aLen, const std::string& aComment) { const auto data = readBytes(aLen); @@ -149,7 +143,6 @@ void DataStream::printUnknownData(size_t aLen, const std::string& aComment) } } - void DataStream::padRest(size_t aStartOffset, size_t aBlockSize, bool aPadIsZero) { const size_t currOffset = getCurrentOffset(); @@ -157,9 +150,8 @@ void DataStream::padRest(size_t aStartOffset, size_t aBlockSize, bool aPadIsZero if(offsetDiff > aBlockSize) { - const std::string msg = "Already parsed " + std::to_string(offsetDiff) - + " bytes but should have only been " - + std::to_string(aBlockSize) + "!"; + const std::string msg = "Already parsed " + std::to_string(offsetDiff) + " bytes but should have only been " + + std::to_string(aBlockSize) + "!"; mCtx.mLogger.debug(msg); @@ -191,19 +183,16 @@ void DataStream::padRest(size_t aStartOffset, size_t aBlockSize, bool aPadIsZero } } - std::string DataStream::getCurrentOffsetStrMsg() { return fmt::format("Offset at 0x{:08x}", getCurrentOffset()); } - void DataStream::printData(const std::vector& aData) { mCtx.mLogger.info(dataToStr(aData)); } - std::string DataStream::dataToStr(const std::vector& aData) { const unsigned int line_width = 16u; @@ -240,7 +229,7 @@ std::string DataStream::dataToStr(const std::vector& aData) for(size_t i = 0u; i < line_width - (aData.size() % line_width); ++i) { line_hex += " " + hex_spacing; // 2 spaces for 1 byte - line_str += " " + str_spacing; // 1 character for 1 byte + line_str += " " + str_spacing; // 1 character for 1 byte } output += preamble + line_hex + " | " + line_str + '\n'; @@ -255,23 +244,18 @@ std::string DataStream::dataToStr(const std::vector& aData) return output; } - void DataStream::assumeData(const std::vector& aExpectedData, const std::string& aComment) { const std::vector data = readBytes(aExpectedData.size()); size_t ctr = 0u; - const auto checkByte = [&ctr, &aExpectedData](uint8_t byte) - { - return byte == aExpectedData[ctr++]; - }; + const auto checkByte = [&ctr, &aExpectedData](uint8_t byte) { return byte == aExpectedData[ctr++]; }; if(!std::all_of(data.cbegin(), data.cend(), checkByte)) { - const std::string msg = "Assumption failed: " + aComment + '\n' - + "Expected:\n" + dataToStr(aExpectedData) + - + "but got:\n" + dataToStr(data); + const std::string msg = "Assumption failed: " + aComment + '\n' + "Expected:\n" + dataToStr(aExpectedData) + + +"but got:\n" + dataToStr(data); mCtx.mLogger.debug(msg); diff --git a/src/DataStream.hpp b/src/DataStream.hpp index 42e67290..7a0bd0f4 100644 --- a/src/DataStream.hpp +++ b/src/DataStream.hpp @@ -1,7 +1,6 @@ #ifndef DATASTREAM_HPP #define DATASTREAM_HPP - #include #include #include @@ -17,24 +16,23 @@ #include "Enums/Structure.hpp" #include "General.hpp" - class FutureDataLst; class Record; class StreamContext; - namespace fs = std::filesystem; - class DataStream : public std::ifstream { public: - // DataStream() : std::ifstream{} // { } - DataStream(const fs::path& aFile, StreamContext& aCtx) : std::ifstream{aFile, std::ifstream::binary}, mCtx{aCtx} - { } + DataStream(const fs::path& aFile, StreamContext& aCtx) + : std::ifstream{aFile, std::ifstream::binary}, + mCtx{aCtx} + { + } // Checks whether the stream has reached the end of the file. // I.e. reading another Byte would result in an error. @@ -219,5 +217,4 @@ class DataStream : public std::ifstream StreamContext& mCtx; }; - #endif // DATASTREAM_HPP \ No newline at end of file diff --git a/src/Database.hpp b/src/Database.hpp index 4dbc278e..14c230b2 100644 --- a/src/Database.hpp +++ b/src/Database.hpp @@ -1,7 +1,6 @@ #ifndef DATABASE_HPP #define DATABASE_HPP - #include #include #include @@ -16,16 +15,17 @@ #include "Enums/StreamType.hpp" #include "Stream.hpp" - class Database { public: - - Database() : mStreams{} - { } + Database() + : mStreams{} + { + } ~Database() - { } + { + } // void accept(Visitor& aVisitor) const override // { @@ -36,9 +36,7 @@ class Database std::vector> mStreams; }; - -[[maybe_unused]] -static std::string to_string(const Database& aObj) +[[maybe_unused]] static std::string to_string(const Database& aObj) { std::string str; @@ -52,14 +50,11 @@ static std::string to_string(const Database& aObj) return str; } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const Database& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const Database& aVal) { aOs << to_string(aVal); return aOs; } - #endif // DATABASE_HPP \ No newline at end of file diff --git a/src/Enums/Color.hpp b/src/Enums/Color.hpp index 5c908758..19d6f89c 100644 --- a/src/Enums/Color.hpp +++ b/src/Enums/Color.hpp @@ -1,7 +1,6 @@ #ifndef COLOR_HPP #define COLOR_HPP - #include #include #include @@ -10,19 +9,18 @@ #include "General.hpp" - enum class Color { - VeryLightRed = 0, // Color code: #ff8080 - VeryLightYellow = 1, // Color code: #ffff80 - VeryLightLimeGreen = 2, // Color code: #80ff80 - Cyan2 = 3, // Color code: #00ff80 - VeryLightCyan = 4, // Color code: #80ffff - Blue2 = 5, // Color code: #0080ff - VeryLightPink = 6, // Color code: #ff80c0 - VeryLightMagenta = 7, // Color code: #ff80ff - Red = 8, // Color code: #ff0000 - Yellow = 9, // Color code: #ffff00 + VeryLightRed = 0, // Color code: #ff8080 + VeryLightYellow = 1, // Color code: #ffff80 + VeryLightLimeGreen = 2, // Color code: #80ff80 + Cyan2 = 3, // Color code: #00ff80 + VeryLightCyan = 4, // Color code: #80ffff + Blue2 = 5, // Color code: #0080ff + VeryLightPink = 6, // Color code: #ff80c0 + VeryLightMagenta = 7, // Color code: #ff80ff + Red = 8, // Color code: #ff0000 + Yellow = 9, // Color code: #ffff00 Green = 10, // Color code: #80ff00 Cyan1 = 11, // Color code: #00ff40 Cyan3 = 12, // Color code: #00ffff @@ -64,27 +62,20 @@ enum class Color Default = 48 }; - -[[maybe_unused]] -static constexpr Color ToColor(uint32_t aVal) +[[maybe_unused]] static constexpr Color ToColor(uint32_t aVal) { return ToEnum(aVal); } - -[[maybe_unused]] -static std::string to_string(const Color& aVal) +[[maybe_unused]] static std::string to_string(const Color& aVal) { return std::string{magic_enum::enum_name(aVal)}; } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const Color& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const Color& aVal) { aOs << to_string(aVal); return aOs; } - #endif // COLOR_HPP \ No newline at end of file diff --git a/src/Enums/ComponentType.hpp b/src/Enums/ComponentType.hpp index 9ec9345a..9ebe767b 100644 --- a/src/Enums/ComponentType.hpp +++ b/src/Enums/ComponentType.hpp @@ -1,7 +1,6 @@ #ifndef COMPONENTTYPE_HPP #define COMPONENTTYPE_HPP - #include #include #include @@ -10,58 +9,55 @@ #include "General.hpp" - // @todo compare to Structure type. Some of the elements are exactly the same. But it // does not seem like we can merge it. Maybe we can split them up into 2 distinct // types? enum class ComponentType { - CT_0 = 0, // @todo Unknown - Graphic = 2, + CT_0 = 0, // @todo Unknown + Graphic = 2, - Cell = 6, + Cell = 6, - View = 9, - CT_10 = 10, // @todo Unknown + View = 9, + CT_10 = 10, // @todo Unknown - Part = 24, + Part = 24, - Package = 31, - Device = 32, // @todo verify this - GlobalSymbol = 33, - PortSymbol = 34, - OffPageSymbol = 35, + Package = 31, + Device = 32, // @todo verify this + GlobalSymbol = 33, + PortSymbol = 34, + OffPageSymbol = 35, TitleBlockSymbol = 64, - ERCSymbol = 75, - BookMarkSymbol = 76, + ERCSymbol = 75, + BookMarkSymbol = 76, - PinShapeSymbol = 98, + PinShapeSymbol = 98, // This value is returned by ToComponentType // in case the passed integer is > 100 to // cope with magic_enums limitations and keep // compile times at a reasonable level // https://github.com/Neargye/magic_enum/blob/master/doc/limitations.md - HACKY_VALUE = 100, - - CT_257 = 257, // @todo completly unknown and strange looking - CT_3820 = 3820, // @todo completly unknown and strange looking - CT_4704 = 4704, // @todo completly unknown and strange looking - CT_11904 = 11904, // @todo completly unknown and strange looking - CT_17486 = 17486, // @todo completly unknown and strange looking - CT_24941 = 24941, // @todo completly unknown and strange looking - CT_29795 = 29795, // @todo completly unknown and strange looking + HACKY_VALUE = 100, + + CT_257 = 257, // @todo completly unknown and strange looking + CT_3820 = 3820, // @todo completly unknown and strange looking + CT_4704 = 4704, // @todo completly unknown and strange looking + CT_11904 = 11904, // @todo completly unknown and strange looking + CT_17486 = 17486, // @todo completly unknown and strange looking + CT_24941 = 24941, // @todo completly unknown and strange looking + CT_29795 = 29795, // @todo completly unknown and strange looking // @todo when this weird types occur also the timezone in directory files is really strange // but not in the XML....? Is this field corrupted? Or somehow coded? But why code // it only sometimes and not always? I think the same values fo the Type also appears // too often to be a realistic corruption issue but I need to confirm this. }; - -[[maybe_unused]] -static constexpr ComponentType ToComponentType(uint16_t aVal) +[[maybe_unused]] static constexpr ComponentType ToComponentType(uint16_t aVal) { // See the explanation at HACKY_VALUE for this hack if(aVal > 100U) @@ -72,20 +68,15 @@ static constexpr ComponentType ToComponentType(uint16_t aVal) return ToEnum(aVal); } - -[[maybe_unused]] -static std::string to_string(const ComponentType& aVal) +[[maybe_unused]] static std::string to_string(const ComponentType& aVal) { return std::string{magic_enum::enum_name(aVal)}; } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const ComponentType& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const ComponentType& aVal) { aOs << to_string(aVal); return aOs; } - #endif // COMPONENTTYPE_HPP \ No newline at end of file diff --git a/src/Enums/DirectoryType.hpp b/src/Enums/DirectoryType.hpp index d58d7ba7..3cc8ab67 100644 --- a/src/Enums/DirectoryType.hpp +++ b/src/Enums/DirectoryType.hpp @@ -1,7 +1,6 @@ #ifndef DIRECTORYTYPE_HPP #define DIRECTORYTYPE_HPP - #include #include #include @@ -10,7 +9,6 @@ #include "General.hpp" - enum class DirectoryType { CellsDirectory, @@ -22,9 +20,7 @@ enum class DirectoryType ViewsDirectory }; - -[[maybe_unused]] -static std::string to_string(const DirectoryType& aVal) +[[maybe_unused]] static std::string to_string(const DirectoryType& aVal) { switch(aVal) { @@ -54,15 +50,10 @@ static std::string to_string(const DirectoryType& aVal) } } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const DirectoryType& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const DirectoryType& aVal) { aOs << to_string(aVal); return aOs; } - #endif // DIRECTORYTYPE_HPP - - diff --git a/src/Enums/FillStyle.hpp b/src/Enums/FillStyle.hpp index 54c5ea17..69bdd601 100644 --- a/src/Enums/FillStyle.hpp +++ b/src/Enums/FillStyle.hpp @@ -1,7 +1,6 @@ #ifndef FILLSTYLE_HPP #define FILLSTYLE_HPP - #include #include #include @@ -10,7 +9,6 @@ #include "General.hpp" - // This configuration dominates the hatch_style. // I.e. when solid/none is set, the hatch_style // value is ignored. @@ -18,30 +16,23 @@ enum class FillStyle { Solid = 0, None = 1, - HatchPattern = 2 // Refer to HatchStyle + HatchPattern = 2 // Refer to HatchStyle }; - -[[maybe_unused]] -static constexpr FillStyle ToFillStyle(uint32_t aVal) +[[maybe_unused]] static constexpr FillStyle ToFillStyle(uint32_t aVal) { return ToEnum(aVal); } - -[[maybe_unused]] -static std::string to_string(const FillStyle& aVal) +[[maybe_unused]] static std::string to_string(const FillStyle& aVal) { return std::string{magic_enum::enum_name(aVal)}; } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const FillStyle& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const FillStyle& aVal) { aOs << to_string(aVal); return aOs; } - #endif // FILLSTYLE_HPP \ No newline at end of file diff --git a/src/Enums/HatchStyle.hpp b/src/Enums/HatchStyle.hpp index 86b0f976..2e621a8e 100644 --- a/src/Enums/HatchStyle.hpp +++ b/src/Enums/HatchStyle.hpp @@ -1,7 +1,6 @@ #ifndef HATCHSTYLE_HPP #define HATCHSTYLE_HPP - #include #include #include @@ -10,41 +9,33 @@ #include "General.hpp" - enum class HatchStyle { // @todo NotValid is probably a new value in later OrCad versions. I think // previous versions just ignore the value set here but it could be any value NotValid = -1, // When FillStyle != HatchPattern @todo could also mean Solid! Verify this - LinesHorizontal = 0, // - - LinesVertical = 1, // | - DiagonalLeft = 2, // \' - DiagonalRight = 3, // / - Checkerboard = 4, // + - Mesh = 5 // x + LinesHorizontal = 0, // - + LinesVertical = 1, // | + DiagonalLeft = 2, // \' + DiagonalRight = 3, // / + Checkerboard = 4, // + + Mesh = 5 // x }; - -[[maybe_unused]] -static constexpr HatchStyle ToHatchStyle(int32_t aVal) +[[maybe_unused]] static constexpr HatchStyle ToHatchStyle(int32_t aVal) { return ToEnum(aVal); } - -[[maybe_unused]] -static std::string to_string(const HatchStyle& aVal) +[[maybe_unused]] static std::string to_string(const HatchStyle& aVal) { return std::string{magic_enum::enum_name(aVal)}; } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const HatchStyle& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const HatchStyle& aVal) { aOs << to_string(aVal); return aOs; } - #endif // HATCHSTYLE_HPP \ No newline at end of file diff --git a/src/Enums/ImplementationType.hpp b/src/Enums/ImplementationType.hpp index 97895bee..38a580c9 100644 --- a/src/Enums/ImplementationType.hpp +++ b/src/Enums/ImplementationType.hpp @@ -1,7 +1,6 @@ #ifndef IMPLEMENTATIONTYPE_HPP #define IMPLEMENTATIONTYPE_HPP - #include #include #include @@ -10,7 +9,6 @@ #include "General.hpp" - enum class ImplementationType { None = 0, @@ -23,27 +21,20 @@ enum class ImplementationType Verilog = 7 }; - -[[maybe_unused]] -static constexpr ImplementationType ToImplementationType(uint8_t aVal) +[[maybe_unused]] static constexpr ImplementationType ToImplementationType(uint8_t aVal) { return ToEnum(aVal); } - -[[maybe_unused]] -static std::string to_string(const ImplementationType& aVal) +[[maybe_unused]] static std::string to_string(const ImplementationType& aVal) { return std::string{magic_enum::enum_name(aVal)}; } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const ImplementationType& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const ImplementationType& aVal) { aOs << to_string(aVal); return aOs; } - #endif // IMPLEMENTATIONTYPE_HPP \ No newline at end of file diff --git a/src/Enums/LineStyle.hpp b/src/Enums/LineStyle.hpp index 689c98b8..18106219 100644 --- a/src/Enums/LineStyle.hpp +++ b/src/Enums/LineStyle.hpp @@ -1,7 +1,6 @@ #ifndef LINESTYLE_HPP #define LINESTYLE_HPP - #include #include #include @@ -10,7 +9,6 @@ #include "General.hpp" - enum class LineStyle { Solid = 0, // ______ @@ -21,27 +19,20 @@ enum class LineStyle Default = 5 }; - -[[maybe_unused]] -static constexpr LineStyle ToLineStyle(uint32_t aVal) +[[maybe_unused]] static constexpr LineStyle ToLineStyle(uint32_t aVal) { return ToEnum(aVal); } - -[[maybe_unused]] -static std::string to_string(const LineStyle& aVal) +[[maybe_unused]] static std::string to_string(const LineStyle& aVal) { return std::string{magic_enum::enum_name(aVal)}; } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const LineStyle& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const LineStyle& aVal) { aOs << to_string(aVal); return aOs; } - #endif // LINESTYLE_HPP \ No newline at end of file diff --git a/src/Enums/LineWidth.hpp b/src/Enums/LineWidth.hpp index 87b665b3..5b3900b6 100644 --- a/src/Enums/LineWidth.hpp +++ b/src/Enums/LineWidth.hpp @@ -1,7 +1,6 @@ #ifndef LINEWIDTH_HPP #define LINEWIDTH_HPP - #include #include #include @@ -10,37 +9,29 @@ #include "General.hpp" - enum class LineWidth { Thin = 0, Medium = 1, Wide = 2, - Default = 3 // Results in a thickness between - // Thin and Medium + Default = 3 // Results in a thickness between + // Thin and Medium }; - -[[maybe_unused]] -static constexpr LineWidth ToLineWidth(uint32_t aVal) +[[maybe_unused]] static constexpr LineWidth ToLineWidth(uint32_t aVal) { return ToEnum(aVal); } - -[[maybe_unused]] -static std::string to_string(const LineWidth& aVal) +[[maybe_unused]] static std::string to_string(const LineWidth& aVal) { return std::string{magic_enum::enum_name(aVal)}; } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const LineWidth& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const LineWidth& aVal) { aOs << to_string(aVal); return aOs; } - #endif // LINEWIDTH_HPP \ No newline at end of file diff --git a/src/Enums/PortType.hpp b/src/Enums/PortType.hpp index 156fbece..ba0503c7 100644 --- a/src/Enums/PortType.hpp +++ b/src/Enums/PortType.hpp @@ -1,7 +1,6 @@ #ifndef PORTTYPE_HPP #define PORTTYPE_HPP - #include #include #include @@ -10,7 +9,6 @@ #include "General.hpp" - enum class PortType { Input = 0, @@ -23,27 +21,20 @@ enum class PortType Power = 7 }; - -[[maybe_unused]] -static constexpr PortType ToPortType(uint32_t aVal) +[[maybe_unused]] static constexpr PortType ToPortType(uint32_t aVal) { return ToEnum(aVal); } - -[[maybe_unused]] -static std::string to_string(const PortType& aVal) +[[maybe_unused]] static std::string to_string(const PortType& aVal) { return std::string{magic_enum::enum_name(aVal)}; } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const PortType& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const PortType& aVal) { aOs << to_string(aVal); return aOs; } - #endif // PORTTYPE_HPP \ No newline at end of file diff --git a/src/Enums/Primitive.hpp b/src/Enums/Primitive.hpp index d099452d..1513fb05 100644 --- a/src/Enums/Primitive.hpp +++ b/src/Enums/Primitive.hpp @@ -1,7 +1,6 @@ #ifndef PRIMITIVE_HPP #define PRIMITIVE_HPP - #include #include #include @@ -10,7 +9,6 @@ #include "General.hpp" - enum class Primitive { Rect = 40, @@ -25,27 +23,20 @@ enum class Primitive Bezier = 87 }; - -[[maybe_unused]] -static constexpr Primitive ToPrimitive(uint8_t aVal) +[[maybe_unused]] static constexpr Primitive ToPrimitive(uint8_t aVal) { return ToEnum(aVal); } - -[[maybe_unused]] -static std::string to_string(const Primitive& aVal) +[[maybe_unused]] static std::string to_string(const Primitive& aVal) { return std::string{magic_enum::enum_name(aVal)}; } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const Primitive& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const Primitive& aVal) { aOs << to_string(aVal); return aOs; } - #endif // PRIMITIVE_HPP \ No newline at end of file diff --git a/src/Enums/Rotation.hpp b/src/Enums/Rotation.hpp index 6fcc3384..e98aef3e 100644 --- a/src/Enums/Rotation.hpp +++ b/src/Enums/Rotation.hpp @@ -1,7 +1,6 @@ #ifndef ROTATION_HPP #define ROTATION_HPP - #include #include #include @@ -10,7 +9,6 @@ #include "General.hpp" - enum class Rotation { Deg_0 = 0, @@ -19,27 +17,20 @@ enum class Rotation Deg_270 = 3 }; - -[[maybe_unused]] -static constexpr Rotation ToRotation(uint8_t aVal) +[[maybe_unused]] static constexpr Rotation ToRotation(uint8_t aVal) { return ToEnum(aVal); } - -[[maybe_unused]] -static std::string to_string(const Rotation& aVal) +[[maybe_unused]] static std::string to_string(const Rotation& aVal) { return std::string{magic_enum::enum_name(aVal)}; } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const Rotation& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const Rotation& aVal) { aOs << to_string(aVal); return aOs; } - #endif // ROTATION_HPP \ No newline at end of file diff --git a/src/Enums/StreamType.hpp b/src/Enums/StreamType.hpp index 5d7e5503..3754b8cd 100644 --- a/src/Enums/StreamType.hpp +++ b/src/Enums/StreamType.hpp @@ -1,7 +1,6 @@ #ifndef STREAMTYPE_HPP #define STREAMTYPE_HPP - #include #include #include @@ -10,7 +9,6 @@ #include "General.hpp" - // @todo Incomplete list enum class StreamType { @@ -41,22 +39,15 @@ enum class StreamType ViewsDirectory }; - -[[maybe_unused]] -static std::string to_string(const StreamType& aVal) +[[maybe_unused]] static std::string to_string(const StreamType& aVal) { return std::string{magic_enum::enum_name(aVal)}; } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StreamType& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StreamType& aVal) { aOs << to_string(aVal); return aOs; } - #endif // STREAMTYPE_HPP - - diff --git a/src/Enums/Structure.hpp b/src/Enums/Structure.hpp index 49a61208..bff98927 100644 --- a/src/Enums/Structure.hpp +++ b/src/Enums/Structure.hpp @@ -1,7 +1,6 @@ #ifndef STRUCTURE_HPP #define STRUCTURE_HPP - #include #include #include @@ -10,106 +9,104 @@ #include "General.hpp" - // @todo there are a few consecutive items missing enum class Structure { - SthInPages0 = 2, // @todo Should be name something like Instance as it is used by all .*Inst structures and instiates the actual object. Could also be a Graphic struct, see ComponentType as it occurs in Graphics Directory. + SthInPages0 = + 2, // @todo Should be name something like Instance as it is used by all .*Inst structures and instiates the + // actual object. Could also be a Graphic struct, see ComponentType as it occurs in Graphics Directory. - DsnStream = 4, //!< Used in the 'DsnStream' stream //@todo figure out real name and rename it + DsnStream = 4, //!< Used in the 'DsnStream' stream //@todo figure out real name and rename it - PartCell = 6, + PartCell = 6, - SchLib = 9, //!< Used in the 'Schematic' stream //@todo figure out real name and rename it - Page = 10, // @todo Probably Page in schematic - PartInstance = 11, - DrawnInstance = 12, - PlacedInstance = 13, + SchLib = 9, //!< Used in the 'Schematic' stream //@todo figure out real name and rename it + Page = 10, // @todo Probably Page in schematic + PartInstance = 11, + DrawnInstance = 12, + PlacedInstance = 13, - T0x10 = 16, // @todo Is this probably DrawnInst? Place a part in the schematic and this will also appear. Or rather PinInst + T0x10 = 16, // @todo Is this probably DrawnInst? Place a part in the schematic and this will also appear. Or rather + // PinInst - WireScalar = 20, - WireBus = 21, + WireScalar = 20, + WireBus = 21, - Port = 23, //!< Hierarchical port in schematic - LibraryPart = 24, + Port = 23, //!< Hierarchical port in schematic + LibraryPart = 24, - SymbolPinScalar = 26, - SymbolPinBus = 27, + SymbolPinScalar = 26, + SymbolPinBus = 27, - BusEntry = 29, + BusEntry = 29, - Package = 31, - Device = 32, - GlobalSymbol = 33, //!< Power symbol in library - PortSymbol = 34, //!< Hierarchical port symbol in library - OffPageSymbol = 35, //!< Off-page connector symbol in library + Package = 31, + Device = 32, + GlobalSymbol = 33, //!< Power symbol in library + PortSymbol = 34, //!< Hierarchical port symbol in library + OffPageSymbol = 35, //!< Off-page connector symbol in library - Global = 37, //!< Power symbol instance in schematic - OffPageConnector = 38, //!< Off-page connector instance in schematic - SymbolDisplayProp = 39, + Global = 37, //!< Power symbol instance in schematic + OffPageConnector = 38, //!< Off-page connector instance in schematic + SymbolDisplayProp = 39, - SymbolVector = 48, - Alias = 49, //!< Net alias + SymbolVector = 48, + Alias = 49, //!< Net alias - T0x34 = 52, // @todo rename - T0x35 = 53, // @todo rename + T0x34 = 52, // @todo rename + T0x35 = 53, // @todo rename - GraphicBoxInst = 55, - GraphicLineInst = 56, - GraphicArcInst = 57, - GraphicEllipseInst = 58, - GraphicPolygonInst = 59, // @todo Needs verification. I was not able to create one in the GUI but it would make sense to have it here - GraphicPolylineInst = 60, - GraphicCommentTextInst = 61, - GraphicBitMapInst = 62, + GraphicBoxInst = 55, + GraphicLineInst = 56, + GraphicArcInst = 57, + GraphicEllipseInst = 58, + GraphicPolygonInst = + 59, // @todo Needs verification. I was not able to create one in the GUI but it would make sense to have it here + GraphicPolylineInst = 60, + GraphicCommentTextInst = 61, + GraphicBitMapInst = 62, - TitleBlockSymbol = 64, //!< Title block symbol in the library - TitleBlock = 65, //!< Title block instance in the schematic // @todo Not sure at all. This definetly needs verification. Then probably suffix with `Inst`? + TitleBlockSymbol = 64, //!< Title block symbol in the library + TitleBlock = 65, //!< Title block instance in the schematic // @todo Not sure at all. This definetly needs + //!< verification. Then probably suffix with `Inst`? - SthInHierarchy1 = 66, // @todo - NetDbIdMapping = 67, - SthInHierarchy2 = 68, // @todo - T0x45 = 69, // @todo + SthInHierarchy1 = 66, // @todo + NetDbIdMapping = 67, + SthInHierarchy2 = 68, // @todo + T0x45 = 69, // @todo - ERCSymbol = 75, //!< ERC symbol in the library - BookMarkSymbol = 76, //!< Book mark symbol in the library - ERCObject = 77, //!< ERC marker instance in the schematic - BookMarkSymbolInst = 78, //!< Book mark instance in the schematic + ERCSymbol = 75, //!< ERC symbol in the library + BookMarkSymbol = 76, //!< Book mark symbol in the library + ERCObject = 77, //!< ERC marker instance in the schematic + BookMarkSymbolInst = 78, //!< Book mark instance in the schematic - SthInHierarchy3 = 82, // @todo + SthInHierarchy3 = 82, // @todo - GraphicBezierInst = 88, - GraphicOleEmbedInst = 89, //!< Embedds a file into the schematic, see https://en.wikipedia.org/wiki/Object_Linking_and_Embedding + GraphicBezierInst = 88, + GraphicOleEmbedInst = + 89, //!< Embedds a file into the schematic, see https://en.wikipedia.org/wiki/Object_Linking_and_Embedding - T0x5b = 91, + T0x5b = 91, - PinShapeSymbol = 98, + PinShapeSymbol = 98, - NetGroup = 103 //!< Specifies which wires/busses belong to a given net group + NetGroup = 103 //!< Specifies which wires/busses belong to a given net group }; - -[[maybe_unused]] -static constexpr Structure ToStructure(uint8_t aVal) +[[maybe_unused]] static constexpr Structure ToStructure(uint8_t aVal) { return ToEnum(aVal); } - -[[maybe_unused]] -static std::string to_string(const Structure& aVal) +[[maybe_unused]] static std::string to_string(const Structure& aVal) { return std::string{magic_enum::enum_name(aVal)}; } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const Structure& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const Structure& aVal) { aOs << to_string(aVal); return aOs; } - #endif // STRUCTURE_HPP \ No newline at end of file diff --git a/src/Exception.hpp b/src/Exception.hpp index f27b033e..25271cc4 100644 --- a/src/Exception.hpp +++ b/src/Exception.hpp @@ -1,7 +1,6 @@ #ifndef EXCEPTION_HPP #define EXCEPTION_HPP - #include #include @@ -11,45 +10,43 @@ #include "General.hpp" - // Forward declaration enum class FileFormatVersion; - -template -struct InvalidEnumEntry : public std::invalid_argument +template struct InvalidEnumEntry : public std::invalid_argument { - InvalidEnumEntry(TVal aVal) : - std::invalid_argument(fmt::format("Enum `{}` does not implement value {}!", nameof::nameof_type(), aVal)) - { } + InvalidEnumEntry(TVal aVal) + : std::invalid_argument(fmt::format("Enum `{}` does not implement value {}!", nameof::nameof_type(), aVal)) + { + } }; - // @todo pass file format version of our current file and display it in the error message! struct FileFormatChanged : public std::runtime_error { - FileFormatChanged(const std::string& aStructName) : - std::runtime_error((aStructName + " structure changed (differs between file format versions)!")) - { } + FileFormatChanged(const std::string& aStructName) + : std::runtime_error((aStructName + " structure changed (differs between file format versions)!")) + { + } }; - struct MisinterpretedData : public std::runtime_error { - MisinterpretedData(const std::string& aStructName, size_t aStartOffset, size_t aExpectedByteLen, size_t aCurrOffset) : - std::runtime_error(fmt::format("{} data size check failed. 0x{:08x} (start offset) + 0x{:08x} (expected Byte length) != 0x{:08x} (current offset)", - aStructName, aStartOffset, aExpectedByteLen, aCurrOffset)) - { } + MisinterpretedData(const std::string& aStructName, size_t aStartOffset, size_t aExpectedByteLen, size_t aCurrOffset) + : std::runtime_error(fmt::format("{} data size check failed. 0x{:08x} (start offset) + 0x{:08x} (expected Byte " + "length) != 0x{:08x} (current offset)", + aStructName, aStartOffset, aExpectedByteLen, aCurrOffset)) + { + } }; - struct MissingFileFormatCheck : public std::runtime_error { - MissingFileFormatCheck(const std::string& aFunctionName, size_t aLine, FileFormatVersion aVersion) : - std::runtime_error(fmt::format("{} in line {} is missing a file format check for version {}", - aFunctionName, aLine, static_cast(aVersion))) - { } + MissingFileFormatCheck(const std::string& aFunctionName, size_t aLine, FileFormatVersion aVersion) + : std::runtime_error(fmt::format("{} in line {} is missing a file format check for version {}", aFunctionName, + aLine, static_cast(aVersion))) + { + } }; - #endif // EXCEPTION_HPP \ No newline at end of file diff --git a/src/FutureData.hpp b/src/FutureData.hpp index 83cd32e0..20da2845 100644 --- a/src/FutureData.hpp +++ b/src/FutureData.hpp @@ -14,12 +14,13 @@ #include "General.hpp" #include "StreamContext.hpp" - class FutureData { public: - - FutureData(std::size_t aPreambleOffset, std::size_t aSize) : mAbsStartOffset{0U}, mAbsStopOffset{0U}, mParsed{false} + FutureData(std::size_t aPreambleOffset, std::size_t aSize) + : mAbsStartOffset{0U}, + mAbsStopOffset{0U}, + mParsed{false} { const size_t PREAMBLE_STRIDE = 9U; //!< Stride from one preamble to the next one in byte @@ -59,28 +60,27 @@ class FutureData } private: - std::size_t mAbsStartOffset; //!< Absolute offset from the beginning of the file where the data starts - std::size_t mAbsStopOffset; //!< Absolute offset from the beginning of the file where the data ends + std::size_t mAbsStopOffset; //!< Absolute offset from the beginning of the file where the data ends bool mParsed; //!< Set if the specified range has been parsed }; - - class FutureDataLst : public std::vector { public: - - FutureDataLst(StreamContext& aCtx) : std::vector{}, mCtx{aCtx} - { } + FutureDataLst(StreamContext& aCtx) + : std::vector{}, + mCtx{aCtx} + { + } std::optional getByStartOffset(std::size_t aAbsStartOffset) const { mCtx.get().mLogger.debug("Searching for StartOffset 0x{:08x}", aAbsStartOffset); - const auto cmp = [&aAbsStartOffset] (FutureData aFutureData) -> bool - { return aFutureData.getStartOffset() == aAbsStartOffset; }; + const auto cmp = [&aAbsStartOffset](FutureData aFutureData) -> bool + { return aFutureData.getStartOffset() == aAbsStartOffset; }; const auto res = std::find_if(this->begin(), this->end(), cmp); @@ -96,8 +96,8 @@ class FutureDataLst : public std::vector { mCtx.get().mLogger.debug("Searching for StopOffset 0x{:08x}", aAbsStopOffset); - const auto cmp = [&aAbsStopOffset] (FutureData aFutureData) -> bool - { return aFutureData.getStopOffset() == aAbsStopOffset; }; + const auto cmp = [&aAbsStopOffset](FutureData aFutureData) -> bool + { return aFutureData.getStopOffset() == aAbsStopOffset; }; const auto res = std::find_if(this->begin(), this->end(), cmp); @@ -111,8 +111,8 @@ class FutureDataLst : public std::vector bool removeByStartOffset(std::size_t aAbsStartOffset) { - const auto cmp = [&aAbsStartOffset] (FutureData aFutureData) -> bool - { return aFutureData.getStartOffset() == aAbsStartOffset; }; + const auto cmp = [&aAbsStartOffset](FutureData aFutureData) -> bool + { return aFutureData.getStartOffset() == aAbsStartOffset; }; const auto res = std::find_if(this->begin(), this->end(), cmp); @@ -127,8 +127,8 @@ class FutureDataLst : public std::vector bool removeByStopOffset(std::size_t aAbsStopOffset) { - const auto cmp = [&aAbsStopOffset] (FutureData aFutureData) -> bool - { return aFutureData.getStopOffset() == aAbsStopOffset; }; + const auto cmp = [&aAbsStopOffset](FutureData aFutureData) -> bool + { return aFutureData.getStopOffset() == aAbsStopOffset; }; const auto res = std::find_if(this->begin(), this->end(), cmp); @@ -145,8 +145,8 @@ class FutureDataLst : public std::vector { const size_t currOffset = mCtx.get().mDs.getCurrentOffset(); - const auto cmp = [&currOffset] (FutureData aFutureData) -> bool - { return aFutureData.getStopOffset() == currOffset; }; + const auto cmp = [&currOffset](FutureData aFutureData) -> bool + { return aFutureData.getStopOffset() == currOffset; }; auto res = std::find_if(this->begin(), this->end(), cmp); @@ -156,8 +156,8 @@ class FutureDataLst : public std::vector if(futureData.getParsed()) { - const std::string msg = fmt::format("{}: Checkpoint position at 0x{:08x} is duplicated", - getMethodName(this, __func__), currOffset); + const std::string msg = fmt::format( + "{}: Checkpoint position at 0x{:08x} is duplicated", getMethodName(this, __func__), currOffset); mCtx.get().mLogger.error(msg); throw std::runtime_error(msg); @@ -166,23 +166,23 @@ class FutureDataLst : public std::vector { futureData.setParsed(true); - mCtx.get().mLogger.debug("{}: Checkpoint at 0x{:08x} was successful", - getMethodName(this, __func__), currOffset); + mCtx.get().mLogger.debug( + "{}: Checkpoint at 0x{:08x} was successful", getMethodName(this, __func__), currOffset); } } else { if(!empty()) { - const std::string msg = fmt::format("{}: Checkpoint position at 0x{:08x} is incorrect", - getMethodName(this, __func__), currOffset); + const std::string msg = fmt::format( + "{}: Checkpoint position at 0x{:08x} is incorrect", getMethodName(this, __func__), currOffset); mCtx.get().mLogger.error(msg); throw std::runtime_error(msg); } - mCtx.get().mLogger.trace("{}: Checkpoint at 0x{:08x} was not found", - getMethodName(this, __func__), currOffset); + mCtx.get().mLogger.trace( + "{}: Checkpoint at 0x{:08x} was not found", getMethodName(this, __func__), currOffset); } } @@ -197,15 +197,14 @@ class FutureDataLst : public std::vector checkpoint_missing = true; mCtx.get().mLogger.debug("{}: Checkpoint missing for 0x{:08x} -> 0x{:08x}", - getMethodName(this, __func__), - data.getStartOffset(), data.getStopOffset()); + getMethodName(this, __func__), data.getStartOffset(), data.getStopOffset()); } } if(checkpoint_missing) { - const std::string msg = fmt::format("{}: Check your code for missing checkpoints!\n{}", - getMethodName(this, __func__), string()); + const std::string msg = fmt::format( + "{}: Check your code for missing checkpoints!\n{}", getMethodName(this, __func__), string()); mCtx.get().mLogger.debug(msg); throw std::runtime_error(msg); @@ -214,8 +213,7 @@ class FutureDataLst : public std::vector std::string string() const { - std::string txt{fmt::format("Future Data List with {} Element{}:", - size(), size() > 1U ? "s" : "")}; + std::string txt{fmt::format("Future Data List with {} Element{}:", size(), size() > 1U ? "s" : "")}; for(const auto& e : *this) { @@ -231,9 +229,8 @@ class FutureDataLst : public std::vector const size_t curPos = ds.getCurrentOffset(); - const auto pred = [&curPos] (const FutureData aFutureData) -> bool { - return curPos < aFutureData.getStopOffset(); - }; + const auto pred = [&curPos](const FutureData aFutureData) -> bool + { return curPos < aFutureData.getStopOffset(); }; const auto res = std::find_if(this->crbegin(), this->crend(), pred); @@ -251,9 +248,8 @@ class FutureDataLst : public std::vector const size_t curPos = ds.getCurrentOffset(); - const auto pred = [&curPos] (const FutureData aFutureData) -> bool { - return curPos < aFutureData.getStopOffset(); - }; + const auto pred = [&curPos](const FutureData aFutureData) -> bool + { return curPos < aFutureData.getStopOffset(); }; auto res = std::find_if(this->rbegin(), this->rend(), pred); @@ -262,7 +258,7 @@ class FutureDataLst : public std::vector size_t byteDiff = res->getStopOffset() - curPos; ds.printUnknownData(byteDiff, fmt::format("{}: Reading rest of future data ({} Byte) - {}", - getMethodName(this, __func__), byteDiff, aComment)); + getMethodName(this, __func__), byteDiff, aComment)); } else { @@ -295,9 +291,10 @@ class FutureDataLst : public std::vector if(byteDiff > 0) { - const std::string msg = fmt::format("{}: Your structure implementation is too small." - " Expected it to end at 0x{:08x} but ended at 0x{:08x}. Too small by {} Byte.", - getMethodName(this, __func__), endPos, curPos, std::abs(byteDiff)); + const std::string msg = + fmt::format("{}: Your structure implementation is too small." + " Expected it to end at 0x{:08x} but ended at 0x{:08x}. Too small by {} Byte.", + getMethodName(this, __func__), endPos, curPos, std::abs(byteDiff)); mCtx.get().mDs.printUnknownData(byteDiff, msg); } @@ -310,9 +307,10 @@ class FutureDataLst : public std::vector // parser fails. With the current method the // structure as a whole would be skipped - const std::string msg = fmt::format("{}: Your structure implementation is too large." - " Expected it to end at 0x{:08x} but ended at 0x{:08x}. Too large by {} Byte.", - getMethodName(this, __func__), endPos, curPos, std::abs(byteDiff)); + const std::string msg = + fmt::format("{}: Your structure implementation is too large." + " Expected it to end at 0x{:08x} but ended at 0x{:08x}. Too large by {} Byte.", + getMethodName(this, __func__), endPos, curPos, std::abs(byteDiff)); mCtx.get().mLogger.debug(msg); throw std::runtime_error(msg); @@ -320,9 +318,7 @@ class FutureDataLst : public std::vector } private: - std::reference_wrapper mCtx; - }; #endif // FUTUREDATA_HPP \ No newline at end of file diff --git a/src/General.hpp b/src/General.hpp index f0cd52b2..c885e325 100644 --- a/src/General.hpp +++ b/src/General.hpp @@ -1,7 +1,6 @@ #ifndef GENERAL_HPP #define GENERAL_HPP - #include #include #include @@ -17,14 +16,11 @@ #include "Exception.hpp" - namespace fs = std::filesystem; - enum class DatabaseType; enum class FileFormatVersion; - /** * @brief Version of the file format. * @warning This is not an official version but was introduced @@ -52,19 +48,16 @@ enum class FileFormatVersion Unknown, }; - enum class DatabaseType { Design, Library }; - // Copied from StackExchange [1] and slightly modified // to throw on invalid cast and pass nullptrs through // [1] https://codereview.stackexchange.com/a/280784 -template -static std::unique_ptr dynamic_pointer_cast(std::unique_ptr&& p) +template static std::unique_ptr dynamic_pointer_cast(std::unique_ptr&& p) { // Do not try to cast nullptr if(!p) @@ -72,50 +65,42 @@ static std::unique_ptr dynamic_pointer_cast(std::unique_ptr&& p) return {}; } - if (T* const converted = dynamic_cast(p.get())) { + if(T* const converted = dynamic_cast(p.get())) + { // cast succeeded; clear input p.release(); return std::unique_ptr{converted}; } - throw std::runtime_error{fmt::format("{} is not of type {}", - NAMEOF_FULL_TYPE_RTTI(*p.get()), - nameof::nameof_type())}; + throw std::runtime_error{ + fmt::format("{} is not of type {}", NAMEOF_FULL_TYPE_RTTI(*p.get()), nameof::nameof_type())}; } - -template -static std::string getMethodName(const T* aClass, const char* aFuncName) +template static std::string getMethodName(const T* aClass, const char* aFuncName) { return fmt::format("{}::{}", NAMEOF_TYPE_RTTI(*aClass), aFuncName); } - -[[maybe_unused]] -static std::string getOpeningMsg(const std::string& aClassFuncName, size_t aCurrOffset) +[[maybe_unused]] static std::string getOpeningMsg(const std::string& aClassFuncName, size_t aCurrOffset) { return fmt::format("0x{:08x}: Beginning {}", aCurrOffset, aClassFuncName); } - -[[maybe_unused]] -static std::string getClosingMsg(const std::string& aClassFuncName, size_t aCurrOffset) +[[maybe_unused]] static std::string getClosingMsg(const std::string& aClassFuncName, size_t aCurrOffset) { return fmt::format("0x{:08x}: Ending {}", aCurrOffset, aClassFuncName); } - -[[maybe_unused]] -static std::string indent(std::string str, size_t level) +[[maybe_unused]] static std::string indent(std::string str, size_t level) { - const std::string indent = " "; + const std::string indent = " "; const std::string delimiter = fmt::format("\n"); std::vector lines; size_t pos = 0; std::string token; - while ((pos = str.find(delimiter)) != std::string::npos) + while((pos = str.find(delimiter)) != std::string::npos) { token = str.substr(0, pos); lines.push_back(fmt::format("{}\n", std::move(token))); @@ -137,14 +122,11 @@ static std::string indent(std::string str, size_t level) return indentedStr; } - -[[maybe_unused]] -static std::string indent(size_t level) +[[maybe_unused]] static std::string indent(size_t level) { return indent("", level); } - [[maybe_unused]] static uint8_t GetBit(size_t bitPos, uint32_t val) { if(bitPos >= sizeof(val) * 8u) @@ -155,33 +137,28 @@ static std::string indent(size_t level) return (val >> bitPos) & 0x01; } - -[[maybe_unused]] -static std::string DateTimeToStr(const time_t& unixts) +[[maybe_unused]] static std::string DateTimeToStr(const time_t& unixts) { return std::string(std::ctime(&unixts)); } - // @todo not implemented yet -[[maybe_unused]] -static std::string TimezoneToStr(int16_t timezone) +[[maybe_unused]] static std::string TimezoneToStr(int16_t timezone) { -// std::time_t rawtime; -// std::tm* timeInfo; + // std::time_t rawtime; + // std::tm* timeInfo; -// const size_t lenBuffer = 24u; -// char buffer[lenBuffer]; + // const size_t lenBuffer = 24u; + // char buffer[lenBuffer]; -// std::time(&rawtime); -// timeInfo = std::localtime(&rawtime); + // std::time(&rawtime); + // timeInfo = std::localtime(&rawtime); -// std::strftime(buffer, lenBuffer, "%z %Z", timeInfo); + // std::strftime(buffer, lenBuffer, "%z %Z", timeInfo); - return std::to_string(timezone); + return std::to_string(timezone); } - /** * @brief Convert fix point coordinate to floating point. * @note OrCAD stores all coorinates as fixed point value @@ -190,15 +167,12 @@ static std::string TimezoneToStr(int16_t timezone) * @param point Fix point coordiante. * @return double Floating point coordinate. */ -[[maybe_unused]] -static double ToFP(int16_t point) +[[maybe_unused]] static double ToFP(int16_t point) { return static_cast(point) / 100.0; } - -template -static constexpr TEnum ToEnum(TVal aVal) +template static constexpr TEnum ToEnum(TVal aVal) { const auto enumEntry = magic_enum::enum_cast(aVal); @@ -210,5 +184,4 @@ static constexpr TEnum ToEnum(TVal aVal) return enumEntry.value(); } - #endif // GENERAL_HPP \ No newline at end of file diff --git a/src/GenericParser.cpp b/src/GenericParser.cpp index 29f7755f..8c1a16c3 100644 --- a/src/GenericParser.cpp +++ b/src/GenericParser.cpp @@ -22,10 +22,9 @@ // class StreamLibrary; - void GenericParser::discard_until_preamble() { - const int patternSize = 4; + const int patternSize = 4; std::array buffer = {0}; const size_t startOffset = mCtx.mDs.getCurrentOffset(); @@ -48,8 +47,7 @@ void GenericParser::discard_until_preamble() if(mCtx.mDs.isEoF()) { - const std::string msg = fmt::format("{}: Unexpectedly reached end-of-file!", - getMethodName(this, __func__)); + const std::string msg = fmt::format("{}: Unexpectedly reached end-of-file!", getMethodName(this, __func__)); mCtx.mLogger.debug(msg); throw std::runtime_error(msg); @@ -62,17 +60,15 @@ void GenericParser::discard_until_preamble() mCtx.mDs.putback(preamble[preamble.size() - 1 - i]); } - const size_t endOffset = mCtx.mDs.getCurrentOffset(); + const size_t endOffset = mCtx.mDs.getCurrentOffset(); const size_t discardedByte = endOffset - startOffset; - mCtx.mLogger.debug("{}: Discarded {} Byte until next preamble", - getMethodName(this, __func__), discardedByte); + mCtx.mLogger.debug("{}: Discarded {} Byte until next preamble", getMethodName(this, __func__), discardedByte); mCtx.mDs.setCurrentOffset(startOffset); mCtx.mDs.printUnknownData(discardedByte, "Discarded Bytes"); } - Structure GenericParser::auto_read_prefixes(FutureDataLst& aFutureDataLst) { mCtx.mLogger.debug(getOpeningMsg(getMethodName(this, __func__), mCtx.mDs.getCurrentOffset())); @@ -81,7 +77,7 @@ Structure GenericParser::auto_read_prefixes(FutureDataLst& aFutureDataLst) mCtx.mLogger.set_level(spdlog::level::off); - bool failed = true; + bool failed = true; size_t prefixCtr = 0U; // Count from back to make it easier catching long preambles @@ -130,7 +126,7 @@ Structure GenericParser::auto_read_prefixes(FutureDataLst& aFutureDataLst) if(failed) { const std::string msg = fmt::format("{}: Could not find valid number of prefixes!" - " (maximum is set to {} but could be higher)", + " (maximum is set to {} but could be higher)", getMethodName(this, __func__), maxPrefixes); mCtx.mLogger.debug(msg); @@ -143,8 +139,8 @@ Structure GenericParser::auto_read_prefixes(FutureDataLst& aFutureDataLst) // I.e. figure out the numbers for each structure and move the // parsing code into the structure specific parser. This should // get rid of auto_read_prefixes. - mCtx.mLogger.debug("{}: Found {} prefixes for {}\n", - getMethodName(this, __func__), prefixCtr, ::to_string(structure)); + mCtx.mLogger.debug( + "{}: Found {} prefixes for {}\n", getMethodName(this, __func__), prefixCtr, ::to_string(structure)); mCtx.mLogger.debug(" {}", aFutureDataLst.string()); mCtx.mDs.sanitizeNoEoF(); @@ -154,15 +150,14 @@ Structure GenericParser::auto_read_prefixes(FutureDataLst& aFutureDataLst) return structure; } - Structure GenericParser::auto_read_prefixes(Structure aExpectedStruct, FutureDataLst& aFutureDataLst) { const Structure actualStruct = auto_read_prefixes(aFutureDataLst); if(actualStruct != aExpectedStruct) { - const std::string err = fmt::format("{}: Expected {} but got {}", - getMethodName(this, __func__), ::to_string(aExpectedStruct), ::to_string(actualStruct)); + const std::string err = fmt::format("{}: Expected {} but got {}", getMethodName(this, __func__), + ::to_string(aExpectedStruct), ::to_string(actualStruct)); mCtx.mLogger.debug(err); throw std::runtime_error(err); @@ -171,19 +166,19 @@ Structure GenericParser::auto_read_prefixes(Structure aExpectedStruct, FutureDat return actualStruct; } - -Structure GenericParser::auto_read_prefixes(const std::vector& aExpectedOneOfStruct, FutureDataLst& aFutureDataLst) +Structure GenericParser::auto_read_prefixes( + const std::vector& aExpectedOneOfStruct, FutureDataLst& aFutureDataLst) { const Structure actualStruct = auto_read_prefixes(aFutureDataLst); - const bool foundStructure = std::find(aExpectedOneOfStruct.cbegin(), - aExpectedOneOfStruct.cend(), actualStruct) != aExpectedOneOfStruct.cend(); + const bool foundStructure = std::find(aExpectedOneOfStruct.cbegin(), aExpectedOneOfStruct.cend(), actualStruct) != + aExpectedOneOfStruct.cend(); if(!foundStructure) { std::vector expectedStrStructs{}; - std::transform(aExpectedOneOfStruct.cbegin(), aExpectedOneOfStruct.cend(), - expectedStrStructs.begin(), [](Structure a){ return ::to_string(a); }); + std::transform(aExpectedOneOfStruct.cbegin(), aExpectedOneOfStruct.cend(), expectedStrStructs.begin(), + [](Structure a) { return ::to_string(a); }); const std::string err = fmt::format("{}: Expected one of [{}] but got {}", getMethodName(this, __func__), std::accumulate(expectedStrStructs.cbegin(), expectedStrStructs.cend(), std::string{", "}), @@ -196,7 +191,6 @@ Structure GenericParser::auto_read_prefixes(const std::vector& aExpec return actualStruct; } - // Read number of prefixes, where the last one is a short prefix Structure GenericParser::read_prefixes(size_t aNumber, FutureDataLst& aFutureDataLst) { @@ -204,8 +198,8 @@ Structure GenericParser::read_prefixes(size_t aNumber, FutureDataLst& aFutureDat if(aNumber == 0U) { - throw std::invalid_argument(fmt::format("{}: aNumber = {} but must be > 0!", - getMethodName(this, __func__), aNumber)); + throw std::invalid_argument( + fmt::format("{}: aNumber = {} but must be > 0!", getMethodName(this, __func__), aNumber)); } Structure firstStruct; @@ -219,12 +213,12 @@ Structure GenericParser::read_prefixes(size_t aNumber, FutureDataLst& aFutureDat if(i == aNumber - 1) { const auto currPrefix = read_single_prefix_short(); - currStruct = currPrefix.first; + currStruct = currPrefix.first; } else { - const auto currPrefix = read_single_prefix(); - currStruct = currPrefix.first; + const auto currPrefix = read_single_prefix(); + currStruct = currPrefix.first; const size_t currStructSize = static_cast(currPrefix.second); const FutureData futureData{preambleOffset, currStructSize}; @@ -239,9 +233,8 @@ Structure GenericParser::read_prefixes(size_t aNumber, FutureDataLst& aFutureDat if(currStruct != firstStruct) { - const std::string msg = fmt::format("{}: {} != {}", - getMethodName(this, __func__), ::to_string(currStruct), - ::to_string(firstStruct)); + const std::string msg = fmt::format( + "{}: {} != {}", getMethodName(this, __func__), ::to_string(currStruct), ::to_string(firstStruct)); mCtx.mLogger.debug(msg); throw std::runtime_error(msg); @@ -271,7 +264,6 @@ std::pair GenericParser::read_single_prefix() return std::pair{typeId, byteOffset}; } - std::pair GenericParser::read_single_prefix_short() { mCtx.mLogger.debug(getOpeningMsg(getMethodName(this, __func__), mCtx.mDs.getCurrentOffset())); @@ -285,7 +277,7 @@ std::pair GenericParser::read_single_prefix_short() if(size >= 0) { // @todo This vector needs to be stored in the package, therefore return it to caller - std::vector > nameValueMapping; //!< .first = Name Index, .second = Value Index + std::vector> nameValueMapping; //!< .first = Name Index, .second = Value Index for(int i = 0; i < size; ++i) { @@ -305,14 +297,16 @@ std::pair GenericParser::read_single_prefix_short() // // if(mCtx.mDb.getLibrary().has_value()) // // { - // // const StreamLibrary& lib = dynamic_cast(*mCtx.mDb.getLibrary().value()); + // // const StreamLibrary& lib = + // dynamic_cast(*mCtx.mDb.getLibrary().value()); // // return newIdx >= 0 ? lib.strLst.at(newIdx) : ""; // // } // return ""; // }; - // mCtx.mLogger.debug(" {}: {} <- {}", i, getStr(nameValueMapping.at(i).first), getStr(nameValueMapping.at(i).second)); + // mCtx.mLogger.debug(" {}: {} <- {}", i, getStr(nameValueMapping.at(i).first), + // getStr(nameValueMapping.at(i).second)); // } // catch(const std::exception& e) // { @@ -336,7 +330,6 @@ std::pair GenericParser::read_single_prefix_short() return std::pair{typeId, size}; } - void GenericParser::readPreamble() { mCtx.mLogger.debug(getOpeningMsg(getMethodName(this, __func__), mCtx.mDs.getCurrentOffset())); @@ -351,8 +344,7 @@ void GenericParser::readPreamble() mCtx.mDs.assumeData({0xff, 0xe4, 0x5c, 0x39}, getMethodName(this, __func__) + " Preamble Check Failed"); const uint32_t dataLen = mCtx.mDs.readUint32(); - mCtx.mDs.printUnknownData(dataLen, fmt::format("{}: Trailing preamble data", - getMethodName(this, __func__))); + mCtx.mDs.printUnknownData(dataLen, fmt::format("{}: Trailing preamble data", getMethodName(this, __func__))); // mCtx.mLogger.debug("{}: Found preamble", getMethodName(this, __func__)); } @@ -366,7 +358,6 @@ void GenericParser::readPreamble() mCtx.mLogger.debug(getClosingMsg(getMethodName(this, __func__), mCtx.mDs.getCurrentOffset())); } - Primitive GenericParser::readPrefixPrimitive() { Primitive primitive1 = ToPrimitive(mCtx.mDs.readUint8()); @@ -374,9 +365,8 @@ Primitive GenericParser::readPrefixPrimitive() if(primitive1 != primitive2) { - const std::string msg = fmt::format("{}: Primitives {} != {}", - getMethodName(this, __func__), ::to_string(primitive1), - ::to_string(primitive2)); + const std::string msg = fmt::format( + "{}: Primitives {} != {}", getMethodName(this, __func__), ::to_string(primitive1), ::to_string(primitive2)); mCtx.mLogger.debug(msg); throw std::runtime_error(msg); @@ -385,7 +375,6 @@ Primitive GenericParser::readPrefixPrimitive() return primitive1; } - std::unique_ptr GenericParser::readPrimitive() { mCtx.mLogger.debug(getOpeningMsg(getMethodName(this, __func__), mCtx.mDs.getCurrentOffset())); @@ -399,7 +388,6 @@ std::unique_ptr GenericParser::readPrimitive() return obj; } - std::unique_ptr GenericParser::readPrimitive(Primitive aPrimitive) { mCtx.mLogger.debug(getOpeningMsg(getMethodName(this, __func__), mCtx.mDs.getCurrentOffset())); @@ -418,8 +406,8 @@ std::unique_ptr GenericParser::readPrimitive(Primitive aPrimitive) { if(mCtx.mCfg.mSkipInvalidPrim) { - mCtx.mLogger.debug("{}: Skipping invalid Primitive {}", - getMethodName(this, __func__), ::to_string(aPrimitive)); + mCtx.mLogger.debug( + "{}: Skipping invalid Primitive {}", getMethodName(this, __func__), ::to_string(aPrimitive)); // Reset file position to the state before // the structure was parsed and failed @@ -431,8 +419,8 @@ std::unique_ptr GenericParser::readPrimitive(Primitive aPrimitive) const uint32_t byteLength = mCtx.mDs.readUint32(); - mCtx.mDs.printUnknownData(byteLength - sizeof(byteLength), - fmt::format("{} data", ::to_string(aPrimitive))); + mCtx.mDs.printUnknownData( + byteLength - sizeof(byteLength), fmt::format("{} data", ::to_string(aPrimitive))); readPreamble(); } @@ -444,8 +432,8 @@ std::unique_ptr GenericParser::readPrimitive(Primitive aPrimitive) } else { - const std::string msg = fmt::format("{}: Primitive {} is not implemented!", - getMethodName(this, __func__), ::to_string(aPrimitive)); + const std::string msg = + fmt::format("{}: Primitive {} is not implemented!", getMethodName(this, __func__), ::to_string(aPrimitive)); mCtx.mLogger.debug(msg); @@ -454,13 +442,12 @@ std::unique_ptr GenericParser::readPrimitive(Primitive aPrimitive) throw std::runtime_error(msg); } - mCtx.mLogger.debug("{}: Skipping unimplemented Primitive {}", - getMethodName(this, __func__), ::to_string(aPrimitive)); + mCtx.mLogger.debug( + "{}: Skipping unimplemented Primitive {}", getMethodName(this, __func__), ::to_string(aPrimitive)); const uint32_t byteLength = mCtx.mDs.readUint32(); - mCtx.mDs.printUnknownData(byteLength - sizeof(byteLength), - fmt::format("{} data", ::to_string(aPrimitive))); + mCtx.mDs.printUnknownData(byteLength - sizeof(byteLength), fmt::format("{} data", ::to_string(aPrimitive))); readPreamble(); } @@ -470,7 +457,6 @@ std::unique_ptr GenericParser::readPrimitive(Primitive aPrimitive) return obj; } - std::unique_ptr GenericParser::readStructure() { mCtx.mLogger.debug(getOpeningMsg(getMethodName(this, __func__), mCtx.mDs.getCurrentOffset())); @@ -484,7 +470,6 @@ std::unique_ptr GenericParser::readStructure() return obj; } - std::unique_ptr GenericParser::readStructure(Structure aStructure) { mCtx.mLogger.debug(getOpeningMsg(getMethodName(this, __func__), mCtx.mDs.getCurrentOffset())); @@ -503,8 +488,8 @@ std::unique_ptr GenericParser::readStructure(Structure aStructure) { if(mCtx.mCfg.mSkipInvalidStruct) { - mCtx.mLogger.debug("{}: Skipping invalid Structure {}", - getMethodName(this, __func__), ::to_string(aStructure)); + mCtx.mLogger.debug( + "{}: Skipping invalid Structure {}", getMethodName(this, __func__), ::to_string(aStructure)); // Reset file position to the state before // the structure was parsed and failed @@ -528,8 +513,8 @@ std::unique_ptr GenericParser::readStructure(Structure aStructure) } else { - const std::string msg = fmt::format("{}: Structure {} is unimplemented!", - getMethodName(this, __func__), ::to_string(aStructure)); + const std::string msg = + fmt::format("{}: Structure {} is unimplemented!", getMethodName(this, __func__), ::to_string(aStructure)); mCtx.mLogger.debug(msg); @@ -538,8 +523,8 @@ std::unique_ptr GenericParser::readStructure(Structure aStructure) throw std::runtime_error(msg); } - mCtx.mLogger.debug("{}: Skipping unimplemented Structure {}", - getMethodName(this, __func__), ::to_string(aStructure)); + mCtx.mLogger.debug( + "{}: Skipping unimplemented Structure {}", getMethodName(this, __func__), ::to_string(aStructure)); FutureDataLst localFutureDataLst{mCtx}; @@ -553,11 +538,10 @@ std::unique_ptr GenericParser::readStructure(Structure aStructure) return obj; } - bool GenericParser::tryRead(std::function aFunction) { const auto offsetBeforeTest = mCtx.mDs.getCurrentOffset(); - bool checkFailed = false; + bool checkFailed = false; try { @@ -573,8 +557,8 @@ bool GenericParser::tryRead(std::function aFunction) return !checkFailed; } - -void GenericParser::checkInterpretedDataLen(const std::string& aFuncName, size_t aStartOffset, size_t aEndOffset, size_t aExpectedLen) +void GenericParser::checkInterpretedDataLen( + const std::string& aFuncName, size_t aStartOffset, size_t aEndOffset, size_t aExpectedLen) { if(aStartOffset > aEndOffset) { @@ -589,29 +573,14 @@ void GenericParser::checkInterpretedDataLen(const std::string& aFuncName, size_t } } - FileFormatVersion GenericParser::predictVersion(std::function aFunc) { FileFormatVersion prediction = FileFormatVersion::Unknown; - const std::vector versions{ - FileFormatVersion::A, - FileFormatVersion::B, - FileFormatVersion::C, - FileFormatVersion::D, - FileFormatVersion::E, - FileFormatVersion::F, - FileFormatVersion::G, - FileFormatVersion::H, - FileFormatVersion::I, - FileFormatVersion::J, - FileFormatVersion::K, - FileFormatVersion::L, - FileFormatVersion::M, - FileFormatVersion::N, - FileFormatVersion::O, - FileFormatVersion::P - }; + const std::vector versions{FileFormatVersion::A, FileFormatVersion::B, FileFormatVersion::C, + FileFormatVersion::D, FileFormatVersion::E, FileFormatVersion::F, FileFormatVersion::G, FileFormatVersion::H, + FileFormatVersion::I, FileFormatVersion::J, FileFormatVersion::K, FileFormatVersion::L, FileFormatVersion::M, + FileFormatVersion::N, FileFormatVersion::O, FileFormatVersion::P}; const size_t initial_offset = mCtx.mDs.getCurrentOffset(); @@ -644,8 +613,8 @@ FileFormatVersion GenericParser::predictVersion(std::function #include #include @@ -19,17 +18,16 @@ #include "Primitives/PrimBase.hpp" #include "StreamContext.hpp" - class FutureDataLst; class Record; - class GenericParser { public: - - GenericParser(StreamContext& aCtx) : mCtx{aCtx} - { } + GenericParser(StreamContext& aCtx) + : mCtx{aCtx} + { + } void discard_until_preamble(); @@ -48,7 +46,8 @@ class GenericParser void readPreamble(); Primitive readPrefixPrimitive(); - void checkInterpretedDataLen(const std::string &aFuncName, size_t aStartOffset, size_t aEndOffset, size_t aExpectedLen); + void checkInterpretedDataLen( + const std::string& aFuncName, size_t aStartOffset, size_t aEndOffset, size_t aExpectedLen); FileFormatVersion predictVersion(std::function aFunc); @@ -62,9 +61,7 @@ class GenericParser bool tryRead(std::function aFunction); private: - StreamContext& mCtx; }; - #endif // GENERICPARSER_HPP \ No newline at end of file diff --git a/src/GetStreamHelper.hpp b/src/GetStreamHelper.hpp index c46de483..04cbed69 100644 --- a/src/GetStreamHelper.hpp +++ b/src/GetStreamHelper.hpp @@ -10,20 +10,17 @@ #include "Streams/StreamDirectoryStruct.hpp" #include "Streams/StreamLibrary.hpp" - static const std::map DirectoryType2StreamType = { - {DirectoryType::CellsDirectory, StreamType::CellsDirectory}, + {DirectoryType::CellsDirectory, StreamType::CellsDirectory }, {DirectoryType::ExportBlocksDirectory, StreamType::ExportBlocksDirectory}, - {DirectoryType::GraphicsDirectory, StreamType::GraphicsDirectory}, - {DirectoryType::PackagesDirectory, StreamType::PackagesDirectory}, - {DirectoryType::PartsDirectory, StreamType::PartsDirectory}, - {DirectoryType::SymbolsDirectory, StreamType::SymbolsDirectory}, - {DirectoryType::ViewsDirectory, StreamType::ViewsDirectory} + {DirectoryType::GraphicsDirectory, StreamType::GraphicsDirectory }, + {DirectoryType::PackagesDirectory, StreamType::PackagesDirectory }, + {DirectoryType::PartsDirectory, StreamType::PartsDirectory }, + {DirectoryType::SymbolsDirectory, StreamType::SymbolsDirectory }, + {DirectoryType::ViewsDirectory, StreamType::ViewsDirectory } }; - -[[maybe_unused]] -static std::shared_ptr getLibraryStreamFromDb(Database& aDb) +[[maybe_unused]] static std::shared_ptr getLibraryStreamFromDb(Database& aDb) { for(auto& stream : aDb.mStreams) { @@ -36,11 +33,9 @@ static std::shared_ptr getLibraryStreamFromDb(Database& aDb) return std::shared_ptr{}; } - // T is of type `DirectoryStream` -template -[[maybe_unused]] -static std::shared_ptr getDirectoryStreamFromDb(Database& aDb, DirectoryType aDirType) +template +[[maybe_unused]] static std::shared_ptr getDirectoryStreamFromDb(Database& aDb, DirectoryType aDirType) { for(auto& stream : aDb.mStreams) { @@ -53,5 +48,4 @@ static std::shared_ptr getDirectoryStreamFromDb(Database& aDb, DirectoryType return std::shared_ptr{}; } - #endif // GETSTREAMHELPER_HPP \ No newline at end of file diff --git a/src/Misc.cpp b/src/Misc.cpp index 2df2babf..ccd24b82 100644 --- a/src/Misc.cpp +++ b/src/Misc.cpp @@ -20,20 +20,19 @@ #include "Streams/StreamPackage.hpp" #include "Streams/StreamSymbol.hpp" - struct SymbolUserProp { uint32_t nameIdx; uint32_t valIdx; SymbolUserProp() - { } + { + } std::string getName() const; std::string getVal() const; }; - std::string SymbolUserProp::getName() const { std::string name; @@ -58,7 +57,6 @@ std::string SymbolUserProp::getName() const return name; } - std::string SymbolUserProp::getVal() const { std::string val; @@ -83,7 +81,6 @@ std::string SymbolUserProp::getVal() const return val; } - // @todo this is a whole file parser. Split it up into the title block structure and move the rest to the symbol parser? void Container::readTitleBlockSymbol() { @@ -101,8 +98,10 @@ void Container::readTitleBlockSymbol() { SymbolUserProp symbolUserProp{}; - symbolUserProp.nameIdx = ds.readUint32(); // @todo move to Kaitai OrCAD: 'Symbol Properties' (Fixed value on the left) - symbolUserProp.valIdx = ds.readUint32(); // @todo move to Kaitai OrCAD: 'Symbol Properties' (Adjustable value on the right) + symbolUserProp.nameIdx = + ds.readUint32(); // @todo move to Kaitai OrCAD: 'Symbol Properties' (Fixed value on the left) + symbolUserProp.valIdx = + ds.readUint32(); // @todo move to Kaitai OrCAD: 'Symbol Properties' (Adjustable value on the right) symbolUserProps.push_back(symbolUserProp); } diff --git a/src/PageSettings.cpp b/src/PageSettings.cpp index 3cc4615f..36cd1245 100644 --- a/src/PageSettings.cpp +++ b/src/PageSettings.cpp @@ -7,7 +7,6 @@ #include "General.hpp" #include "PageSettings.hpp" - void PageSettings::read(FileFormatVersion /* aVersion */) { auto& ds = mCtx.mDs; @@ -75,7 +74,7 @@ void PageSettings::read(FileFormatVersion /* aVersion */) mCtx.mLogger.trace("horizontalAscending = {}", horizontalAscending); - verticalChar = ds.readUint32(); + verticalChar = ds.readUint32(); mCtx.mLogger.trace("verticalChar = {}", verticalChar); diff --git a/src/PageSettings.hpp b/src/PageSettings.hpp index 791ae4b6..9719e971 100644 --- a/src/PageSettings.hpp +++ b/src/PageSettings.hpp @@ -1,7 +1,6 @@ #ifndef PAGESETTINGS_HPP #define PAGESETTINGS_HPP - #include #include #include @@ -12,25 +11,34 @@ #include "General.hpp" #include "Record.hpp" - class PageSettings : public Other { public: - - PageSettings(StreamContext& aCtx) : Other{aCtx}, - createDateTime{0}, modifyDateTime{0}, - width{0}, height{0}, - pinToPin{0}, - horizontalCount{0}, verticalCount{0}, - horizontalWidth{0}, verticalWidth{0}, - horizontalChar{0}, horizontalAscending{0}, - verticalChar{0}, verticalAscending{0}, - isMetric{0}, - borderDisplayed{0}, borderPrinted{0}, - gridRefDisplayed{0}, gridRefPrinted{0}, - titleblockDisplayed{0}, titleblockPrinted{0}, - ansiGridRefs{0} - { } + PageSettings(StreamContext& aCtx) + : Other{aCtx}, + createDateTime{0}, + modifyDateTime{0}, + width{0}, + height{0}, + pinToPin{0}, + horizontalCount{0}, + verticalCount{0}, + horizontalWidth{0}, + verticalWidth{0}, + horizontalChar{0}, + horizontalAscending{0}, + verticalChar{0}, + verticalAscending{0}, + isMetric{0}, + borderDisplayed{0}, + borderPrinted{0}, + gridRefDisplayed{0}, + gridRefPrinted{0}, + titleblockDisplayed{0}, + titleblockPrinted{0}, + ansiGridRefs{0} + { + } std::string to_string() const override; @@ -86,16 +94,14 @@ class PageSettings : public Other uint32_t ansiGridRefs; }; - -[[maybe_unused]] -static std::string to_string(const PageSettings& aObj) +[[maybe_unused]] static std::string to_string(const PageSettings& aObj) { std::string str; str += fmt::format("{}:\n", nameof::nameof_type()); str += fmt::format("{}createDateTime = {}\n", indent(1), DateTimeToStr(aObj.createDateTime)); str += fmt::format("{}modifyDateTime = {}\n", indent(1), DateTimeToStr(aObj.modifyDateTime)); - str += fmt::format("{}width = {}\n", indent(1), aObj. width); + str += fmt::format("{}width = {}\n", indent(1), aObj.width); str += fmt::format("{}height = {}\n", indent(1), aObj.height); str += fmt::format("{}pinToPin = {}\n", indent(1), aObj.pinToPin); str += fmt::format("{}horizontalCount = {}\n", indent(1), aObj.horizontalCount); @@ -118,20 +124,16 @@ static std::string to_string(const PageSettings& aObj) return str; } - inline std::string PageSettings::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const PageSettings& aObj) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const PageSettings& aObj) { aOs << to_string(aObj); return aOs; } - #endif // PAGESETTINGS_HPP \ No newline at end of file diff --git a/src/PinShape.hpp b/src/PinShape.hpp index cf5e1ee0..7e30f856 100644 --- a/src/PinShape.hpp +++ b/src/PinShape.hpp @@ -1,7 +1,6 @@ #ifndef PINSHAPE_HPP #define PINSHAPE_HPP - #include #include #include @@ -14,7 +13,6 @@ #include "General.hpp" - // @todo this file is highly experimental and needs further testing struct PinShape // @todo rename to something like PinProperties as it contains more than the shape @@ -23,15 +21,14 @@ struct PinShape // @todo rename to something like PinProperties as it contains m bool isClock; // ---|> bool isDot; // --o| bool isLeftPointing; - bool isRightPointing; // @note this can be derived from isLeftPointing... is it really in the file? or is - // there the possibility to point in both directions as there is to point in none? + bool isRightPointing; // @note this can be derived from isLeftPointing... is it really in the file? or is + // there the possibility to point in both directions as there is to point in none? bool isNetStyle; bool isNoConnect; bool isGlobal; bool isNumberVisible; }; - enum class ShapeType { Clock, @@ -45,22 +42,17 @@ enum class ShapeType ZeroLength }; - -[[maybe_unused]] -static std::string to_string(const ShapeType& aVal) +[[maybe_unused]] static std::string to_string(const ShapeType& aVal) { return std::string{magic_enum::enum_name(aVal)}; } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const ShapeType& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const ShapeType& aVal) { aOs << to_string(aVal); return aOs; } - // @todo Move table to Kaitai file // See OrCAD: 'Pin Properties' -> 'Shape' // 'Clock' <- isLong && isClock && !isDot @@ -72,8 +64,7 @@ static std::ostream& operator<<(std::ostream& aOs, const ShapeType& aVal) // 'Short Dot' <- !isLong && !isClock && isDot // 'Short Dot Clock' <- !isLong && isClock && isDot // 'Zero Length' // Not sure how this is generated -[[maybe_unused]] -static ShapeType ToShapeType(const PinShape& pinShape) +[[maybe_unused]] static ShapeType ToShapeType(const PinShape& pinShape) { const auto& pin = pinShape; @@ -82,19 +73,19 @@ static ShapeType ToShapeType(const PinShape& pinShape) // All possible combinations are covered // by the if-statements - if( pin.isLong && pin.isClock && !pin.isDot) + if(pin.isLong && pin.isClock && !pin.isDot) { shapeType = ShapeType::Clock; } - if( pin.isLong && !pin.isClock && pin.isDot) + if(pin.isLong && !pin.isClock && pin.isDot) { shapeType = ShapeType::Dot; } - if( pin.isLong && pin.isClock && pin.isDot) + if(pin.isLong && pin.isClock && pin.isDot) { shapeType = ShapeType::DotClock; } - if( pin.isLong && !pin.isClock && !pin.isDot) + if(pin.isLong && !pin.isClock && !pin.isDot) { shapeType = ShapeType::Line; } @@ -102,15 +93,15 @@ static ShapeType ToShapeType(const PinShape& pinShape) { shapeType = ShapeType::Short; } - if(!pin.isLong && pin.isClock && !pin.isDot) + if(!pin.isLong && pin.isClock && !pin.isDot) { shapeType = ShapeType::ShortClock; } - if(!pin.isLong && !pin.isClock && pin.isDot) + if(!pin.isLong && !pin.isClock && pin.isDot) { shapeType = ShapeType::ShortDot; } - if(!pin.isLong && pin.isClock && pin.isDot) + if(!pin.isLong && pin.isClock && pin.isDot) { shapeType = ShapeType::ShortDotClock; } @@ -123,9 +114,7 @@ static ShapeType ToShapeType(const PinShape& pinShape) return shapeType; } - -[[maybe_unused]] -static PinShape ToPinShape(uint16_t val, std::optional aLogger = std::nullopt) +[[maybe_unused]] static PinShape ToPinShape(uint16_t val, std::optional aLogger = std::nullopt) { PinShape pinShape; @@ -170,9 +159,7 @@ static PinShape ToPinShape(uint16_t val, std::optional aLogger = return pinShape; } - -[[maybe_unused]] -static std::string to_string(const PinShape& aObj) +[[maybe_unused]] static std::string to_string(const PinShape& aObj) { std::string str; @@ -193,13 +180,10 @@ static std::string to_string(const PinShape& aObj) return str; } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const PinShape& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const PinShape& aVal) { aOs << to_string(aVal); return aOs; } - #endif // PINSHAPE_HPP \ No newline at end of file diff --git a/src/Primitives/Point.cpp b/src/Primitives/Point.cpp index a8c4a06f..294875ce 100644 --- a/src/Primitives/Point.cpp +++ b/src/Primitives/Point.cpp @@ -7,7 +7,6 @@ #include "General.hpp" #include "Primitives/Point.hpp" - void Point::read(FileFormatVersion /* aVersion */) { auto& ds = mCtx.mDs; diff --git a/src/Primitives/Point.hpp b/src/Primitives/Point.hpp index 8cca6862..80233e9e 100644 --- a/src/Primitives/Point.hpp +++ b/src/Primitives/Point.hpp @@ -1,7 +1,6 @@ #ifndef COORDINATE_HPP #define COORDINATE_HPP - #include #include #include @@ -12,15 +11,17 @@ #include "General.hpp" #include "PrimBase.hpp" - /// @note Represents 'BezierPoint', 'PolygonPoint' and 'PolylinePoint' because /// all of them use the same point structure. class Point : public Other { public: - - Point(StreamContext& aCtx) : Other{aCtx}, x{0}, y{0} - { } + Point(StreamContext& aCtx) + : Other{aCtx}, + x{0}, + y{0} + { + } std::string to_string() const override; @@ -35,9 +36,7 @@ class Point : public Other uint16_t y; }; - -[[maybe_unused]] -static std::string to_string(const Point& aObj) +[[maybe_unused]] static std::string to_string(const Point& aObj) { std::string str; @@ -47,20 +46,16 @@ static std::string to_string(const Point& aObj) return str; } - inline std::string Point::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const Point& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const Point& aVal) { aOs << to_string(aVal); return aOs; } - #endif // COORDINATE_HPP \ No newline at end of file diff --git a/src/Primitives/PrimArc.cpp b/src/Primitives/PrimArc.cpp index 05025b38..935a0d24 100644 --- a/src/Primitives/PrimArc.cpp +++ b/src/Primitives/PrimArc.cpp @@ -10,7 +10,6 @@ #include "GenericParser.hpp" #include "Primitives/PrimArc.hpp" - size_t PrimArc::getExpectedStructSize(FileFormatVersion aVersion) { size_t expectedByteLength; @@ -27,7 +26,6 @@ size_t PrimArc::getExpectedStructSize(FileFormatVersion aVersion) return expectedByteLength; } - void PrimArc::read(FileFormatVersion aVersion) { auto& ds = mCtx.mDs; @@ -42,9 +40,14 @@ void PrimArc::read(FileFormatVersion aVersion) // Predict version switch(byteLength) { - case 40: aVersion = FileFormatVersion::A; break; - case 48: aVersion = FileFormatVersion::B; break; - default: break; + case 40: + aVersion = FileFormatVersion::A; + break; + case 48: + aVersion = FileFormatVersion::B; + break; + default: + break; } ds.assumeData({0x00, 0x00, 0x00, 0x00}, getMethodName(this, __func__) + ": 0"); diff --git a/src/Primitives/PrimArc.hpp b/src/Primitives/PrimArc.hpp index a096b3bc..809f60fc 100644 --- a/src/Primitives/PrimArc.hpp +++ b/src/Primitives/PrimArc.hpp @@ -1,7 +1,6 @@ #ifndef PRIMARC_HPP #define PRIMARC_HPP - #include #include #include @@ -15,15 +14,24 @@ #include "General.hpp" #include "Primitives/PrimBase.hpp" - // @note This defines an elliptic arc. class PrimArc : public PrimBase { public: - - PrimArc(StreamContext& aCtx) : PrimBase{aCtx}, x1{0}, y1{0}, x2{0}, y2{0}, - startX{0}, startY{0}, endX{0}, endY{0}, mLineStyle{}, mLineWidth{} - { } + PrimArc(StreamContext& aCtx) + : PrimBase{aCtx}, + x1{0}, + y1{0}, + x2{0}, + y2{0}, + startX{0}, + startY{0}, + endX{0}, + endY{0}, + mLineStyle{}, + mLineWidth{} + { + } std::string to_string() const override; @@ -88,14 +96,11 @@ class PrimArc : public PrimBase int32_t endY; private: - std::optional mLineStyle; std::optional mLineWidth; }; - -[[maybe_unused]] -static std::string to_string(const PrimArc& aObj) +[[maybe_unused]] static std::string to_string(const PrimArc& aObj) { std::string str; @@ -114,20 +119,16 @@ static std::string to_string(const PrimArc& aObj) return str; } - inline std::string PrimArc::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const PrimArc& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const PrimArc& aVal) { aOs << to_string(aVal); return aOs; } - #endif // PRIMARC_HPP \ No newline at end of file diff --git a/src/Primitives/PrimBase.hpp b/src/Primitives/PrimBase.hpp index 1887c941..0739f2a4 100644 --- a/src/Primitives/PrimBase.hpp +++ b/src/Primitives/PrimBase.hpp @@ -1,22 +1,22 @@ #ifndef PRIMBASE_HPP #define PRIMBASE_HPP - #include "Enums/Primitive.hpp" #include "Record.hpp" - class PrimBase : public Base { public: - PrimBase(StreamContext& aCtx) : Base{aCtx} - { } + PrimBase(StreamContext& aCtx) + : Base{aCtx} + { + } virtual ~PrimBase() - { } + { + } virtual Primitive getObjectType() const = 0; }; - #endif // PRIMBASE_HPP \ No newline at end of file diff --git a/src/Primitives/PrimBezier.cpp b/src/Primitives/PrimBezier.cpp index b4400605..a2986122 100644 --- a/src/Primitives/PrimBezier.cpp +++ b/src/Primitives/PrimBezier.cpp @@ -12,7 +12,6 @@ #include "GenericParser.hpp" #include "Primitives/PrimBezier.hpp" - size_t PrimBezier::getExpectedStructSize(FileFormatVersion aVersion, size_t aPointCount) { size_t expectedByteLength; @@ -29,7 +28,6 @@ size_t PrimBezier::getExpectedStructSize(FileFormatVersion aVersion, size_t aPoi return expectedByteLength; } - void PrimBezier::read(FileFormatVersion aVersion) { auto& ds = mCtx.mDs; @@ -39,8 +37,8 @@ void PrimBezier::read(FileFormatVersion aVersion) if(aVersion == FileFormatVersion::Unknown) { - const auto predictionFunc = [this](FileFormatVersion aVersion){ this->read(aVersion); }; - aVersion = parser.predictVersion(predictionFunc); + const auto predictionFunc = [this](FileFormatVersion aVersion) { this->read(aVersion); }; + aVersion = parser.predictVersion(predictionFunc); } const size_t startOffset = ds.getCurrentOffset(); @@ -61,8 +59,8 @@ void PrimBezier::read(FileFormatVersion aVersion) if(pointCount < 4) { - throw std::runtime_error("At minimum 4 'BezierPoint's must occur but got " + std::to_string(pointCount) - + " points!"); + throw std::runtime_error( + "At minimum 4 'BezierPoint's must occur but got " + std::to_string(pointCount) + " points!"); } else { @@ -93,8 +91,8 @@ void PrimBezier::read(FileFormatVersion aVersion) if(!isDivisible(pointCount - 1, 3)) { - throw std::runtime_error("Number of 'BezierPoint's is incorrect. Got " + std::to_string(pointCount) - + " points!"); + throw std::runtime_error( + "Number of 'BezierPoint's is incorrect. Got " + std::to_string(pointCount) + " points!"); } } diff --git a/src/Primitives/PrimBezier.hpp b/src/Primitives/PrimBezier.hpp index d52f85fc..21183b86 100644 --- a/src/Primitives/PrimBezier.hpp +++ b/src/Primitives/PrimBezier.hpp @@ -1,7 +1,6 @@ #ifndef PRIMBEZIER_HPP #define PRIMBEZIER_HPP - #include #include #include @@ -17,12 +16,16 @@ #include "Primitives/Point.hpp" #include "Primitives/PrimBase.hpp" - class PrimBezier : public PrimBase { public: - PrimBezier(StreamContext& aCtx) : PrimBase{aCtx}, mLineStyle{}, mLineWidth{}, points{} - { } + PrimBezier(StreamContext& aCtx) + : PrimBase{aCtx}, + mLineStyle{}, + mLineWidth{}, + points{} + { + } std::string to_string() const override; @@ -61,18 +64,14 @@ class PrimBezier : public PrimBase } private: - std::optional mLineStyle; std::optional mLineWidth; public: - std::vector points; }; - -[[maybe_unused]] -static std::string to_string(const PrimBezier& aObj) +[[maybe_unused]] static std::string to_string(const PrimBezier& aObj) { std::string str; @@ -89,20 +88,16 @@ static std::string to_string(const PrimBezier& aObj) return str; } - inline std::string PrimBezier::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const PrimBezier& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const PrimBezier& aVal) { aOs << to_string(aVal); return aOs; } - #endif // PRIMBEZIER_HPP \ No newline at end of file diff --git a/src/Primitives/PrimBitmap.cpp b/src/Primitives/PrimBitmap.cpp index e6e88f91..49edc42c 100644 --- a/src/Primitives/PrimBitmap.cpp +++ b/src/Primitives/PrimBitmap.cpp @@ -17,10 +17,8 @@ #include "GenericParser.hpp" #include "Primitives/PrimBitmap.hpp" - namespace fs = std::filesystem; - void PrimBitmap::read(FileFormatVersion /* aVersion */) { auto& ds = mCtx.mDs; @@ -68,8 +66,8 @@ void PrimBitmap::read(FileFormatVersion /* aVersion */) rawImgData.push_back(ds.readUint8()); } - fs::path filename = mCtx.mExtractedCfbfPath.parent_path() / "data" / fmt::format("{}_img_{}.bmp", - mCtx.mInputStream.stem().string(), mCtx.mImgCtr); + fs::path filename = mCtx.mExtractedCfbfPath.parent_path() / "data" / + fmt::format("{}_img_{}.bmp", mCtx.mInputStream.stem().string(), mCtx.mImgCtr); filename = writeImgToFile(filename); @@ -93,7 +91,6 @@ void PrimBitmap::read(FileFormatVersion /* aVersion */) mCtx.mLogger.trace(to_string()); } - // Returns path to the written image file fs::path PrimBitmap::writeBmpFile(fs::path aFilePath, const std::vector& aRawImgData) const { @@ -104,8 +101,7 @@ fs::path PrimBitmap::writeBmpFile(fs::path aFilePath, const std::vector if(!img) { - const std::string msg = fmt::format("{}: Can not open file for writing: {}", - __func__, aFilePath.string()); + const std::string msg = fmt::format("{}: Can not open file for writing: {}", __func__, aFilePath.string()); mCtx.mLogger.error(msg); throw std::runtime_error(msg); @@ -117,8 +113,8 @@ fs::path PrimBitmap::writeBmpFile(fs::path aFilePath, const std::vector struct BmpHeader { uint16_t magicBytes = 0x4d42; - uint32_t bmpSize = 0; // Will be set later - uint32_t reserved = 0; + uint32_t bmpSize = 0; // Will be set later + uint32_t reserved = 0; uint32_t offset = 54; // @note Maybe this offset needs to be adjusted according to the bitmap } header; @@ -146,7 +142,6 @@ fs::path PrimBitmap::writeBmpFile(fs::path aFilePath, const std::vector return aFilePath; } - // aFilePath is the requested path to the image file, but the function will change the file // extension, depending on the corresponding file type that was found. // Returns path to the actually written image file @@ -172,8 +167,8 @@ fs::path PrimBitmap::writeDifferentImageFile(fs::path aFilePath, const std::vect // for magic bytes like e.g. {0xaa, 0xbb} vs {0xaa}. There we // want to evaluate for {0xaa, 0xbb} first. const std::vector fileTypes = { - { "JPG", ".jpg", {0xff, 0xd8} }, - { "PNG", ".png", {0x89, 0x50, 0x4e, 0x47} } + {"JPG", ".jpg", {0xff, 0xd8} }, + {"PNG", ".png", {0x89, 0x50, 0x4e, 0x47}} }; std::optional foundFileType; @@ -187,8 +182,7 @@ fs::path PrimBitmap::writeDifferentImageFile(fs::path aFilePath, const std::vect continue; } - bool isType = 0 == std::memcmp(fileType.magicBytes.data(), aRawImgData.data() + startOffset, - minCmpLen); + bool isType = 0 == std::memcmp(fileType.magicBytes.data(), aRawImgData.data() + startOffset, minCmpLen); if(isType) { @@ -212,8 +206,7 @@ fs::path PrimBitmap::writeDifferentImageFile(fs::path aFilePath, const std::vect if(!img) { - const std::string msg = fmt::format("{}: Can not open file for writing: {}", - __func__, aFilePath.string()); + const std::string msg = fmt::format("{}: Can not open file for writing: {}", __func__, aFilePath.string()); mCtx.mLogger.error(msg); throw std::runtime_error(msg); @@ -236,19 +229,18 @@ bool PrimBitmap::isBmpImage(const std::vector& aRawImgData) const // Non BMP images contain a header that seems to be the same everywhere // one characteristic section contains the string `CI_IMAGE` that is // used for recognizing this kind of headers. - const size_t MAGIC_ID_OFFSET = 0xaa; + const size_t MAGIC_ID_OFFSET = 0xaa; const std::array MAGIC_ID = {'C', 'I', '_', 'I', 'M', 'A', 'G', 'E'}; if(aRawImgData.size() >= 0xbb) { hasMagicId = 0 == std::memcmp(MAGIC_ID.data(), aRawImgData.data() + MAGIC_ID_OFFSET, - std::min(MAGIC_ID.size(), aRawImgData.size() - MAGIC_ID_OFFSET)); + std::min(MAGIC_ID.size(), aRawImgData.size() - MAGIC_ID_OFFSET)); } return !hasMagicId; } - fs::path PrimBitmap::writeImgToFile(fs::path aFilePath) const { // @todo Probably its file format version dependent if it supports diff --git a/src/Primitives/PrimBitmap.hpp b/src/Primitives/PrimBitmap.hpp index 13f1cb28..79cd6dab 100644 --- a/src/Primitives/PrimBitmap.hpp +++ b/src/Primitives/PrimBitmap.hpp @@ -1,7 +1,6 @@ #ifndef PRIMBITMAP_HPP #define PRIMBITMAP_HPP - #include #include #include @@ -13,17 +12,23 @@ #include "General.hpp" #include "Primitives/PrimBase.hpp" - namespace fs = std::filesystem; - class PrimBitmap : public PrimBase { public: - - PrimBitmap(StreamContext& aCtx) : PrimBase{aCtx}, locX{0}, locY{0}, - x1{0}, y1{0}, x2{0}, y2{0}, bmpWidth{0}, bmpHeight{0} - { } + PrimBitmap(StreamContext& aCtx) + : PrimBase{aCtx}, + locX{0}, + locY{0}, + x1{0}, + y1{0}, + x2{0}, + y2{0}, + bmpWidth{0}, + bmpHeight{0} + { + } std::string to_string() const override; @@ -62,9 +67,7 @@ class PrimBitmap : public PrimBase std::vector rawImgData; // @todo called val in the XSD file }; - -[[maybe_unused]] -static std::string to_string(const PrimBitmap& aObj) +[[maybe_unused]] static std::string to_string(const PrimBitmap& aObj) { std::string str; @@ -83,20 +86,16 @@ static std::string to_string(const PrimBitmap& aObj) return str; } - inline std::string PrimBitmap::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const PrimBitmap& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const PrimBitmap& aVal) { aOs << to_string(aVal); return aOs; } - #endif // PRIMBITMAP_HPP \ No newline at end of file diff --git a/src/Primitives/PrimCommentText.cpp b/src/Primitives/PrimCommentText.cpp index 9b36a28c..6d4adfb1 100644 --- a/src/Primitives/PrimCommentText.cpp +++ b/src/Primitives/PrimCommentText.cpp @@ -12,7 +12,6 @@ #include "Primitives/PrimCommentText.hpp" #include "Win32/LOGFONTA.hpp" - void PrimCommentText::read(FileFormatVersion /* aVersion */) { auto& ds = mCtx.mDs; @@ -24,14 +23,14 @@ void PrimCommentText::read(FileFormatVersion /* aVersion */) const size_t startOffset = ds.getCurrentOffset(); - // @todo Adding 8 Byte does not make any sense, why did it - // work previously and why does it work in other - // primitives that use similar data structures? - // Maybe the byte length does not count itself and - // the following 4 zero bytes. - // This issue is somehow related to the disabled - // readOptionalTrailingFuture check in StructPlacedInstance - // and readOptionalTrailingFuture in StructT0x10 + // @todo Adding 8 Byte does not make any sense, why did it + // work previously and why does it work in other + // primitives that use similar data structures? + // Maybe the byte length does not count itself and + // the following 4 zero bytes. + // This issue is somehow related to the disabled + // readOptionalTrailingFuture check in StructPlacedInstance + // and readOptionalTrailingFuture in StructT0x10 const uint32_t byteLength = ds.readUint32() + 8U; ds.assumeData({0x00, 0x00, 0x00, 0x00}, getMethodName(this, __func__) + ": 0"); @@ -88,7 +87,6 @@ void PrimCommentText::read(FileFormatVersion /* aVersion */) mCtx.mLogger.trace(to_string()); } - LOGFONTA PrimCommentText::getTextFont() const { const auto lib = getLibraryStreamFromDb(mCtx.mDb); diff --git a/src/Primitives/PrimCommentText.hpp b/src/Primitives/PrimCommentText.hpp index ef691758..2044c542 100644 --- a/src/Primitives/PrimCommentText.hpp +++ b/src/Primitives/PrimCommentText.hpp @@ -1,7 +1,6 @@ #ifndef PRIMCOMMENTTEXT_HPP #define PRIMCOMMENTTEXT_HPP - #include #include #include @@ -12,16 +11,24 @@ #include "Primitives/PrimBase.hpp" #include "Win32/LOGFONTA.hpp" - // Forward declaration struct Library; - class PrimCommentText : public PrimBase { public: - PrimCommentText(StreamContext& aCtx) : PrimBase{aCtx}, locX{0}, locY{0}, name{}, x1{0}, y1{0}, x2{0}, y2{0}, textFontIdx{0} - { } + PrimCommentText(StreamContext& aCtx) + : PrimBase{aCtx}, + locX{0}, + locY{0}, + name{}, + x1{0}, + y1{0}, + x2{0}, + y2{0}, + textFontIdx{0} + { + } std::string to_string() const override; @@ -56,9 +63,7 @@ class PrimCommentText : public PrimBase uint16_t textFontIdx; }; - -[[maybe_unused]] -static std::string to_string(const PrimCommentText& aObj) +[[maybe_unused]] static std::string to_string(const PrimCommentText& aObj) { std::string str; @@ -76,20 +81,16 @@ static std::string to_string(const PrimCommentText& aObj) return str; } - inline std::string PrimCommentText::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const PrimCommentText& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const PrimCommentText& aVal) { aOs << to_string(aVal); return aOs; } - #endif // PRIMCOMMENTTEXT_HPP \ No newline at end of file diff --git a/src/Primitives/PrimEllipse.cpp b/src/Primitives/PrimEllipse.cpp index ae810b61..0b9df0a3 100644 --- a/src/Primitives/PrimEllipse.cpp +++ b/src/Primitives/PrimEllipse.cpp @@ -10,7 +10,6 @@ #include "GenericParser.hpp" #include "Primitives/PrimEllipse.hpp" - size_t PrimEllipse::getExpectedStructSize(FileFormatVersion aVersion) { size_t expectedByteLength; @@ -37,7 +36,6 @@ size_t PrimEllipse::getExpectedStructSize(FileFormatVersion aVersion) return expectedByteLength; } - void PrimEllipse::read(FileFormatVersion aVersion) { auto& ds = mCtx.mDs; @@ -52,10 +50,17 @@ void PrimEllipse::read(FileFormatVersion aVersion) // Predict version switch(byteLength) { - case 24: aVersion = FileFormatVersion::A; break; - case 32: aVersion = FileFormatVersion::B; break; - case 40: aVersion = FileFormatVersion::C; break; - default: break; + case 24: + aVersion = FileFormatVersion::A; + break; + case 32: + aVersion = FileFormatVersion::B; + break; + case 40: + aVersion = FileFormatVersion::C; + break; + default: + break; } ds.assumeData({0x00, 0x00, 0x00, 0x00}, getMethodName(this, __func__) + ": 0"); diff --git a/src/Primitives/PrimEllipse.hpp b/src/Primitives/PrimEllipse.hpp index 7959b3b3..902b3f35 100644 --- a/src/Primitives/PrimEllipse.hpp +++ b/src/Primitives/PrimEllipse.hpp @@ -1,11 +1,8 @@ - - #ifndef PRIMELLIPSE_HPP #define PRIMELLIPSE_HPP - #include #include #include @@ -14,20 +11,27 @@ #include #include -#include "Enums/HatchStyle.hpp" #include "Enums/FillStyle.hpp" +#include "Enums/HatchStyle.hpp" #include "Enums/LineStyle.hpp" #include "Enums/LineWidth.hpp" #include "Primitives/PrimBase.hpp" - class PrimEllipse : public PrimBase { public: - - PrimEllipse(StreamContext& aCtx) : PrimBase{aCtx}, x1{0}, y1{0}, x2{0}, y2{0}, - mLineStyle{}, mLineWidth{}, mFillStyle{}, mHatchStyle{} - { } + PrimEllipse(StreamContext& aCtx) + : PrimBase{aCtx}, + x1{0}, + y1{0}, + x2{0}, + y2{0}, + mLineStyle{}, + mLineWidth{}, + mFillStyle{}, + mHatchStyle{} + { + } std::string to_string() const override; @@ -92,17 +96,14 @@ class PrimEllipse : public PrimBase int32_t y2; private: + std::optional mLineStyle; + std::optional mLineWidth; - std::optional mLineStyle; - std::optional mLineWidth; - - std::optional mFillStyle; + std::optional mFillStyle; std::optional mHatchStyle; }; - -[[maybe_unused]] -static std::string to_string(const PrimEllipse& aObj) +[[maybe_unused]] static std::string to_string(const PrimEllipse& aObj) { std::string str; @@ -119,20 +120,16 @@ static std::string to_string(const PrimEllipse& aObj) return str; } - inline std::string PrimEllipse::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const PrimEllipse& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const PrimEllipse& aVal) { aOs << to_string(aVal); return aOs; } - #endif // PRIMELLIPSE_HPP \ No newline at end of file diff --git a/src/Primitives/PrimLine.cpp b/src/Primitives/PrimLine.cpp index 797cb2e7..27e24839 100644 --- a/src/Primitives/PrimLine.cpp +++ b/src/Primitives/PrimLine.cpp @@ -11,7 +11,6 @@ #include "GenericParser.hpp" #include "Primitives/PrimLine.hpp" - size_t PrimLine::getExpectedStructSize(FileFormatVersion aVersion) { size_t expectedByteLength; @@ -28,7 +27,6 @@ size_t PrimLine::getExpectedStructSize(FileFormatVersion aVersion) return expectedByteLength; } - void PrimLine::read(FileFormatVersion aVersion) { auto& ds = mCtx.mDs; @@ -43,9 +41,14 @@ void PrimLine::read(FileFormatVersion aVersion) // Predict version switch(byteLength) { - case 24: aVersion = FileFormatVersion::A; break; - case 32: aVersion = FileFormatVersion::B; break; - default: break; + case 24: + aVersion = FileFormatVersion::A; + break; + case 32: + aVersion = FileFormatVersion::B; + break; + default: + break; } ds.assumeData({0x00, 0x00, 0x00, 0x00}, getMethodName(this, __func__) + ": 0"); diff --git a/src/Primitives/PrimLine.hpp b/src/Primitives/PrimLine.hpp index 24f23b31..b6d63abb 100644 --- a/src/Primitives/PrimLine.hpp +++ b/src/Primitives/PrimLine.hpp @@ -1,7 +1,6 @@ #ifndef PRIMLINE_HPP #define PRIMLINE_HPP - #include #include #include @@ -15,12 +14,19 @@ #include "Primitives/PrimBase.hpp" #include "Primitives/PrimLine.hpp" - class PrimLine : public PrimBase { public: - PrimLine(StreamContext& aCtx) : PrimBase{aCtx}, x1{0}, y1{0}, x2{0}, y2{0}, mLineStyle{}, mLineWidth{} - { } + PrimLine(StreamContext& aCtx) + : PrimBase{aCtx}, + x1{0}, + y1{0}, + x2{0}, + y2{0}, + mLineStyle{}, + mLineWidth{} + { + } std::string to_string() const override; @@ -65,14 +71,11 @@ class PrimLine : public PrimBase int32_t y2; private: - std::optional mLineStyle; std::optional mLineWidth; }; - -[[maybe_unused]] -static std::string to_string(const PrimLine& aObj) +[[maybe_unused]] static std::string to_string(const PrimLine& aObj) { std::string str; @@ -87,20 +90,16 @@ static std::string to_string(const PrimLine& aObj) return str; } - inline std::string PrimLine::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const PrimLine& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const PrimLine& aVal) { aOs << to_string(aVal); return aOs; } - #endif // PRIMLINE_HPP \ No newline at end of file diff --git a/src/Primitives/PrimPolygon.cpp b/src/Primitives/PrimPolygon.cpp index 61287c8d..8b8c6505 100644 --- a/src/Primitives/PrimPolygon.cpp +++ b/src/Primitives/PrimPolygon.cpp @@ -12,7 +12,6 @@ #include "GenericParser.hpp" #include "Primitives/PrimPolygon.hpp" - size_t PrimPolygon::getExpectedStructSize(FileFormatVersion aVersion, size_t aPointCount) { size_t expectedByteLength; @@ -33,7 +32,6 @@ size_t PrimPolygon::getExpectedStructSize(FileFormatVersion aVersion, size_t aPo return expectedByteLength; } - void PrimPolygon::read(FileFormatVersion aVersion) { auto& ds = mCtx.mDs; @@ -43,8 +41,8 @@ void PrimPolygon::read(FileFormatVersion aVersion) if(aVersion == FileFormatVersion::Unknown) { - const auto predictionFunc = [this](FileFormatVersion aVersion){ this->read(aVersion); }; - aVersion = parser.predictVersion(predictionFunc); + const auto predictionFunc = [this](FileFormatVersion aVersion) { this->read(aVersion); }; + aVersion = parser.predictVersion(predictionFunc); } const size_t startOffset = ds.getCurrentOffset(); diff --git a/src/Primitives/PrimPolygon.hpp b/src/Primitives/PrimPolygon.hpp index 1e9fc4ac..bf8c2fce 100644 --- a/src/Primitives/PrimPolygon.hpp +++ b/src/Primitives/PrimPolygon.hpp @@ -1,7 +1,6 @@ #ifndef PRIMPOLYGON_HPP #define PRIMPOLYGON_HPP - #include #include #include @@ -18,14 +17,18 @@ #include "Primitives/Point.hpp" #include "Primitives/PrimBase.hpp" - class PrimPolygon : public PrimBase { public: - - PrimPolygon(StreamContext& aCtx) : PrimBase{aCtx}, mLineStyle{}, mLineWidth{}, - fillStyle{}, hatchStyle{}, points{} - { } + PrimPolygon(StreamContext& aCtx) + : PrimBase{aCtx}, + mLineStyle{}, + mLineWidth{}, + fillStyle{}, + hatchStyle{}, + points{} + { + } std::string to_string() const override; @@ -64,21 +67,17 @@ class PrimPolygon : public PrimBase } private: - std::optional mLineStyle; std::optional mLineWidth; public: - FillStyle fillStyle; HatchStyle hatchStyle; std::vector points; }; - -[[maybe_unused]] -static std::string to_string(const PrimPolygon& aObj) +[[maybe_unused]] static std::string to_string(const PrimPolygon& aObj) { std::string str; @@ -97,19 +96,15 @@ static std::string to_string(const PrimPolygon& aObj) return str; } - inline std::string PrimPolygon::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const PrimPolygon& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const PrimPolygon& aVal) { aOs << to_string(aVal); return aOs; } - #endif // PRIMPOLYGON_HPP \ No newline at end of file diff --git a/src/Primitives/PrimPolyline.cpp b/src/Primitives/PrimPolyline.cpp index fd2c73bd..d3512035 100644 --- a/src/Primitives/PrimPolyline.cpp +++ b/src/Primitives/PrimPolyline.cpp @@ -10,7 +10,6 @@ #include "GenericParser.hpp" #include "Primitives/PrimPolyline.hpp" - size_t PrimPolyline::getExpectedStructSize(FileFormatVersion aVersion, size_t aPointCount) { size_t expectedByteLength; @@ -27,7 +26,6 @@ size_t PrimPolyline::getExpectedStructSize(FileFormatVersion aVersion, size_t aP return expectedByteLength; } - void PrimPolyline::read(FileFormatVersion aVersion) { auto& ds = mCtx.mDs; @@ -37,8 +35,8 @@ void PrimPolyline::read(FileFormatVersion aVersion) if(aVersion == FileFormatVersion::Unknown) { - const auto predictionFunc = [this](FileFormatVersion aVersion){ this->read(aVersion); }; - aVersion = parser.predictVersion(predictionFunc); + const auto predictionFunc = [this](FileFormatVersion aVersion) { this->read(aVersion); }; + aVersion = parser.predictVersion(predictionFunc); } const size_t startOffset = ds.getCurrentOffset(); @@ -59,8 +57,8 @@ void PrimPolyline::read(FileFormatVersion aVersion) if(pointCount < 2) { - throw std::runtime_error("At minimum 2 'PolylinePoint's must occur but got " + std::to_string(pointCount) - + " points!"); + throw std::runtime_error( + "At minimum 2 'PolylinePoint's must occur but got " + std::to_string(pointCount) + " points!"); } for(size_t i = 0u; i < pointCount; ++i) diff --git a/src/Primitives/PrimPolyline.hpp b/src/Primitives/PrimPolyline.hpp index 36b55bfd..8f428693 100644 --- a/src/Primitives/PrimPolyline.hpp +++ b/src/Primitives/PrimPolyline.hpp @@ -1,7 +1,6 @@ #ifndef PRIMPOLYLINE_HPP #define PRIMPOLYLINE_HPP - #include #include #include @@ -16,13 +15,16 @@ #include "Primitives/Point.hpp" #include "Primitives/PrimBase.hpp" - class PrimPolyline : public PrimBase { public: - - PrimPolyline(StreamContext& aCtx) : PrimBase{aCtx}, mLineStyle{}, mLineWidth{}, points{} - { } + PrimPolyline(StreamContext& aCtx) + : PrimBase{aCtx}, + mLineStyle{}, + mLineWidth{}, + points{} + { + } std::string to_string() const override; @@ -61,18 +63,14 @@ class PrimPolyline : public PrimBase } private: - std::optional mLineStyle; std::optional mLineWidth; public: - std::vector points; }; - -[[maybe_unused]] -static std::string to_string(const PrimPolyline& aObj) +[[maybe_unused]] static std::string to_string(const PrimPolyline& aObj) { std::string str; @@ -89,19 +87,15 @@ static std::string to_string(const PrimPolyline& aObj) return str; } - inline std::string PrimPolyline::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const PrimPolyline& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const PrimPolyline& aVal) { aOs << to_string(aVal); return aOs; } - #endif // PRIMPOLYLINE_HPP \ No newline at end of file diff --git a/src/Primitives/PrimRect.cpp b/src/Primitives/PrimRect.cpp index dd3805ea..39948cd9 100644 --- a/src/Primitives/PrimRect.cpp +++ b/src/Primitives/PrimRect.cpp @@ -13,7 +13,6 @@ #include "GenericParser.hpp" #include "Primitives/PrimRect.hpp" - size_t PrimRect::getExpectedStructSize(FileFormatVersion aVersion) { size_t expectedByteLength; @@ -34,7 +33,6 @@ size_t PrimRect::getExpectedStructSize(FileFormatVersion aVersion) return expectedByteLength; } - void PrimRect::read(FileFormatVersion aVersion) { auto& ds = mCtx.mDs; @@ -44,8 +42,8 @@ void PrimRect::read(FileFormatVersion aVersion) if(aVersion == FileFormatVersion::Unknown) { - const auto predictionFunc = [this](FileFormatVersion aVersion){ this->read(aVersion); }; - aVersion = parser.predictVersion(predictionFunc); + const auto predictionFunc = [this](FileFormatVersion aVersion) { this->read(aVersion); }; + aVersion = parser.predictVersion(predictionFunc); } const size_t startOffset = ds.getCurrentOffset(); diff --git a/src/Primitives/PrimRect.hpp b/src/Primitives/PrimRect.hpp index 41cfb2b1..b775b903 100644 --- a/src/Primitives/PrimRect.hpp +++ b/src/Primitives/PrimRect.hpp @@ -1,7 +1,6 @@ #ifndef PRIMRECT_HPP #define PRIMRECT_HPP - #include #include #include @@ -18,13 +17,21 @@ #include "Primitives/Point.hpp" #include "Primitives/PrimBase.hpp" - class PrimRect : public PrimBase { public: - PrimRect(StreamContext& aCtx) : PrimBase{aCtx}, x1{0}, y1{0}, x2{0}, y2{0}, - mLineStyle{}, mLineWidth{}, fillStyle{}, hatchStyle{} - { } + PrimRect(StreamContext& aCtx) + : PrimBase{aCtx}, + x1{0}, + y1{0}, + x2{0}, + y2{0}, + mLineStyle{}, + mLineWidth{}, + fillStyle{}, + hatchStyle{} + { + } std::string to_string() const override; @@ -69,19 +76,15 @@ class PrimRect : public PrimBase int32_t y2; private: - std::optional mLineStyle; std::optional mLineWidth; public: - FillStyle fillStyle; HatchStyle hatchStyle; }; - -[[maybe_unused]] -static std::string to_string(const PrimRect& aObj) +[[maybe_unused]] static std::string to_string(const PrimRect& aObj) { std::string str; @@ -98,20 +101,16 @@ static std::string to_string(const PrimRect& aObj) return str; } - inline std::string PrimRect::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const PrimRect& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const PrimRect& aVal) { aOs << to_string(aVal); return aOs; } - #endif // PRIMRECT_HPP \ No newline at end of file diff --git a/src/Primitives/PrimSymbolVector.cpp b/src/Primitives/PrimSymbolVector.cpp index d2eca19c..d13530fb 100644 --- a/src/Primitives/PrimSymbolVector.cpp +++ b/src/Primitives/PrimSymbolVector.cpp @@ -12,7 +12,6 @@ #include "GenericParser.hpp" #include "Primitives/PrimSymbolVector.hpp" - void PrimSymbolVector::read(FileFormatVersion /* aVersion */) { auto& ds = mCtx.mDs; @@ -21,13 +20,13 @@ void PrimSymbolVector::read(FileFormatVersion /* aVersion */) mCtx.mLogger.debug(getOpeningMsg(getMethodName(this, __func__), ds.getCurrentOffset())); const auto readSmallPrefixPrimitive = [&, this]() -> Primitive - { - Primitive primitive = ToPrimitive(ds.readUint8()); - ds.assumeData({0x00}, getMethodName(this, __func__) + ": 0"); - ds.assumeData({static_cast(primitive)}, getMethodName(this, __func__) + ": 1"); + { + Primitive primitive = ToPrimitive(ds.readUint8()); + ds.assumeData({0x00}, getMethodName(this, __func__) + ": 0"); + ds.assumeData({static_cast(primitive)}, getMethodName(this, __func__) + ": 1"); - return primitive; - }; + return primitive; + }; FutureDataLst localFutureLst{mCtx}; @@ -52,9 +51,8 @@ void PrimSymbolVector::read(FileFormatVersion /* aVersion */) name = ds.readStringLenZeroTerm(); // @todo contains smallPrefixPrimitive - // ds.assumeData({0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x32, 0x00, 0x00, 0x00, 0x02, 0x00}, getMethodName(this, __func__) + ": 2"); - // ds.printUnknownData(12, getMethodName(this, __func__) + ": 2"); - + // ds.assumeData({0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x32, 0x00, 0x00, 0x00, 0x02, 0x00}, getMethodName(this, + // __func__) + ": 2"); ds.printUnknownData(12, getMethodName(this, __func__) + ": 2"); mCtx.mLogger.debug(getClosingMsg(getMethodName(this, __func__), ds.getCurrentOffset())); mCtx.mLogger.trace(to_string()); diff --git a/src/Primitives/PrimSymbolVector.hpp b/src/Primitives/PrimSymbolVector.hpp index 01eb239a..0e5cf45b 100644 --- a/src/Primitives/PrimSymbolVector.hpp +++ b/src/Primitives/PrimSymbolVector.hpp @@ -1,7 +1,6 @@ #ifndef PRIMSYMBOLVECTOR_HPP #define PRIMSYMBOLVECTOR_HPP - #include #include #include @@ -12,13 +11,18 @@ #include "Primitives/PrimBase.hpp" - -class PrimSymbolVector : public PrimBase // @todo probably derive from PrimBase, s.t. we can add itself to primitives list +class PrimSymbolVector + : public PrimBase // @todo probably derive from PrimBase, s.t. we can add itself to primitives list { public: - - PrimSymbolVector(StreamContext& aCtx) : PrimBase{aCtx}, locX{0}, locY{0}, name{}, primitives{} - { } + PrimSymbolVector(StreamContext& aCtx) + : PrimBase{aCtx}, + locX{0}, + locY{0}, + name{}, + primitives{} + { + } std::string to_string() const override; @@ -45,9 +49,7 @@ class PrimSymbolVector : public PrimBase // @todo probably derive from PrimBase, std::vector primitives; }; - -[[maybe_unused]] -static std::string to_string(const PrimSymbolVector& aObj) +[[maybe_unused]] static std::string to_string(const PrimSymbolVector& aObj) { std::string str; @@ -65,20 +67,16 @@ static std::string to_string(const PrimSymbolVector& aObj) return str; } - inline std::string PrimSymbolVector::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const PrimSymbolVector& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const PrimSymbolVector& aVal) { aOs << to_string(aVal); return aOs; } - #endif // PRIMSYMBOLVECTOR_HPP \ No newline at end of file diff --git a/src/Record.hpp b/src/Record.hpp index 9aace785..9a6bc548 100644 --- a/src/Record.hpp +++ b/src/Record.hpp @@ -1,22 +1,23 @@ #ifndef RECORD_HPP #define RECORD_HPP - #include #include "Enums/Structure.hpp" #include "General.hpp" #include "StreamContext.hpp" - class Base { public: - Base(StreamContext& aCtx) : mCtx{aCtx} - { } + Base(StreamContext& aCtx) + : mCtx{aCtx} + { + } virtual ~Base() - { } + { + } virtual std::string to_string() const = 0; @@ -26,27 +27,29 @@ class Base StreamContext& mCtx; }; - class Record : public Base { public: - Record(StreamContext& aCtx) : Base{aCtx} - { } + Record(StreamContext& aCtx) + : Base{aCtx} + { + } virtual ~Record() - { } + { + } virtual Structure getObjectType() const = 0; }; - // Base class for structures that do not belong to Objects or Primitives class Other : public Base { public: - Other(StreamContext& aCtx) : Base{aCtx} - { } + Other(StreamContext& aCtx) + : Base{aCtx} + { + } }; - #endif // RECORD_HPP \ No newline at end of file diff --git a/src/RecordFactory.cpp b/src/RecordFactory.cpp index 52c6d792..da25a2d8 100644 --- a/src/RecordFactory.cpp +++ b/src/RecordFactory.cpp @@ -67,59 +67,145 @@ #include "Structures/StructWireBus.hpp" #include "Structures/StructWireScalar.hpp" - std::unique_ptr RecordFactory::build(StreamContext& aCtx, Structure aStructure) { switch(aStructure) { - case Structure::Alias: return std::make_unique(aCtx); break; - case Structure::BookMarkSymbolInst: return std::make_unique(aCtx); break; - case Structure::BusEntry: return std::make_unique(aCtx); break; - case Structure::Device: return std::make_unique(aCtx); break; - case Structure::ERCObject: return std::make_unique(aCtx); break; - case Structure::ERCSymbol: return std::make_unique(aCtx); break; - case Structure::Global: return std::make_unique(aCtx); break; - case Structure::GlobalSymbol: return std::make_unique(aCtx); break; - case Structure::GraphicArcInst: return std::make_unique(aCtx); break; - case Structure::GraphicBezierInst: return std::make_unique(aCtx); break; - case Structure::GraphicBitMapInst: return std::make_unique(aCtx); break; - case Structure::GraphicBoxInst: return std::make_unique(aCtx); break; - case Structure::GraphicCommentTextInst: return std::make_unique(aCtx); break; - case Structure::GraphicEllipseInst: return std::make_unique(aCtx); break; - case Structure::GraphicLineInst: return std::make_unique(aCtx); break; - case Structure::GraphicOleEmbedInst: return std::make_unique(aCtx); break; - case Structure::GraphicPolygonInst: return std::make_unique(aCtx); break; - case Structure::GraphicPolylineInst: return std::make_unique(aCtx); break; - case Structure::LibraryPart: return std::make_unique(aCtx); break; - case Structure::NetDbIdMapping: return std::make_unique(aCtx); break; - case Structure::OffPageConnector: return std::make_unique(aCtx); break; - case Structure::OffPageSymbol: return std::make_unique(aCtx); break; - case Structure::Package: return std::make_unique(aCtx); break; - case Structure::PartCell: return std::make_unique(aCtx); break; - case Structure::PinShapeSymbol: return std::make_unique(aCtx); break; - case Structure::PlacedInstance: return std::make_unique(aCtx); break; - case Structure::Port: return std::make_unique(aCtx); break; - case Structure::PortSymbol: return std::make_unique(aCtx); break; - case Structure::SthInHierarchy1: return std::make_unique(aCtx); break; - case Structure::SthInHierarchy2: return std::make_unique(aCtx); break; - case Structure::SthInHierarchy3: return std::make_unique(aCtx); break; - case Structure::SthInPages0: return std::make_unique(aCtx); break; - case Structure::SymbolDisplayProp: return std::make_unique(aCtx); break; - case Structure::SymbolPinBus: return std::make_unique(aCtx); break; - case Structure::SymbolPinScalar: return std::make_unique(aCtx); break; - case Structure::T0x10: return std::make_unique(aCtx); break; - case Structure::T0x34: return std::make_unique(aCtx); break; - case Structure::T0x35: return std::make_unique(aCtx); break; - case Structure::T0x45: return std::make_unique(aCtx); break; - case Structure::T0x5b: return std::make_unique(aCtx); break; - case Structure::TitleBlock: return std::make_unique(aCtx); break; - case Structure::TitleBlockSymbol: return std::make_unique(aCtx); break; - case Structure::WireBus: return std::make_unique(aCtx); break; - case Structure::WireScalar: return std::make_unique(aCtx); break; + case Structure::Alias: + return std::make_unique(aCtx); + break; + case Structure::BookMarkSymbolInst: + return std::make_unique(aCtx); + break; + case Structure::BusEntry: + return std::make_unique(aCtx); + break; + case Structure::Device: + return std::make_unique(aCtx); + break; + case Structure::ERCObject: + return std::make_unique(aCtx); + break; + case Structure::ERCSymbol: + return std::make_unique(aCtx); + break; + case Structure::Global: + return std::make_unique(aCtx); + break; + case Structure::GlobalSymbol: + return std::make_unique(aCtx); + break; + case Structure::GraphicArcInst: + return std::make_unique(aCtx); + break; + case Structure::GraphicBezierInst: + return std::make_unique(aCtx); + break; + case Structure::GraphicBitMapInst: + return std::make_unique(aCtx); + break; + case Structure::GraphicBoxInst: + return std::make_unique(aCtx); + break; + case Structure::GraphicCommentTextInst: + return std::make_unique(aCtx); + break; + case Structure::GraphicEllipseInst: + return std::make_unique(aCtx); + break; + case Structure::GraphicLineInst: + return std::make_unique(aCtx); + break; + case Structure::GraphicOleEmbedInst: + return std::make_unique(aCtx); + break; + case Structure::GraphicPolygonInst: + return std::make_unique(aCtx); + break; + case Structure::GraphicPolylineInst: + return std::make_unique(aCtx); + break; + case Structure::LibraryPart: + return std::make_unique(aCtx); + break; + case Structure::NetDbIdMapping: + return std::make_unique(aCtx); + break; + case Structure::OffPageConnector: + return std::make_unique(aCtx); + break; + case Structure::OffPageSymbol: + return std::make_unique(aCtx); + break; + case Structure::Package: + return std::make_unique(aCtx); + break; + case Structure::PartCell: + return std::make_unique(aCtx); + break; + case Structure::PinShapeSymbol: + return std::make_unique(aCtx); + break; + case Structure::PlacedInstance: + return std::make_unique(aCtx); + break; + case Structure::Port: + return std::make_unique(aCtx); + break; + case Structure::PortSymbol: + return std::make_unique(aCtx); + break; + case Structure::SthInHierarchy1: + return std::make_unique(aCtx); + break; + case Structure::SthInHierarchy2: + return std::make_unique(aCtx); + break; + case Structure::SthInHierarchy3: + return std::make_unique(aCtx); + break; + case Structure::SthInPages0: + return std::make_unique(aCtx); + break; + case Structure::SymbolDisplayProp: + return std::make_unique(aCtx); + break; + case Structure::SymbolPinBus: + return std::make_unique(aCtx); + break; + case Structure::SymbolPinScalar: + return std::make_unique(aCtx); + break; + case Structure::T0x10: + return std::make_unique(aCtx); + break; + case Structure::T0x34: + return std::make_unique(aCtx); + break; + case Structure::T0x35: + return std::make_unique(aCtx); + break; + case Structure::T0x45: + return std::make_unique(aCtx); + break; + case Structure::T0x5b: + return std::make_unique(aCtx); + break; + case Structure::TitleBlock: + return std::make_unique(aCtx); + break; + case Structure::TitleBlockSymbol: + return std::make_unique(aCtx); + break; + case Structure::WireBus: + return std::make_unique(aCtx); + break; + case Structure::WireScalar: + return std::make_unique(aCtx); + break; default: { - const std::string errMsg = fmt::format( - "RecordFactory can not yet build {}", to_string(aStructure)); + const std::string errMsg = fmt::format("RecordFactory can not yet build {}", to_string(aStructure)); aCtx.mLogger.error(errMsg); } } @@ -127,25 +213,43 @@ std::unique_ptr RecordFactory::build(StreamContext& aCtx, Structure aStr return std::unique_ptr{}; } - std::unique_ptr RecordFactory::build(StreamContext& aCtx, Primitive aPrimitive) { switch(aPrimitive) { - case Primitive::Rect: return std::make_unique(aCtx); break; - case Primitive::Line: return std::make_unique(aCtx); break; - case Primitive::Arc: return std::make_unique(aCtx); break; - case Primitive::Ellipse: return std::make_unique(aCtx); break; - case Primitive::Polygon: return std::make_unique(aCtx); break; - case Primitive::Polyline: return std::make_unique(aCtx); break; - case Primitive::CommentText: return std::make_unique(aCtx); break; - case Primitive::Bitmap: return std::make_unique(aCtx); break; - case Primitive::SymbolVector: return std::make_unique(aCtx); break; - case Primitive::Bezier: return std::make_unique(aCtx); break; + case Primitive::Rect: + return std::make_unique(aCtx); + break; + case Primitive::Line: + return std::make_unique(aCtx); + break; + case Primitive::Arc: + return std::make_unique(aCtx); + break; + case Primitive::Ellipse: + return std::make_unique(aCtx); + break; + case Primitive::Polygon: + return std::make_unique(aCtx); + break; + case Primitive::Polyline: + return std::make_unique(aCtx); + break; + case Primitive::CommentText: + return std::make_unique(aCtx); + break; + case Primitive::Bitmap: + return std::make_unique(aCtx); + break; + case Primitive::SymbolVector: + return std::make_unique(aCtx); + break; + case Primitive::Bezier: + return std::make_unique(aCtx); + break; default: { - const std::string errMsg = fmt::format( - "RecordFactory can not yet build {}", to_string(aPrimitive)); + const std::string errMsg = fmt::format("RecordFactory can not yet build {}", to_string(aPrimitive)); aCtx.mLogger.error(errMsg); } } diff --git a/src/RecordFactory.hpp b/src/RecordFactory.hpp index 8d27d2bb..3960c7cc 100644 --- a/src/RecordFactory.hpp +++ b/src/RecordFactory.hpp @@ -1,7 +1,6 @@ #ifndef RECORDFACTORY_HPP #define RECORDFACTORY_HPP - #include #include "Enums/Primitive.hpp" @@ -10,7 +9,6 @@ #include "Record.hpp" #include "StreamContext.hpp" - class RecordFactory { public: @@ -18,5 +16,4 @@ class RecordFactory static std::unique_ptr build(StreamContext& aCtx, Primitive aPrimitive); }; - #endif // RECORDFACTORY_HPP \ No newline at end of file diff --git a/src/Stream.hpp b/src/Stream.hpp index f6ff1e62..ea9b105f 100644 --- a/src/Stream.hpp +++ b/src/Stream.hpp @@ -1,7 +1,6 @@ #ifndef STREAM_HPP #define STREAM_HPP - #include #include #include @@ -18,15 +17,17 @@ #include "General.hpp" #include "Record.hpp" - class Stream { public: - Stream(ContainerContext& aCtx, const fs::path& aInputStream) : mCtx{aCtx, aInputStream} - { } + Stream(ContainerContext& aCtx, const fs::path& aInputStream) + : mCtx{aCtx, aInputStream} + { + } virtual ~Stream() - { } + { + } virtual std::string to_string() const = 0; @@ -55,7 +56,8 @@ class Stream catch(const std::exception& e) { mCtx.mLogger.error(fmt::format(fg(fmt::color::crimson), "--------ERROR REPORT--------")); - mCtx.mLogger.error(fmt::format(fg(fmt::color::crimson), "Input Container: {}", mCtx.mInputCfbfFile.string())); + mCtx.mLogger.error( + fmt::format(fg(fmt::color::crimson), "Input Container: {}", mCtx.mInputCfbfFile.string())); mCtx.mLogger.error(fmt::format(fg(fmt::color::crimson), "Current File: {}", mCtx.mInputStream.string())); mCtx.mLogger.error(fmt::format(fg(fmt::color::crimson), mCtx.mDs.getCurrentOffsetStrMsg())); mCtx.mLogger.error(fmt::format(fg(fmt::color::crimson), "\nError Message: {}\n\n", e.what())); @@ -69,9 +71,8 @@ class Stream virtual StreamType getStreamType() const = 0; -// protected: + // protected: StreamContext mCtx; }; - #endif // STREAM_HPP \ No newline at end of file diff --git a/src/StreamContext.hpp b/src/StreamContext.hpp index 4260afd4..cbed7619 100644 --- a/src/StreamContext.hpp +++ b/src/StreamContext.hpp @@ -1,7 +1,6 @@ #ifndef STREAMCONTEXT_HPP #define STREAMCONTEXT_HPP - #include #include #include @@ -17,30 +16,26 @@ #include "General.hpp" // #include "Stream.hpp" - class Stream; - namespace fs = std::filesystem; - class StreamContext : public ContainerContext { public: - StreamContext(const ContainerContext& aCtx, const fs::path& aInputStream) - : ContainerContext{aCtx}, mInputStream{aInputStream}, mCfbfStreamLocation{mInputStream, mExtractedCfbfPath}, + : ContainerContext{aCtx}, + mInputStream{aInputStream}, + mCfbfStreamLocation{mInputStream, mExtractedCfbfPath}, mDs{aInputStream, *this} { - mImgCtr = 0U; - mAttemptedParsing = false; + mImgCtr = 0U; + mAttemptedParsing = false; mParsedSuccessfully = std::nullopt; // Create stream specific logger - const fs::path logPath{ - mExtractedCfbfPath.parent_path() / "logs" - / mInputCfbfFile.filename() - / mCfbfStreamLocation.get_relative_fs_path().concat(".log")}; + const fs::path logPath{mExtractedCfbfPath.parent_path() / "logs" / mInputCfbfFile.filename() / + mCfbfStreamLocation.get_relative_fs_path().concat(".log")}; configureLogger(logPath); } @@ -62,5 +57,4 @@ class StreamContext : public ContainerContext std::optional mParsedSuccessfully; }; - #endif // STREAMCONTEXT_HPP \ No newline at end of file diff --git a/src/StreamFactory.cpp b/src/StreamFactory.cpp index 8448e9b3..2212dcb0 100644 --- a/src/StreamFactory.cpp +++ b/src/StreamFactory.cpp @@ -13,11 +13,11 @@ #include "Streams/StreamAdminData.hpp" #include "Streams/StreamBOMDataStream.hpp" #include "Streams/StreamCache.hpp" +#include "Streams/StreamDTypeD.hpp" #include "Streams/StreamDirectoryStruct.hpp" #include "Streams/StreamDsnStream.hpp" -#include "Streams/StreamDTypeD.hpp" -#include "Streams/StreamHierarchy.hpp" #include "Streams/StreamHSObjects.hpp" +#include "Streams/StreamHierarchy.hpp" #include "Streams/StreamLibrary.hpp" #include "Streams/StreamNetBundleMapData.hpp" #include "Streams/StreamPackage.hpp" @@ -25,27 +25,25 @@ #include "Streams/StreamSchematic.hpp" #include "Streams/StreamSymbol.hpp" - std::unique_ptr StreamFactory::build(ContainerContext& aCtx, const fs::path& aInputStream) { auto streamLoc = CfbfStreamLocation{aInputStream, aCtx.mExtractedCfbfPath}; aCtx.mLogger.debug("Got stream location: {}", ::to_string(streamLoc)); - const auto getErrMsg = [](const std::vector>& aPattern, const CfbfStreamLocation& aStreamLoc) - { - std::string strPattern{}; + const auto getErrMsg = + [](const std::vector>& aPattern, const CfbfStreamLocation& aStreamLoc) + { + std::string strPattern{}; - for(const auto& part : aPattern) - { - strPattern += "/" + part.value_or("*"); - } + for(const auto& part : aPattern) + { + strPattern += "/" + part.value_or("*"); + } - return fmt::format( - "Detected `{}` matching `{}` but stream parser is not yet implemented!", - ::to_string(aStreamLoc), strPattern - ); - }; + return fmt::format("Detected `{}` matching `{}` but stream parser is not yet implemented!", + ::to_string(aStreamLoc), strPattern); + }; std::vector> pattern; @@ -317,10 +315,8 @@ std::unique_ptr StreamFactory::build(ContainerContext& aCtx, const fs::p return std::make_unique(aCtx, aInputStream); } - const std::string errMsg = fmt::format( - "Didn't find a suitable stream parser for stream location `{}`", - ::to_string(streamLoc) - ); + const std::string errMsg = + fmt::format("Didn't find a suitable stream parser for stream location `{}`", ::to_string(streamLoc)); aCtx.mLogger.warn(errMsg); diff --git a/src/StreamFactory.hpp b/src/StreamFactory.hpp index f50ada30..80793220 100644 --- a/src/StreamFactory.hpp +++ b/src/StreamFactory.hpp @@ -1,19 +1,16 @@ #ifndef STREAMFACTORY_HPP #define STREAMFACTORY_HPP - #include #include #include "ContainerContext.hpp" #include "Stream.hpp" - class StreamFactory { public: static std::unique_ptr build(ContainerContext& aCtx, const fs::path& aInputStream); }; - #endif // STREAMFACTORY_HPP \ No newline at end of file diff --git a/src/Streams/StreamAdminData.cpp b/src/Streams/StreamAdminData.cpp index af4ddefa..7da2b655 100644 --- a/src/Streams/StreamAdminData.cpp +++ b/src/Streams/StreamAdminData.cpp @@ -7,7 +7,6 @@ #include "General.hpp" #include "Streams/StreamAdminData.hpp" - void StreamAdminData::read(FileFormatVersion /* aVersion */) { auto& ds = mCtx.mDs; @@ -22,8 +21,8 @@ void StreamAdminData::read(FileFormatVersion /* aVersion */) mCtx.mLogger.warn("{}: Found new value. Check it out!", getMethodName(this, __func__)); } - ds.assumeData({0x00, 0x00, 0x00, 0x00, 0x00}, - fmt::format("{}: Found actually useful data!", getMethodName(this, __func__))); + ds.assumeData( + {0x00, 0x00, 0x00, 0x00, 0x00}, fmt::format("{}: Found actually useful data!", getMethodName(this, __func__))); ds.sanitizeEoF(); diff --git a/src/Streams/StreamAdminData.hpp b/src/Streams/StreamAdminData.hpp index eac2a9cd..7e2cddf8 100644 --- a/src/Streams/StreamAdminData.hpp +++ b/src/Streams/StreamAdminData.hpp @@ -1,7 +1,6 @@ #ifndef STREAMADMINDATA_HPP #define STREAMADMINDATA_HPP - #include #include @@ -11,13 +10,13 @@ #include "General.hpp" #include "Stream.hpp" - class StreamAdminData : public Stream { public: - - StreamAdminData(ContainerContext& aCtx, const fs::path& aInputStream) : Stream{aCtx, aInputStream} - { } + StreamAdminData(ContainerContext& aCtx, const fs::path& aInputStream) + : Stream{aCtx, aInputStream} + { + } std::string to_string() const override; @@ -34,9 +33,7 @@ class StreamAdminData : public Stream } }; - -[[maybe_unused]] -static std::string to_string(const StreamAdminData& aObj) +[[maybe_unused]] static std::string to_string(const StreamAdminData& aObj) { std::string str; @@ -45,20 +42,16 @@ static std::string to_string(const StreamAdminData& aObj) return str; } - inline std::string StreamAdminData::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StreamAdminData& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StreamAdminData& aVal) { aOs << to_string(aVal); return aOs; } - #endif // STREAMADMINDATA_HPP \ No newline at end of file diff --git a/src/Streams/StreamBOMDataStream.cpp b/src/Streams/StreamBOMDataStream.cpp index d5ba77b0..2ee764ad 100644 --- a/src/Streams/StreamBOMDataStream.cpp +++ b/src/Streams/StreamBOMDataStream.cpp @@ -7,7 +7,6 @@ #include "General.hpp" #include "Streams/StreamBOMDataStream.hpp" - void StreamBOMDataStream::read(FileFormatVersion /* aVersion */) { auto& ds = mCtx.mDs; @@ -45,8 +44,7 @@ void StreamBOMDataStream::read(FileFormatVersion /* aVersion */) { tmpStr += static_cast(byte); } - } - while(!ds.isEoF() && byte != MAGIC_NEXT_STRING_IDENTIFIER); + } while(!ds.isEoF() && byte != MAGIC_NEXT_STRING_IDENTIFIER); strings.push_back(tmpStr); mCtx.mLogger.trace("strings[{}] = `{}`", strings.size() - 1, strings.back()); diff --git a/src/Streams/StreamBOMDataStream.hpp b/src/Streams/StreamBOMDataStream.hpp index 27445e2d..0cc76b72 100644 --- a/src/Streams/StreamBOMDataStream.hpp +++ b/src/Streams/StreamBOMDataStream.hpp @@ -1,7 +1,6 @@ #ifndef STREAMBOMDATASTREAM_HPP #define STREAMBOMDATASTREAM_HPP - #include #include @@ -11,13 +10,13 @@ #include "General.hpp" #include "Stream.hpp" - class StreamBOMDataStream : public Stream { public: - - StreamBOMDataStream(ContainerContext& aCtx, const fs::path& aInputStream) : Stream{aCtx, aInputStream} - { } + StreamBOMDataStream(ContainerContext& aCtx, const fs::path& aInputStream) + : Stream{aCtx, aInputStream} + { + } std::string to_string() const override; @@ -34,9 +33,7 @@ class StreamBOMDataStream : public Stream } }; - -[[maybe_unused]] -static std::string to_string(const StreamBOMDataStream& aObj) +[[maybe_unused]] static std::string to_string(const StreamBOMDataStream& aObj) { std::string str; @@ -45,20 +42,16 @@ static std::string to_string(const StreamBOMDataStream& aObj) return str; } - inline std::string StreamBOMDataStream::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StreamBOMDataStream& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StreamBOMDataStream& aVal) { aOs << to_string(aVal); return aOs; } - #endif // STREAMBOMDATASTREAM_HPP \ No newline at end of file diff --git a/src/Streams/StreamCache.cpp b/src/Streams/StreamCache.cpp index 462f7338..f5a7503d 100644 --- a/src/Streams/StreamCache.cpp +++ b/src/Streams/StreamCache.cpp @@ -9,7 +9,6 @@ #include "GenericParser.hpp" #include "Streams/StreamCache.hpp" - void StreamCache::read(FileFormatVersion /* aVersion */) { auto& ds = mCtx.mDs; @@ -17,11 +16,32 @@ void StreamCache::read(FileFormatVersion /* aVersion */) mCtx.mLogger.debug(getOpeningMsg(getMethodName(this, __func__), ds.getCurrentOffset())); - const auto hasStrAfter0Byte = [&]() -> bool { return parser.tryRead([&](){ ds.readBytes(0U); ds.readStringLenZeroTerm(); }); }; - const auto hasStrAfter8Byte = [&]() -> bool { return parser.tryRead([&](){ ds.readBytes(8U); ds.readStringLenZeroTerm(); }); }; + const auto hasStrAfter0Byte = [&]() -> bool + { + return parser.tryRead( + [&]() + { + ds.readBytes(0U); + ds.readStringLenZeroTerm(); + }); + }; + const auto hasStrAfter8Byte = [&]() -> bool + { + return parser.tryRead( + [&]() + { + ds.readBytes(8U); + ds.readStringLenZeroTerm(); + }); + }; // Early out for empty caches - if(parser.tryRead([&](){ ds.readBytes(10U); ds.sanitizeEoF(); })) + if(parser.tryRead( + [&]() + { + ds.readBytes(10U); + ds.sanitizeEoF(); + })) { // 10 zero bytes ds.assumeData({0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, getMethodName(this, __func__) + ": 0"); @@ -80,13 +100,18 @@ void StreamCache::read(FileFormatVersion /* aVersion */) break; } - if(parser.tryRead([&](){ ds.readBytes(1U); ds.sanitizeEoF(); })) + if(parser.tryRead( + [&]() + { + ds.readBytes(1U); + ds.sanitizeEoF(); + })) { ds.printUnknownData(1U, "Unknown Byte before end"); break; } - const bool hasMysterious2Byte = !parser.tryRead([&](){ ds.readStringLenZeroTerm(); }); + const bool hasMysterious2Byte = !parser.tryRead([&]() { ds.readStringLenZeroTerm(); }); if(hasMysterious2Byte) { @@ -98,7 +123,7 @@ void StreamCache::read(FileFormatVersion /* aVersion */) mCtx.mLogger.trace("someStr[{}][{}] = {}", i, j, someStr); j++; - } while (someVal == 0x0U); + } while(someVal == 0x0U); if(ds.isEoF()) { diff --git a/src/Streams/StreamCache.hpp b/src/Streams/StreamCache.hpp index b1ac75eb..5f9f585e 100644 --- a/src/Streams/StreamCache.hpp +++ b/src/Streams/StreamCache.hpp @@ -1,7 +1,6 @@ #ifndef STREAMCACHE_HPP #define STREAMCACHE_HPP - #include #include @@ -11,13 +10,13 @@ #include "General.hpp" #include "Stream.hpp" - class StreamCache : public Stream { public: - - StreamCache(ContainerContext& aCtx, const fs::path& aInputStream) : Stream{aCtx, aInputStream} - { } + StreamCache(ContainerContext& aCtx, const fs::path& aInputStream) + : Stream{aCtx, aInputStream} + { + } std::string to_string() const override; @@ -34,9 +33,7 @@ class StreamCache : public Stream } }; - -[[maybe_unused]] -static std::string to_string(const StreamCache& aObj) +[[maybe_unused]] static std::string to_string(const StreamCache& aObj) { std::string str; @@ -45,20 +42,16 @@ static std::string to_string(const StreamCache& aObj) return str; } - inline std::string StreamCache::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StreamCache& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StreamCache& aVal) { aOs << to_string(aVal); return aOs; } - #endif // STREAMCACHE_HPP \ No newline at end of file diff --git a/src/Streams/StreamDTypeD.cpp b/src/Streams/StreamDTypeD.cpp index 22a9b878..74a8b7d6 100644 --- a/src/Streams/StreamDTypeD.cpp +++ b/src/Streams/StreamDTypeD.cpp @@ -7,7 +7,6 @@ #include "General.hpp" #include "Streams/StreamDTypeD.hpp" - void StreamDTypeD::read(FileFormatVersion /* aVersion */) { auto& ds = mCtx.mDs; @@ -19,7 +18,7 @@ void StreamDTypeD::read(FileFormatVersion /* aVersion */) { Type type; - type.name = ds.readStringLenZeroTerm(); + type.name = ds.readStringLenZeroTerm(); type.componentType = ToComponentType(ds.readUint16()); types.push_back(type); diff --git a/src/Streams/StreamDTypeD.hpp b/src/Streams/StreamDTypeD.hpp index 31e2d353..5054eca2 100644 --- a/src/Streams/StreamDTypeD.hpp +++ b/src/Streams/StreamDTypeD.hpp @@ -1,7 +1,6 @@ #ifndef STREAMDTYPED_HPP #define STREAMDTYPED_HPP - #include #include #include @@ -10,17 +9,18 @@ #include #include -#include "Stream.hpp" #include "Enums/ComponentType.hpp" - +#include "Stream.hpp" // @note This is used in `$Type$` files class Type { public: - - Type() : name{}, componentType{ComponentType::Graphic} - { } + Type() + : name{}, + componentType{ComponentType::Graphic} + { + } std::string to_string() const; @@ -28,9 +28,7 @@ class Type ComponentType componentType; }; - -[[maybe_unused]] -static std::string to_string(const Type& aObj) +[[maybe_unused]] static std::string to_string(const Type& aObj) { std::string str; @@ -41,28 +39,26 @@ static std::string to_string(const Type& aObj) return str; } - inline std::string Type::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const Type& aObj) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const Type& aObj) { aOs << to_string(aObj); return aOs; } - class StreamDTypeD : public Stream { public: - - StreamDTypeD(ContainerContext& aCtx, const fs::path& aInputStream) : Stream{aCtx, aInputStream}, types{} - { } + StreamDTypeD(ContainerContext& aCtx, const fs::path& aInputStream) + : Stream{aCtx, aInputStream}, + types{} + { + } std::string to_string() const override; @@ -81,9 +77,7 @@ class StreamDTypeD : public Stream std::vector types; }; - -[[maybe_unused]] -static std::string to_string(const StreamDTypeD& aObj) +[[maybe_unused]] static std::string to_string(const StreamDTypeD& aObj) { std::string str; @@ -99,20 +93,16 @@ static std::string to_string(const StreamDTypeD& aObj) return str; } - inline std::string StreamDTypeD::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StreamDTypeD& aObj) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StreamDTypeD& aObj) { aOs << to_string(aObj); return aOs; } - #endif // STREAMDTYPED_HPP \ No newline at end of file diff --git a/src/Streams/StreamDirectoryStruct.cpp b/src/Streams/StreamDirectoryStruct.cpp index 8efcd7e6..e135b69a 100644 --- a/src/Streams/StreamDirectoryStruct.cpp +++ b/src/Streams/StreamDirectoryStruct.cpp @@ -8,7 +8,6 @@ #include "General.hpp" #include "Streams/StreamDirectoryStruct.hpp" - void StreamDirectoryStruct::read(FileFormatVersion /* aVersion */) { auto& ds = mCtx.mDs; @@ -45,14 +44,11 @@ void StreamDirectoryStruct::read(FileFormatVersion /* aVersion */) // Known versions that I observed in different files // 471 in 17.4-2019 S012 (3898062) [10/18/202] // 472 in 17.4-2019 S019 (3959056) [7/8/2021] - std::vector knownFileVersions{ - 445, 446, 447, 448, 449, - 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, - 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, - 470, 471, 472 - }; - - if(!std::any_of(knownFileVersions.begin(), knownFileVersions.end(), [&](unsigned version){ return version == item.fileFormatVersion; })) + std::vector knownFileVersions{445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, + 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472}; + + if(!std::any_of(knownFileVersions.begin(), knownFileVersions.end(), + [&](unsigned version) { return version == item.fileFormatVersion; })) { mCtx.mLogger.warn("Unexpected File Version {}", item.fileFormatVersion); } diff --git a/src/Streams/StreamDirectoryStruct.hpp b/src/Streams/StreamDirectoryStruct.hpp index 9923db72..e75a14c5 100644 --- a/src/Streams/StreamDirectoryStruct.hpp +++ b/src/Streams/StreamDirectoryStruct.hpp @@ -1,7 +1,6 @@ #ifndef STREAMDIRECTORYSTRUCT_HPP #define STREAMDIRECTORYSTRUCT_HPP - #include #include #include @@ -14,14 +13,16 @@ #include "General.hpp" #include "Stream.hpp" - class DirItemType { public: - - DirItemType() : name{}, componentType{ComponentType::Graphic}, - fileFormatVersion{0}, timezone{0} - { } + DirItemType() + : name{}, + componentType{ComponentType::Graphic}, + fileFormatVersion{0}, + timezone{0} + { + } std::string to_string() const; @@ -34,9 +35,7 @@ class DirItemType int16_t timezone; //!< Refer to http://time.unitarium.com/military/ for more details. }; - -[[maybe_unused]] -static std::string to_string(const DirItemType& aObj) +[[maybe_unused]] static std::string to_string(const DirItemType& aObj) { std::string str; @@ -48,22 +47,18 @@ static std::string to_string(const DirItemType& aObj) return str; } - inline std::string DirItemType::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const DirItemType& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const DirItemType& aVal) { aOs << to_string(aVal); return aOs; } - // Used to parse // - `Cells Directory` // - `ExportBlocks Directory` @@ -75,10 +70,12 @@ static std::ostream& operator<<(std::ostream& aOs, const DirItemType& aVal) class StreamDirectoryStruct : public Stream { public: - - StreamDirectoryStruct(ContainerContext& aCtx, const fs::path& aInputStream) : Stream{aCtx, aInputStream}, - lastModifiedDate{0}, items{} - { } + StreamDirectoryStruct(ContainerContext& aCtx, const fs::path& aInputStream) + : Stream{aCtx, aInputStream}, + lastModifiedDate{0}, + items{} + { + } std::string to_string() const override; @@ -94,9 +91,7 @@ class StreamDirectoryStruct : public Stream std::vector items; }; - -[[maybe_unused]] -static std::string to_string(const StreamDirectoryStruct& aObj) +[[maybe_unused]] static std::string to_string(const StreamDirectoryStruct& aObj) { std::string str; @@ -112,26 +107,24 @@ static std::string to_string(const StreamDirectoryStruct& aObj) return str; } - inline std::string StreamDirectoryStruct::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StreamDirectoryStruct& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StreamDirectoryStruct& aVal) { aOs << to_string(aVal); return aOs; } - class StreamCellsDirectory : public StreamDirectoryStruct { public: - StreamCellsDirectory(ContainerContext& aCtx, const fs::path& aInputStream) : StreamDirectoryStruct{aCtx, aInputStream} - { } + StreamCellsDirectory(ContainerContext& aCtx, const fs::path& aInputStream) + : StreamDirectoryStruct{aCtx, aInputStream} + { + } virtual StreamType getStreamType() const override { @@ -142,8 +135,10 @@ class StreamCellsDirectory : public StreamDirectoryStruct class StreamExportBlocksDirectory : public StreamDirectoryStruct { public: - StreamExportBlocksDirectory(ContainerContext& aCtx, const fs::path& aInputStream) : StreamDirectoryStruct{aCtx, aInputStream} - { } + StreamExportBlocksDirectory(ContainerContext& aCtx, const fs::path& aInputStream) + : StreamDirectoryStruct{aCtx, aInputStream} + { + } virtual StreamType getStreamType() const override { @@ -154,8 +149,10 @@ class StreamExportBlocksDirectory : public StreamDirectoryStruct class StreamGraphicsDirectory : public StreamDirectoryStruct { public: - StreamGraphicsDirectory(ContainerContext& aCtx, const fs::path& aInputStream) : StreamDirectoryStruct{aCtx, aInputStream} - { } + StreamGraphicsDirectory(ContainerContext& aCtx, const fs::path& aInputStream) + : StreamDirectoryStruct{aCtx, aInputStream} + { + } virtual StreamType getStreamType() const override { @@ -166,8 +163,10 @@ class StreamGraphicsDirectory : public StreamDirectoryStruct class StreamPackagesDirectory : public StreamDirectoryStruct { public: - StreamPackagesDirectory(ContainerContext& aCtx, const fs::path& aInputStream) : StreamDirectoryStruct{aCtx, aInputStream} - { } + StreamPackagesDirectory(ContainerContext& aCtx, const fs::path& aInputStream) + : StreamDirectoryStruct{aCtx, aInputStream} + { + } virtual StreamType getStreamType() const override { @@ -178,8 +177,10 @@ class StreamPackagesDirectory : public StreamDirectoryStruct class StreamPartsDirectory : public StreamDirectoryStruct { public: - StreamPartsDirectory(ContainerContext& aCtx, const fs::path& aInputStream) : StreamDirectoryStruct{aCtx, aInputStream} - { } + StreamPartsDirectory(ContainerContext& aCtx, const fs::path& aInputStream) + : StreamDirectoryStruct{aCtx, aInputStream} + { + } virtual StreamType getStreamType() const override { @@ -190,8 +191,10 @@ class StreamPartsDirectory : public StreamDirectoryStruct class StreamSymbolsDirectory : public StreamDirectoryStruct { public: - StreamSymbolsDirectory(ContainerContext& aCtx, const fs::path& aInputStream) : StreamDirectoryStruct{aCtx, aInputStream} - { } + StreamSymbolsDirectory(ContainerContext& aCtx, const fs::path& aInputStream) + : StreamDirectoryStruct{aCtx, aInputStream} + { + } virtual StreamType getStreamType() const override { @@ -202,8 +205,10 @@ class StreamSymbolsDirectory : public StreamDirectoryStruct class StreamViewsDirectory : public StreamDirectoryStruct { public: - StreamViewsDirectory(ContainerContext& aCtx, const fs::path& aInputStream) : StreamDirectoryStruct{aCtx, aInputStream} - { } + StreamViewsDirectory(ContainerContext& aCtx, const fs::path& aInputStream) + : StreamDirectoryStruct{aCtx, aInputStream} + { + } virtual StreamType getStreamType() const override { @@ -211,5 +216,4 @@ class StreamViewsDirectory : public StreamDirectoryStruct } }; - #endif // STREAMDIRECTORYSTRUCT_HPP \ No newline at end of file diff --git a/src/Streams/StreamDsnStream.cpp b/src/Streams/StreamDsnStream.cpp index 3e3c3cb8..73be2f85 100644 --- a/src/Streams/StreamDsnStream.cpp +++ b/src/Streams/StreamDsnStream.cpp @@ -9,7 +9,6 @@ #include "GenericParser.hpp" #include "Streams/StreamDsnStream.hpp" - // @note Printing the content of this structure needs to be done after parsing // `Library`, because there are some references to the string lists. // I.e. parse `Library` first and later on `DsnStream` to avoid issues. diff --git a/src/Streams/StreamDsnStream.hpp b/src/Streams/StreamDsnStream.hpp index 626563e5..a68d98c0 100644 --- a/src/Streams/StreamDsnStream.hpp +++ b/src/Streams/StreamDsnStream.hpp @@ -1,23 +1,22 @@ #ifndef STREAMDSNSTREAM_HPP #define STREAMDSNSTREAM_HPP - #include #include #include #include -#include "Stream.hpp" #include "General.hpp" - +#include "Stream.hpp" class StreamDsnStream : public Stream { public: - - StreamDsnStream(ContainerContext& aCtx, const fs::path& aInputStream) : Stream{aCtx, aInputStream} - { } + StreamDsnStream(ContainerContext& aCtx, const fs::path& aInputStream) + : Stream{aCtx, aInputStream} + { + } std::string to_string() const override; @@ -34,9 +33,7 @@ class StreamDsnStream : public Stream } }; - -[[maybe_unused]] -static std::string to_string(const StreamDsnStream& aObj) +[[maybe_unused]] static std::string to_string(const StreamDsnStream& aObj) { std::string str; @@ -45,20 +42,16 @@ static std::string to_string(const StreamDsnStream& aObj) return str; } - inline std::string StreamDsnStream::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StreamDsnStream& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StreamDsnStream& aVal) { aOs << to_string(aVal); return aOs; } - #endif // STREAMDSNSTREAM_HPP \ No newline at end of file diff --git a/src/Streams/StreamERC.cpp b/src/Streams/StreamERC.cpp index 287e0adf..00d202d3 100644 --- a/src/Streams/StreamERC.cpp +++ b/src/Streams/StreamERC.cpp @@ -8,7 +8,6 @@ #include "GenericParser.hpp" #include "Streams/StreamERC.hpp" - void StreamERC::read(FileFormatVersion /* aVersion */) { auto& ds = mCtx.mDs; diff --git a/src/Streams/StreamERC.hpp b/src/Streams/StreamERC.hpp index cc3c51a3..685ea28c 100644 --- a/src/Streams/StreamERC.hpp +++ b/src/Streams/StreamERC.hpp @@ -1,7 +1,6 @@ #ifndef STREAMERC_HPP #define STREAMERC_HPP - #include #include #include @@ -13,13 +12,14 @@ #include "Stream.hpp" #include "Structures/StructERCSymbol.hpp" - class StreamERC : public Stream { public: - - StreamERC(ContainerContext& aCtx, const fs::path& aInputStream) : Stream{aCtx, aInputStream}, ercSymbol{} - { } + StreamERC(ContainerContext& aCtx, const fs::path& aInputStream) + : Stream{aCtx, aInputStream}, + ercSymbol{} + { + } std::string to_string() const override; @@ -38,9 +38,7 @@ class StreamERC : public Stream std::unique_ptr ercSymbol; }; - -[[maybe_unused]] -static std::string to_string(const StreamERC& aObj) +[[maybe_unused]] static std::string to_string(const StreamERC& aObj) { std::string str; @@ -55,20 +53,16 @@ static std::string to_string(const StreamERC& aObj) return str; } - inline std::string StreamERC::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StreamERC& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StreamERC& aVal) { aOs << to_string(aVal); return aOs; } - #endif // STREAMERC_HPP \ No newline at end of file diff --git a/src/Streams/StreamHSObjects.cpp b/src/Streams/StreamHSObjects.cpp index 6cda02ce..145f5ee5 100644 --- a/src/Streams/StreamHSObjects.cpp +++ b/src/Streams/StreamHSObjects.cpp @@ -7,7 +7,6 @@ #include "General.hpp" #include "Streams/StreamHSObjects.hpp" - void StreamHSObjects::read(FileFormatVersion /* aVersion */) { auto& ds = mCtx.mDs; diff --git a/src/Streams/StreamHSObjects.hpp b/src/Streams/StreamHSObjects.hpp index b5f560a3..0f109b90 100644 --- a/src/Streams/StreamHSObjects.hpp +++ b/src/Streams/StreamHSObjects.hpp @@ -1,7 +1,6 @@ #ifndef STREAMHSOBJECTS_HPP #define STREAMHSOBJECTS_HPP - #include #include @@ -11,13 +10,13 @@ #include "General.hpp" #include "Stream.hpp" - class StreamHSObjects : public Stream { public: - - StreamHSObjects(ContainerContext& aCtx, const fs::path& aInputStream) : Stream{aCtx, aInputStream} - { } + StreamHSObjects(ContainerContext& aCtx, const fs::path& aInputStream) + : Stream{aCtx, aInputStream} + { + } std::string to_string() const override; @@ -34,9 +33,7 @@ class StreamHSObjects : public Stream } }; - -[[maybe_unused]] -static std::string to_string(const StreamHSObjects& aObj) +[[maybe_unused]] static std::string to_string(const StreamHSObjects& aObj) { std::string str; @@ -45,20 +42,16 @@ static std::string to_string(const StreamHSObjects& aObj) return str; } - inline std::string StreamHSObjects::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StreamHSObjects& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StreamHSObjects& aVal) { aOs << to_string(aVal); return aOs; } - #endif // STREAMHSOBJECTS_HPP \ No newline at end of file diff --git a/src/Streams/StreamHierarchy.cpp b/src/Streams/StreamHierarchy.cpp index ea99cda9..e7fab30a 100644 --- a/src/Streams/StreamHierarchy.cpp +++ b/src/Streams/StreamHierarchy.cpp @@ -8,7 +8,6 @@ #include "GenericParser.hpp" #include "Streams/StreamHierarchy.hpp" - void StreamHierarchy::read(FileFormatVersion aVersion) { auto& ds = mCtx.mDs; @@ -18,8 +17,8 @@ void StreamHierarchy::read(FileFormatVersion aVersion) if(aVersion == FileFormatVersion::Unknown) { - const auto predictionFunc = [this](FileFormatVersion aVersion){ this->read(aVersion); }; - aVersion = parser.predictVersion(predictionFunc); + const auto predictionFunc = [this](FileFormatVersion aVersion) { this->read(aVersion); }; + aVersion = parser.predictVersion(predictionFunc); } ds.printUnknownData(9, getMethodName(this, __func__) + ": 0"); diff --git a/src/Streams/StreamHierarchy.hpp b/src/Streams/StreamHierarchy.hpp index 7ee6b55d..5d47a110 100644 --- a/src/Streams/StreamHierarchy.hpp +++ b/src/Streams/StreamHierarchy.hpp @@ -1,7 +1,6 @@ #ifndef STREAMHIERARCHY_HPP #define STREAMHIERARCHY_HPP - #include #include #include @@ -19,14 +18,18 @@ #include "Structures/StructSthInHierarchy3.hpp" #include "Structures/StructT0x5b.hpp" - class StreamHierarchy : public Stream { public: - - StreamHierarchy(ContainerContext& aCtx, const fs::path& aInputStream) : Stream{aCtx, aInputStream}, netDbIdMappings{}, - sthInHierarchy3s{}, t0x5bs{}, sthInHierarchy1s{}, someHierarchyBases{} - { } + StreamHierarchy(ContainerContext& aCtx, const fs::path& aInputStream) + : Stream{aCtx, aInputStream}, + netDbIdMappings{}, + sthInHierarchy3s{}, + t0x5bs{}, + sthInHierarchy1s{}, + someHierarchyBases{} + { + } std::string to_string() const override; @@ -42,17 +45,15 @@ class StreamHierarchy : public Stream return StreamType::Hierarchy; } - std::vector> sthInHierarchy2s; - std::vector> netDbIdMappings; - std::vector> sthInHierarchy3s; - std::vector> t0x5bs; - std::vector> sthInHierarchy1s; + std::vector> sthInHierarchy2s; + std::vector> netDbIdMappings; + std::vector> sthInHierarchy3s; + std::vector> t0x5bs; + std::vector> sthInHierarchy1s; std::vector> someHierarchyBases; }; - -[[maybe_unused]] -static std::string to_string(const StreamHierarchy& aObj) +[[maybe_unused]] static std::string to_string(const StreamHierarchy& aObj) { std::string str; @@ -115,20 +116,16 @@ static std::string to_string(const StreamHierarchy& aObj) return str; } - inline std::string StreamHierarchy::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StreamHierarchy& aObj) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StreamHierarchy& aObj) { aOs << to_string(aObj); return aOs; } - #endif // STREAMHIERARCHY_HPP \ No newline at end of file diff --git a/src/Streams/StreamLibrary.cpp b/src/Streams/StreamLibrary.cpp index 1b3f1eb4..55255cb0 100644 --- a/src/Streams/StreamLibrary.cpp +++ b/src/Streams/StreamLibrary.cpp @@ -16,7 +16,6 @@ #include "Streams/StreamLibrary.hpp" #include "Win32/LOGFONTA.hpp" - void StreamLibrary::read(FileFormatVersion aVersion) { auto& ds = mCtx.mDs; @@ -26,8 +25,8 @@ void StreamLibrary::read(FileFormatVersion aVersion) if(aVersion == FileFormatVersion::Unknown) { - const auto predictionFunc = [this](FileFormatVersion aVersion){ this->read(aVersion); }; - aVersion = parser.predictVersion(predictionFunc); + const auto predictionFunc = [this](FileFormatVersion aVersion) { this->read(aVersion); }; + aVersion = parser.predictVersion(predictionFunc); } size_t startOffset = ds.getCurrentOffset(); diff --git a/src/Streams/StreamLibrary.hpp b/src/Streams/StreamLibrary.hpp index b616cc12..879e76c3 100644 --- a/src/Streams/StreamLibrary.hpp +++ b/src/Streams/StreamLibrary.hpp @@ -1,7 +1,6 @@ #ifndef STREAMSYMBOLSLIBRARY_HPP #define STREAMSYMBOLSLIBRARY_HPP - #include #include #include @@ -17,15 +16,22 @@ #include "Stream.hpp" #include "Win32/LOGFONTA.hpp" - class StreamLibrary : public Stream { public: - - StreamLibrary(ContainerContext& aCtx, const fs::path& aInputStream) : Stream{aCtx, aInputStream}, - introduction{}, mDbType{DatabaseType::Design}, createDate{0}, modifyDate{0}, - textFonts{}, strLstPartField{}, pageSettings{mCtx}, strLst{}, partAliases{} - { } + StreamLibrary(ContainerContext& aCtx, const fs::path& aInputStream) + : Stream{aCtx, aInputStream}, + introduction{}, + mDbType{DatabaseType::Design}, + createDate{0}, + modifyDate{0}, + textFonts{}, + strLstPartField{}, + pageSettings{mCtx}, + strLst{}, + partAliases{} + { + } std::string to_string() const override; @@ -62,9 +68,7 @@ class StreamLibrary : public Stream std::vector> partAliases; //!< .first = Alias, .second = Package }; - -[[maybe_unused]] -static std::string to_string(const StreamLibrary& aObj) +[[maybe_unused]] static std::string to_string(const StreamLibrary& aObj) { std::string str; @@ -103,19 +107,15 @@ static std::string to_string(const StreamLibrary& aObj) return str; } - inline std::string StreamLibrary::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StreamLibrary& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StreamLibrary& aVal) { aOs << to_string(aVal); return aOs; } - #endif // STREAMSYMBOLSLIBRARY_HPP \ No newline at end of file diff --git a/src/Streams/StreamNetBundleMapData.cpp b/src/Streams/StreamNetBundleMapData.cpp index 2a47053f..eaf03378 100644 --- a/src/Streams/StreamNetBundleMapData.cpp +++ b/src/Streams/StreamNetBundleMapData.cpp @@ -9,7 +9,6 @@ #include "GenericParser.hpp" #include "Streams/StreamNetBundleMapData.hpp" - void StreamNetBundleMapData::read(FileFormatVersion /* aVersion */) { auto& ds = mCtx.mDs; @@ -58,7 +57,9 @@ void StreamNetBundleMapData::read(FileFormatVersion /* aVersion */) // @todo 0x01 is probably a scalar wire // 0x02 is probably a bus uint16_t wire_type = ds.readUint16(); - mCtx.mLogger.trace(" wire_type = {}", wire_type == 0x01 ? "Scalar" : wire_type == 0x02 ? "Bus" : "Unknown"); + mCtx.mLogger.trace(" wire_type = {}", wire_type == 0x01 ? "Scalar" + : wire_type == 0x02 ? "Bus" + : "Unknown"); } } diff --git a/src/Streams/StreamNetBundleMapData.hpp b/src/Streams/StreamNetBundleMapData.hpp index 1c0bf272..97dc0077 100644 --- a/src/Streams/StreamNetBundleMapData.hpp +++ b/src/Streams/StreamNetBundleMapData.hpp @@ -1,7 +1,6 @@ #ifndef STREAMNETBUNDLEMAPDATA_HPP #define STREAMNETBUNDLEMAPDATA_HPP - #include #include @@ -10,13 +9,13 @@ #include "General.hpp" #include "Stream.hpp" - class StreamNetBundleMapData : public Stream { public: - - StreamNetBundleMapData(ContainerContext& aCtx, const fs::path& aInputStream) : Stream{aCtx, aInputStream} - { } + StreamNetBundleMapData(ContainerContext& aCtx, const fs::path& aInputStream) + : Stream{aCtx, aInputStream} + { + } std::string to_string() const override; @@ -33,9 +32,7 @@ class StreamNetBundleMapData : public Stream } }; - -[[maybe_unused]] -static std::string to_string(const StreamNetBundleMapData& aObj) +[[maybe_unused]] static std::string to_string(const StreamNetBundleMapData& aObj) { std::string str; @@ -44,20 +41,16 @@ static std::string to_string(const StreamNetBundleMapData& aObj) return str; } - inline std::string StreamNetBundleMapData::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StreamNetBundleMapData& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StreamNetBundleMapData& aVal) { aOs << to_string(aVal); return aOs; } - #endif // STREAMNETBUNDLEMAPDATA_HPP \ No newline at end of file diff --git a/src/Streams/StreamPackage.cpp b/src/Streams/StreamPackage.cpp index 924195e6..52fdabdb 100644 --- a/src/Streams/StreamPackage.cpp +++ b/src/Streams/StreamPackage.cpp @@ -8,7 +8,6 @@ #include "GenericParser.hpp" #include "Streams/StreamPackage.hpp" - void StreamPackage::read(FileFormatVersion /* aVersion */) { auto& ds = mCtx.mDs; diff --git a/src/Streams/StreamPackage.hpp b/src/Streams/StreamPackage.hpp index 19f85a34..c39d2fcc 100644 --- a/src/Streams/StreamPackage.hpp +++ b/src/Streams/StreamPackage.hpp @@ -1,7 +1,6 @@ #ifndef STREAMPACKAGE_HPP #define STREAMPACKAGE_HPP - #include #include #include @@ -17,14 +16,16 @@ #include "Structures/StructPackage.hpp" #include "Structures/StructPartCell.hpp" - class StreamPackage : public Stream { public: - - StreamPackage(ContainerContext& aCtx, const fs::path& aInputStream) : Stream{aCtx, aInputStream}, partCells{}, libraryParts{}, - package{} - { } + StreamPackage(ContainerContext& aCtx, const fs::path& aInputStream) + : Stream{aCtx, aInputStream}, + partCells{}, + libraryParts{}, + package{} + { + } std::string to_string() const override; @@ -40,15 +41,13 @@ class StreamPackage : public Stream return StreamType::Package; } - std::vector> partCells; - std::vector> libraryParts; + std::vector> partCells; + std::vector> libraryParts; - std::unique_ptr package; + std::unique_ptr package; }; - -[[maybe_unused]] -static std::string to_string(const StreamPackage& aObj) +[[maybe_unused]] static std::string to_string(const StreamPackage& aObj) { std::string str; @@ -81,20 +80,16 @@ static std::string to_string(const StreamPackage& aObj) return str; } - inline std::string StreamPackage::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StreamPackage& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StreamPackage& aVal) { aOs << to_string(aVal); return aOs; } - #endif // STREAMPACKAGE_HPP \ No newline at end of file diff --git a/src/Streams/StreamPage.cpp b/src/Streams/StreamPage.cpp index 290082e0..1b6d2fe4 100644 --- a/src/Streams/StreamPage.cpp +++ b/src/Streams/StreamPage.cpp @@ -9,7 +9,6 @@ #include "PageSettings.hpp" #include "Streams/StreamPage.hpp" - void StreamPage::read(FileFormatVersion /* aVersion */) { auto& ds = mCtx.mDs; @@ -71,7 +70,7 @@ void StreamPage::read(FileFormatVersion /* aVersion */) { // @todo Add attributes const std::string net = ds.readStringLenZeroTerm(); - const uint32_t id = ds.readUint32(); + const uint32_t id = ds.readUint32(); mCtx.mLogger.trace("net = {}", net); mCtx.mLogger.trace("id = {}", id); diff --git a/src/Streams/StreamPage.hpp b/src/Streams/StreamPage.hpp index ac7ba2f0..0b1c50df 100644 --- a/src/Streams/StreamPage.hpp +++ b/src/Streams/StreamPage.hpp @@ -1,7 +1,6 @@ #ifndef STREAMPAGE_HPP #define STREAMPAGE_HPP - #include #include #include @@ -24,15 +23,27 @@ #include "Structures/StructTitleBlock.hpp" #include "Structures/StructWire.hpp" - class StreamPage : public Stream { public: - - StreamPage(ContainerContext& aCtx, const fs::path& aInputStream) : Stream{aCtx, aInputStream}, name{}, pageSize{}, pageSettings{mCtx}, - titleBlocks{}, t0x34s{}, t0x35s{}, wires{}, placedInstances{}, ports{}, globals{}, offPageConnectors{}, - ercObjects{}, busEntries{}, graphicInsts{} - { } + StreamPage(ContainerContext& aCtx, const fs::path& aInputStream) + : Stream{aCtx, aInputStream}, + name{}, + pageSize{}, + pageSettings{mCtx}, + titleBlocks{}, + t0x34s{}, + t0x35s{}, + wires{}, + placedInstances{}, + ports{}, + globals{}, + offPageConnectors{}, + ercObjects{}, + busEntries{}, + graphicInsts{} + { + } std::string to_string() const override; @@ -48,26 +59,24 @@ class StreamPage : public Stream return StreamType::Page; } - std::string name; - std::string pageSize; + std::string name; + std::string pageSize; PageSettings pageSettings; - std::vector> titleBlocks; - std::vector> t0x34s; - std::vector> t0x35s; - std::vector> wires; - std::vector> placedInstances; - std::vector> ports; - std::vector> globals; + std::vector> titleBlocks; + std::vector> t0x34s; + std::vector> t0x35s; + std::vector> wires; + std::vector> placedInstances; + std::vector> ports; + std::vector> globals; std::vector> offPageConnectors; - std::vector> ercObjects; - std::vector> busEntries; - std::vector> graphicInsts; + std::vector> ercObjects; + std::vector> busEntries; + std::vector> graphicInsts; }; - -[[maybe_unused]] -static std::string to_string(const StreamPage& aObj) +[[maybe_unused]] static std::string to_string(const StreamPage& aObj) { std::string str; @@ -179,20 +188,16 @@ static std::string to_string(const StreamPage& aObj) return str; } - inline std::string StreamPage::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StreamPage& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StreamPage& aVal) { aOs << to_string(aVal); return aOs; } - #endif // STREAMPAGE_HPP \ No newline at end of file diff --git a/src/Streams/StreamSchematic.cpp b/src/Streams/StreamSchematic.cpp index d2c82284..0211bb3a 100644 --- a/src/Streams/StreamSchematic.cpp +++ b/src/Streams/StreamSchematic.cpp @@ -8,7 +8,6 @@ #include "GenericParser.hpp" #include "Streams/StreamSchematic.hpp" - void StreamSchematic::read(FileFormatVersion /* aVersion */) { auto& ds = mCtx.mDs; diff --git a/src/Streams/StreamSchematic.hpp b/src/Streams/StreamSchematic.hpp index c26c6e9f..3dfec91d 100644 --- a/src/Streams/StreamSchematic.hpp +++ b/src/Streams/StreamSchematic.hpp @@ -1,7 +1,6 @@ #ifndef STREAMSCHEMATIC_HPP #define STREAMSCHEMATIC_HPP - #include #include #include @@ -12,13 +11,13 @@ #include "General.hpp" #include "Stream.hpp" - class StreamSchematic : public Stream { public: - - StreamSchematic(ContainerContext& aCtx, const fs::path& aInputStream) : Stream{aCtx, aInputStream} - { } + StreamSchematic(ContainerContext& aCtx, const fs::path& aInputStream) + : Stream{aCtx, aInputStream} + { + } std::string to_string() const override; @@ -35,9 +34,7 @@ class StreamSchematic : public Stream } }; - -[[maybe_unused]] -static std::string to_string(const StreamSchematic& aObj) +[[maybe_unused]] static std::string to_string(const StreamSchematic& aObj) { std::string str; @@ -46,20 +43,16 @@ static std::string to_string(const StreamSchematic& aObj) return str; } - inline std::string StreamSchematic::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StreamSchematic& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StreamSchematic& aVal) { aOs << to_string(aVal); return aOs; } - #endif // STREAMSCHEMATIC_HPP \ No newline at end of file diff --git a/src/Streams/StreamSymbol.cpp b/src/Streams/StreamSymbol.cpp index 1029a58e..b0c00a2a 100644 --- a/src/Streams/StreamSymbol.cpp +++ b/src/Streams/StreamSymbol.cpp @@ -8,7 +8,6 @@ #include "GenericParser.hpp" #include "Streams/StreamSymbol.hpp" - void StreamSymbol::read(FileFormatVersion /* aVersion */) { auto& ds = mCtx.mDs; diff --git a/src/Streams/StreamSymbol.hpp b/src/Streams/StreamSymbol.hpp index db509c22..25bd3467 100644 --- a/src/Streams/StreamSymbol.hpp +++ b/src/Streams/StreamSymbol.hpp @@ -1,7 +1,6 @@ #ifndef STREAMSYMBOL_HPP #define STREAMSYMBOL_HPP - #include #include #include @@ -16,13 +15,15 @@ #include "Structures/StructSymbolDisplayProp.hpp" #include "Structures/StructSymbolPin.hpp" - class StreamSymbol : public Stream { public: - - StreamSymbol(ContainerContext& aCtx, const fs::path& aInputStream) : Stream{aCtx, aInputStream}, symbolPins{}, symbolDisplayProps{} - { } + StreamSymbol(ContainerContext& aCtx, const fs::path& aInputStream) + : Stream{aCtx, aInputStream}, + symbolPins{}, + symbolDisplayProps{} + { + } std::string to_string() const override; @@ -40,13 +41,11 @@ class StreamSymbol : public Stream std::unique_ptr symbol; - std::vector> symbolPins; + std::vector> symbolPins; std::vector> symbolDisplayProps; }; - -[[maybe_unused]] -static std::string to_string(const StreamSymbol& aObj) +[[maybe_unused]] static std::string to_string(const StreamSymbol& aObj) { std::string str; @@ -79,20 +78,16 @@ static std::string to_string(const StreamSymbol& aObj) return str; } - inline std::string StreamSymbol::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StreamSymbol& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StreamSymbol& aVal) { aOs << to_string(aVal); return aOs; } - #endif // STREAMSYMBOL_HPP \ No newline at end of file diff --git a/src/Structures/StructAlias.cpp b/src/Structures/StructAlias.cpp index 30afc7d0..56ca22ed 100644 --- a/src/Structures/StructAlias.cpp +++ b/src/Structures/StructAlias.cpp @@ -10,7 +10,6 @@ #include "GenericParser.hpp" #include "Structures/StructAlias.hpp" - void StructAlias::read(FileFormatVersion /* aVersion */) { auto& ds = mCtx.mDs; diff --git a/src/Structures/StructAlias.hpp b/src/Structures/StructAlias.hpp index e9effee5..c236eafa 100644 --- a/src/Structures/StructAlias.hpp +++ b/src/Structures/StructAlias.hpp @@ -1,7 +1,6 @@ #ifndef STRUCTALIAS_HPP #define STRUCTALIAS_HPP - #include #include #include @@ -15,14 +14,18 @@ #include "General.hpp" #include "Record.hpp" - class StructAlias : public Record { public: - - StructAlias(StreamContext& aCtx) : Record{aCtx}, locX{0}, locY{0}, - color{Color::Default}, rotation{Rotation::Deg_0}, name{} - { } + StructAlias(StreamContext& aCtx) + : Record{aCtx}, + locX{0}, + locY{0}, + color{Color::Default}, + rotation{Rotation::Deg_0}, + name{} + { + } std::string to_string() const override; @@ -38,18 +41,16 @@ class StructAlias : public Record return Structure::Alias; } - int32_t locX; - int32_t locY; + int32_t locX; + int32_t locY; - Color color; + Color color; Rotation rotation; std::string name; }; - -[[maybe_unused]] -static std::string to_string(const StructAlias& aObj) +[[maybe_unused]] static std::string to_string(const StructAlias& aObj) { std::string str; @@ -63,20 +64,16 @@ static std::string to_string(const StructAlias& aObj) return str; } - inline std::string StructAlias::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StructAlias& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StructAlias& aVal) { aOs << to_string(aVal); return aOs; } - #endif // STRUCTALIAS_HPP \ No newline at end of file diff --git a/src/Structures/StructBookMarkSymbolInst.cpp b/src/Structures/StructBookMarkSymbolInst.cpp index ab3aa71c..9432066a 100644 --- a/src/Structures/StructBookMarkSymbolInst.cpp +++ b/src/Structures/StructBookMarkSymbolInst.cpp @@ -10,7 +10,6 @@ #include "GenericParser.hpp" #include "Structures/StructBookMarkSymbolInst.hpp" - void StructBookMarkSymbolInst::read(FileFormatVersion /* aVersion */) { auto& ds = mCtx.mDs; diff --git a/src/Structures/StructBookMarkSymbolInst.hpp b/src/Structures/StructBookMarkSymbolInst.hpp index 0afd8e1b..88731661 100644 --- a/src/Structures/StructBookMarkSymbolInst.hpp +++ b/src/Structures/StructBookMarkSymbolInst.hpp @@ -1,7 +1,6 @@ #ifndef STRUCTBOOKMARKSYMBOLINST_HPP #define STRUCTBOOKMARKSYMBOLINST_HPP - #include #include #include @@ -15,13 +14,13 @@ #include "General.hpp" #include "Structures/StructGraphicInst.hpp" - class StructBookMarkSymbolInst : public StructGraphicInst { public: - - StructBookMarkSymbolInst(StreamContext& aCtx) : StructGraphicInst{aCtx} - { } + StructBookMarkSymbolInst(StreamContext& aCtx) + : StructGraphicInst{aCtx} + { + } std::string to_string() const override; @@ -38,14 +37,11 @@ class StructBookMarkSymbolInst : public StructGraphicInst } }; - -[[maybe_unused]] -static std::string to_string(const StructBookMarkSymbolInst& aObj) +[[maybe_unused]] static std::string to_string(const StructBookMarkSymbolInst& aObj) { return aObj.to_string(); } - inline std::string StructBookMarkSymbolInst::to_string() const { std::string str; @@ -57,14 +53,11 @@ inline std::string StructBookMarkSymbolInst::to_string() const return str; } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StructBookMarkSymbolInst& aObj) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StructBookMarkSymbolInst& aObj) { aOs << to_string(aObj); return aOs; } - #endif // STRUCTBOOKMARKSYMBOLINST_HPP \ No newline at end of file diff --git a/src/Structures/StructBusEntry.cpp b/src/Structures/StructBusEntry.cpp index 5a502b0b..f1dd85b2 100644 --- a/src/Structures/StructBusEntry.cpp +++ b/src/Structures/StructBusEntry.cpp @@ -10,7 +10,6 @@ #include "GenericParser.hpp" #include "Structures/StructBusEntry.hpp" - void StructBusEntry::read(FileFormatVersion /* aVersion */) { auto& ds = mCtx.mDs; diff --git a/src/Structures/StructBusEntry.hpp b/src/Structures/StructBusEntry.hpp index 0be6bad2..b4de1fe8 100644 --- a/src/Structures/StructBusEntry.hpp +++ b/src/Structures/StructBusEntry.hpp @@ -1,7 +1,6 @@ #ifndef STRUCTBUSENTRY_HPP #define STRUCTBUSENTRY_HPP - #include #include #include @@ -14,14 +13,18 @@ #include "General.hpp" #include "Record.hpp" - class StructBusEntry : public Record { public: - - StructBusEntry(StreamContext& aCtx) : Record{aCtx}, color{Color::Default}, - startX{0}, startY{0}, endX{0}, endY{0} - { } + StructBusEntry(StreamContext& aCtx) + : Record{aCtx}, + color{Color::Default}, + startX{0}, + startY{0}, + endX{0}, + endY{0} + { + } std::string to_string() const override; @@ -37,18 +40,16 @@ class StructBusEntry : public Record return Structure::BusEntry; } - Color color; + Color color; - int32_t startX; - int32_t startY; + int32_t startX; + int32_t startY; - int32_t endX; - int32_t endY; + int32_t endX; + int32_t endY; }; - -[[maybe_unused]] -static std::string to_string(const StructBusEntry& aObj) +[[maybe_unused]] static std::string to_string(const StructBusEntry& aObj) { std::string str; @@ -62,20 +63,16 @@ static std::string to_string(const StructBusEntry& aObj) return str; } - inline std::string StructBusEntry::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StructBusEntry& aObj) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StructBusEntry& aObj) { aOs << to_string(aObj); return aOs; } - #endif // STRUCTBUSENTRY_HPP \ No newline at end of file diff --git a/src/Structures/StructDevice.cpp b/src/Structures/StructDevice.cpp index a4ffadab..79c9fa77 100644 --- a/src/Structures/StructDevice.cpp +++ b/src/Structures/StructDevice.cpp @@ -12,7 +12,6 @@ #include "GenericParser.hpp" #include "Structures/StructDevice.hpp" - void StructDevice::read(FileFormatVersion /* aVersion */) { auto& ds = mCtx.mDs; @@ -40,7 +39,7 @@ void StructDevice::read(FileFormatVersion /* aVersion */) for(size_t i = 0u; i < pinCount; ++i) { const auto currOffset = ds.getCurrentOffset(); - const int16_t strLen = ds.readInt16(); + const int16_t strLen = ds.readInt16(); ds.setCurrentOffset(currOffset); // @todo What means a string length of -1? @@ -72,10 +71,8 @@ void StructDevice::read(FileFormatVersion /* aVersion */) // @note The special case of value 127 that represents an empty group pinGroup.push_back(bitMapPinGrpCfg & 0x7f); - mCtx.mLogger.trace("pinIgnore = {}", (bool) GetBit(7, bitMapPinGrpCfg)); - const std::string strPinGroup = (pinGroup.back() != 127U) - ? std::to_string(pinGroup.back()) - : std::string{}; + mCtx.mLogger.trace("pinIgnore = {}", (bool)GetBit(7, bitMapPinGrpCfg)); + const std::string strPinGroup = (pinGroup.back() != 127U) ? std::to_string(pinGroup.back()) : std::string{}; mCtx.mLogger.trace("pinGroup = {:>3}", strPinGroup); } diff --git a/src/Structures/StructDevice.hpp b/src/Structures/StructDevice.hpp index 80c0eaa8..564cc25a 100644 --- a/src/Structures/StructDevice.hpp +++ b/src/Structures/StructDevice.hpp @@ -1,11 +1,8 @@ - - #ifndef STRUCTDEVICE_HPP #define STRUCTDEVICE_HPP - #include #include #include @@ -16,16 +13,20 @@ #include "Record.hpp" - // @todo Probably called 'PhysicalPart' in the XSD // Structure should also contain 'PinShared' and 'PinSwap' class StructDevice : public Record { public: - - StructDevice(StreamContext& aCtx) : Record{aCtx}, unitRef{}, refDes{}, - pinMap{}, pinIgnore{}, pinGroup{} - { } + StructDevice(StreamContext& aCtx) + : Record{aCtx}, + unitRef{}, + refDes{}, + pinMap{}, + pinIgnore{}, + pinGroup{} + { + } std::string to_string() const override; @@ -50,13 +51,11 @@ class StructDevice : public Record std::vector pinMap; // @todo add to a separate pin struct - std::vector pinIgnore; - std::vector pinGroup; // @todo Probably convert to std::optional + std::vector pinIgnore; + std::vector pinGroup; // @todo Probably convert to std::optional }; - -[[maybe_unused]] -static std::string to_string(const StructDevice& aObj) +[[maybe_unused]] static std::string to_string(const StructDevice& aObj) { std::string str; @@ -86,20 +85,16 @@ static std::string to_string(const StructDevice& aObj) return str; } - inline std::string StructDevice::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StructDevice& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StructDevice& aVal) { aOs << to_string(aVal); return aOs; } - #endif // STRUCTDEVICE_HPP \ No newline at end of file diff --git a/src/Structures/StructERCObject.cpp b/src/Structures/StructERCObject.cpp index 264dfb0d..9e799c26 100644 --- a/src/Structures/StructERCObject.cpp +++ b/src/Structures/StructERCObject.cpp @@ -10,7 +10,6 @@ #include "GenericParser.hpp" #include "Structures/StructERCObject.hpp" - void StructERCObject::read(FileFormatVersion /* aVersion */) { auto& ds = mCtx.mDs; diff --git a/src/Structures/StructERCObject.hpp b/src/Structures/StructERCObject.hpp index 803018d8..25d48e0e 100644 --- a/src/Structures/StructERCObject.hpp +++ b/src/Structures/StructERCObject.hpp @@ -1,7 +1,6 @@ #ifndef STRUCTERCOBJECT_HPP #define STRUCTERCOBJECT_HPP - #include #include #include @@ -15,13 +14,16 @@ #include "General.hpp" #include "Structures/StructGraphicInst.hpp" - class StructERCObject : public StructGraphicInst { public: - - StructERCObject(StreamContext& aCtx) : StructGraphicInst{aCtx}, s0{}, s1{}, s2{} - { } + StructERCObject(StreamContext& aCtx) + : StructGraphicInst{aCtx}, + s0{}, + s1{}, + s2{} + { + } std::string to_string() const override; @@ -42,14 +44,11 @@ class StructERCObject : public StructGraphicInst std::string s2; }; - -[[maybe_unused]] -static std::string to_string(const StructERCObject& aObj) +[[maybe_unused]] static std::string to_string(const StructERCObject& aObj) { return aObj.to_string(); } - inline std::string StructERCObject::to_string() const { std::string str; @@ -65,14 +64,11 @@ inline std::string StructERCObject::to_string() const return str; } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StructERCObject& aObj) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StructERCObject& aObj) { aOs << to_string(aObj); return aOs; } - #endif // STRUCTERCOBJECT_HPP \ No newline at end of file diff --git a/src/Structures/StructERCSymbol.cpp b/src/Structures/StructERCSymbol.cpp index 1b94642c..00bf2027 100644 --- a/src/Structures/StructERCSymbol.cpp +++ b/src/Structures/StructERCSymbol.cpp @@ -11,7 +11,6 @@ #include "Structures/StructERCSymbol.hpp" #include "Structures/StructSymbolBBox.hpp" - void StructERCSymbol::read(FileFormatVersion aVersion) { auto& ds = mCtx.mDs; diff --git a/src/Structures/StructERCSymbol.hpp b/src/Structures/StructERCSymbol.hpp index 28f04f8a..b5e132e6 100644 --- a/src/Structures/StructERCSymbol.hpp +++ b/src/Structures/StructERCSymbol.hpp @@ -1,7 +1,6 @@ #ifndef STRUCTERCSYMBOL_HPP #define STRUCTERCSYMBOL_HPP - #include #include #include @@ -13,13 +12,14 @@ #include "Structures/StructSymbol.hpp" #include "Structures/StructSymbolBBox.hpp" - class StructERCSymbol : public StructSymbol { public: - - StructERCSymbol(StreamContext& aCtx) : StructSymbol{aCtx}, symbolBBox{aCtx} - { } + StructERCSymbol(StreamContext& aCtx) + : StructSymbol{aCtx}, + symbolBBox{aCtx} + { + } std::string to_string() const override; @@ -38,9 +38,7 @@ class StructERCSymbol : public StructSymbol StructSymbolBBox symbolBBox; }; - -[[maybe_unused]] -static std::string to_string(const StructERCSymbol& aObj) +[[maybe_unused]] static std::string to_string(const StructERCSymbol& aObj) { std::string str; @@ -53,20 +51,16 @@ static std::string to_string(const StructERCSymbol& aObj) return str; } - inline std::string StructERCSymbol::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StructERCSymbol& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StructERCSymbol& aVal) { aOs << to_string(aVal); return aOs; } - #endif // STRUCTERCSYMBOL_HPP \ No newline at end of file diff --git a/src/Structures/StructGeneralProperties.cpp b/src/Structures/StructGeneralProperties.cpp index 0deac88e..9a3d6712 100644 --- a/src/Structures/StructGeneralProperties.cpp +++ b/src/Structures/StructGeneralProperties.cpp @@ -11,7 +11,6 @@ #include "General.hpp" #include "Structures/StructGeneralProperties.hpp" - void StructGeneralProperties::read(FileFormatVersion /* aVersion */) { auto& ds = mCtx.mDs; @@ -41,15 +40,14 @@ void StructGeneralProperties::read(FileFormatVersion /* aVersion */) // Expect that upper bits are unused => 00xx xxxxb if((properties & 0xc0) != 0x00) { - throw std::runtime_error(fmt::format("Expected 00xx xxxxb but got 0x{:02x}", - properties & 0xc0)); + throw std::runtime_error(fmt::format("Expected 00xx xxxxb but got 0x{:02x}", properties & 0xc0)); } - const uint8_t pinProperties = properties & 0x07; // Get bits 2 down to 0 + const uint8_t pinProperties = properties & 0x07; // Get bits 2 down to 0 const uint8_t implementationType = (properties >> 3) & 0x07; // Get bits 5 down to 3 - pinNameVisible = static_cast((pinProperties & 0x01) >> 0); // Bit 0 - pinNameRotate = static_cast((pinProperties & 0x02) >> 1); // Bit 1 + pinNameVisible = static_cast((pinProperties & 0x01) >> 0); // Bit 0 + pinNameRotate = static_cast((pinProperties & 0x02) >> 1); // Bit 1 pinNumberVisible = !static_cast((pinProperties & 0x04) >> 2); // Bit 2 - Note that this bit is inverted this->implementationType = ToImplementationType(implementationType); diff --git a/src/Structures/StructGeneralProperties.hpp b/src/Structures/StructGeneralProperties.hpp index 215278c5..50746954 100644 --- a/src/Structures/StructGeneralProperties.hpp +++ b/src/Structures/StructGeneralProperties.hpp @@ -1,7 +1,6 @@ #ifndef STRUCTGENERALPROPERTIES_HPP #define STRUCTGENERALPROPERTIES_HPP - #include #include #include @@ -12,18 +11,24 @@ #include "Enums/ImplementationType.hpp" #include "Record.hpp" - // @todo This is just a helper class but not a real structure // Check if the same code is used multiple times, otherwise // Inline this structure? class StructGeneralProperties : public Other { public: - - StructGeneralProperties(StreamContext& aCtx) : Other{aCtx}, implementationPath{}, - implementation{}, refDes{}, partValue{}, implementationType{ImplementationType::None}, - pinNameVisible{true}, pinNameRotate{false}, pinNumberVisible{true} - { } + StructGeneralProperties(StreamContext& aCtx) + : Other{aCtx}, + implementationPath{}, + implementation{}, + refDes{}, + partValue{}, + implementationType{ImplementationType::None}, + pinNameVisible{true}, + pinNameRotate{false}, + pinNumberVisible{true} + { + } std::string to_string() const override; @@ -63,9 +68,7 @@ class StructGeneralProperties : public Other bool pinNumberVisible; }; - -[[maybe_unused]] -static std::string to_string(const StructGeneralProperties& aObj) +[[maybe_unused]] static std::string to_string(const StructGeneralProperties& aObj) { std::string str; @@ -82,20 +85,16 @@ static std::string to_string(const StructGeneralProperties& aObj) return str; } - inline std::string StructGeneralProperties::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StructGeneralProperties& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StructGeneralProperties& aVal) { aOs << to_string(aVal); return aOs; } - #endif // STRUCTGENERALPROPERTIES_HPP \ No newline at end of file diff --git a/src/Structures/StructGlobal.cpp b/src/Structures/StructGlobal.cpp index 761163bd..5a1515a9 100644 --- a/src/Structures/StructGlobal.cpp +++ b/src/Structures/StructGlobal.cpp @@ -10,7 +10,6 @@ #include "GenericParser.hpp" #include "Structures/StructGlobal.hpp" - void StructGlobal::read(FileFormatVersion /* aVersion */) { auto& ds = mCtx.mDs; diff --git a/src/Structures/StructGlobal.hpp b/src/Structures/StructGlobal.hpp index cf1b7dd0..cee8cc99 100644 --- a/src/Structures/StructGlobal.hpp +++ b/src/Structures/StructGlobal.hpp @@ -1,7 +1,6 @@ #ifndef STRUCTGLOBAL_HPP #define STRUCTGLOBAL_HPP - #include #include #include @@ -15,13 +14,13 @@ #include "General.hpp" #include "Structures/StructGraphicInst.hpp" - class StructGlobal : public StructGraphicInst { public: - - StructGlobal(StreamContext& aCtx) : StructGraphicInst{aCtx} - { } + StructGlobal(StreamContext& aCtx) + : StructGraphicInst{aCtx} + { + } std::string to_string() const override; @@ -38,14 +37,11 @@ class StructGlobal : public StructGraphicInst } }; - -[[maybe_unused]] -static std::string to_string(const StructGlobal& aObj) +[[maybe_unused]] static std::string to_string(const StructGlobal& aObj) { return aObj.to_string(); } - inline std::string StructGlobal::to_string() const { std::string str; @@ -57,14 +53,11 @@ inline std::string StructGlobal::to_string() const return str; } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StructGlobal& aObj) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StructGlobal& aObj) { aOs << to_string(aObj); return aOs; } - #endif // STRUCTGLOBAL_HPP \ No newline at end of file diff --git a/src/Structures/StructGlobalSymbol.cpp b/src/Structures/StructGlobalSymbol.cpp index 8d3f830b..0fce1326 100644 --- a/src/Structures/StructGlobalSymbol.cpp +++ b/src/Structures/StructGlobalSymbol.cpp @@ -9,7 +9,6 @@ #include "GenericParser.hpp" #include "Structures/StructGlobalSymbol.hpp" - void StructGlobalSymbol::read(FileFormatVersion aVersion) { auto& ds = mCtx.mDs; diff --git a/src/Structures/StructGlobalSymbol.hpp b/src/Structures/StructGlobalSymbol.hpp index b0d6835b..1d35eca9 100644 --- a/src/Structures/StructGlobalSymbol.hpp +++ b/src/Structures/StructGlobalSymbol.hpp @@ -1,7 +1,6 @@ #ifndef STRUCTGLOBALSYMBOL_HPP #define STRUCTGLOBALSYMBOL_HPP - #include #include #include @@ -16,14 +15,15 @@ #include "Structures/StructSymbolDisplayProp.hpp" #include "Structures/StructSymbolPin.hpp" - class StructGlobalSymbol : public StructSymbol { public: - - StructGlobalSymbol(StreamContext& aCtx) : StructSymbol{aCtx}, - symbolPins{}, symbolDisplayProps{} - { } + StructGlobalSymbol(StreamContext& aCtx) + : StructSymbol{aCtx}, + symbolPins{}, + symbolDisplayProps{} + { + } std::string to_string() const override; @@ -39,13 +39,11 @@ class StructGlobalSymbol : public StructSymbol return Structure::GlobalSymbol; } - std::vector> symbolPins; + std::vector> symbolPins; std::vector> symbolDisplayProps; }; - -[[maybe_unused]] -static std::string to_string(const StructGlobalSymbol& aObj) +[[maybe_unused]] static std::string to_string(const StructGlobalSymbol& aObj) { std::string str; @@ -75,20 +73,16 @@ static std::string to_string(const StructGlobalSymbol& aObj) return str; } - inline std::string StructGlobalSymbol::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StructGlobalSymbol& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StructGlobalSymbol& aVal) { aOs << to_string(aVal); return aOs; } - #endif // STRUCTGLOBALSYMBOL_HPP \ No newline at end of file diff --git a/src/Structures/StructGraphicArcInst.cpp b/src/Structures/StructGraphicArcInst.cpp index 72298a81..099fa931 100644 --- a/src/Structures/StructGraphicArcInst.cpp +++ b/src/Structures/StructGraphicArcInst.cpp @@ -9,7 +9,6 @@ #include "GenericParser.hpp" #include "Structures/StructGraphicArcInst.hpp" - void StructGraphicArcInst::read(FileFormatVersion /* aVersion */) { auto& ds = mCtx.mDs; diff --git a/src/Structures/StructGraphicArcInst.hpp b/src/Structures/StructGraphicArcInst.hpp index 9740517c..516eb983 100644 --- a/src/Structures/StructGraphicArcInst.hpp +++ b/src/Structures/StructGraphicArcInst.hpp @@ -1,7 +1,6 @@ #ifndef STRUCTGRAPHICARCINST_HPP #define STRUCTGRAPHICARCINST_HPP - #include #include #include @@ -14,13 +13,13 @@ #include "General.hpp" #include "Structures/StructGraphicInst.hpp" - class StructGraphicArcInst : public StructGraphicInst { public: - - StructGraphicArcInst(StreamContext& aCtx) : StructGraphicInst{aCtx} - { } + StructGraphicArcInst(StreamContext& aCtx) + : StructGraphicInst{aCtx} + { + } std::string to_string() const override; @@ -37,14 +36,11 @@ class StructGraphicArcInst : public StructGraphicInst } }; - -[[maybe_unused]] -static std::string to_string(const StructGraphicArcInst& aObj) +[[maybe_unused]] static std::string to_string(const StructGraphicArcInst& aObj) { return aObj.to_string(); } - inline std::string StructGraphicArcInst::to_string() const { std::string str; @@ -56,14 +52,11 @@ inline std::string StructGraphicArcInst::to_string() const return str; } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StructGraphicArcInst& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StructGraphicArcInst& aVal) { aOs << to_string(aVal); return aOs; } - #endif // STRUCTGRAPHICARCINST_HPP \ No newline at end of file diff --git a/src/Structures/StructGraphicBezierInst.cpp b/src/Structures/StructGraphicBezierInst.cpp index d8ce6f23..20aa53da 100644 --- a/src/Structures/StructGraphicBezierInst.cpp +++ b/src/Structures/StructGraphicBezierInst.cpp @@ -9,7 +9,6 @@ #include "GenericParser.hpp" #include "Structures/StructGraphicBezierInst.hpp" - void StructGraphicBezierInst::read(FileFormatVersion /* aVersion */) { auto& ds = mCtx.mDs; diff --git a/src/Structures/StructGraphicBezierInst.hpp b/src/Structures/StructGraphicBezierInst.hpp index a4ea53a2..28459a1a 100644 --- a/src/Structures/StructGraphicBezierInst.hpp +++ b/src/Structures/StructGraphicBezierInst.hpp @@ -1,7 +1,6 @@ #ifndef STRUCTGRAPHICBEZIERINST_HPP #define STRUCTGRAPHICBEZIERINST_HPP - #include #include #include @@ -14,13 +13,13 @@ #include "General.hpp" #include "Structures/StructGraphicInst.hpp" - class StructGraphicBezierInst : public StructGraphicInst { public: - - StructGraphicBezierInst(StreamContext& aCtx) : StructGraphicInst{aCtx} - { } + StructGraphicBezierInst(StreamContext& aCtx) + : StructGraphicInst{aCtx} + { + } std::string to_string() const override; @@ -37,14 +36,11 @@ class StructGraphicBezierInst : public StructGraphicInst } }; - -[[maybe_unused]] -static std::string to_string(const StructGraphicBezierInst& aObj) +[[maybe_unused]] static std::string to_string(const StructGraphicBezierInst& aObj) { return aObj.to_string(); } - inline std::string StructGraphicBezierInst::to_string() const { std::string str; @@ -56,14 +52,11 @@ inline std::string StructGraphicBezierInst::to_string() const return str; } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StructGraphicBezierInst& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StructGraphicBezierInst& aVal) { aOs << to_string(aVal); return aOs; } - #endif // STRUCTGRAPHICBEZIERINST_HPP \ No newline at end of file diff --git a/src/Structures/StructGraphicBitMapInst.cpp b/src/Structures/StructGraphicBitMapInst.cpp index 5da37704..aa74b4a4 100644 --- a/src/Structures/StructGraphicBitMapInst.cpp +++ b/src/Structures/StructGraphicBitMapInst.cpp @@ -9,7 +9,6 @@ #include "GenericParser.hpp" #include "Structures/StructGraphicBitMapInst.hpp" - void StructGraphicBitMapInst::read(FileFormatVersion /* aVersion */) { auto& ds = mCtx.mDs; diff --git a/src/Structures/StructGraphicBitMapInst.hpp b/src/Structures/StructGraphicBitMapInst.hpp index 4b6b8648..4c6b6151 100644 --- a/src/Structures/StructGraphicBitMapInst.hpp +++ b/src/Structures/StructGraphicBitMapInst.hpp @@ -1,7 +1,6 @@ #ifndef STRUCTGRAPHICBITMAPEINST_HPP #define STRUCTGRAPHICBITMAPEINST_HPP - #include #include #include @@ -14,13 +13,13 @@ #include "General.hpp" #include "Structures/StructGraphicInst.hpp" - class StructGraphicBitMapInst : public StructGraphicInst { public: - - StructGraphicBitMapInst(StreamContext& aCtx) : StructGraphicInst{aCtx} - { } + StructGraphicBitMapInst(StreamContext& aCtx) + : StructGraphicInst{aCtx} + { + } std::string to_string() const override; @@ -37,14 +36,11 @@ class StructGraphicBitMapInst : public StructGraphicInst } }; - -[[maybe_unused]] -static std::string to_string(const StructGraphicBitMapInst& aObj) +[[maybe_unused]] static std::string to_string(const StructGraphicBitMapInst& aObj) { return aObj.to_string(); } - inline std::string StructGraphicBitMapInst::to_string() const { std::string str; @@ -56,14 +52,11 @@ inline std::string StructGraphicBitMapInst::to_string() const return str; } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StructGraphicBitMapInst& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StructGraphicBitMapInst& aVal) { aOs << to_string(aVal); return aOs; } - #endif // STRUCTGRAPHICBITMAPEINST_HPP \ No newline at end of file diff --git a/src/Structures/StructGraphicBoxInst.cpp b/src/Structures/StructGraphicBoxInst.cpp index 34df0be7..761d13c2 100644 --- a/src/Structures/StructGraphicBoxInst.cpp +++ b/src/Structures/StructGraphicBoxInst.cpp @@ -9,7 +9,6 @@ #include "GenericParser.hpp" #include "Structures/StructGraphicBoxInst.hpp" - // @todo is this a specialized instance for Rects or general for all types? void StructGraphicBoxInst::read(FileFormatVersion /* aVersion */) { diff --git a/src/Structures/StructGraphicBoxInst.hpp b/src/Structures/StructGraphicBoxInst.hpp index 1a2615fb..c4eff12e 100644 --- a/src/Structures/StructGraphicBoxInst.hpp +++ b/src/Structures/StructGraphicBoxInst.hpp @@ -1,7 +1,6 @@ #ifndef STRUCTGRAPHICBOXINST_HPP #define STRUCTGRAPHICBOXINST_HPP - #include #include #include @@ -14,13 +13,13 @@ #include "General.hpp" #include "Structures/StructGraphicInst.hpp" - class StructGraphicBoxInst : public StructGraphicInst { public: - - StructGraphicBoxInst(StreamContext& aCtx) : StructGraphicInst{aCtx} - { } + StructGraphicBoxInst(StreamContext& aCtx) + : StructGraphicInst{aCtx} + { + } std::string to_string() const override; @@ -37,14 +36,11 @@ class StructGraphicBoxInst : public StructGraphicInst } }; - -[[maybe_unused]] -static std::string to_string(const StructGraphicBoxInst& aObj) +[[maybe_unused]] static std::string to_string(const StructGraphicBoxInst& aObj) { return aObj.to_string(); } - inline std::string StructGraphicBoxInst::to_string() const { std::string str; @@ -56,14 +52,11 @@ inline std::string StructGraphicBoxInst::to_string() const return str; } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StructGraphicBoxInst& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StructGraphicBoxInst& aVal) { aOs << to_string(aVal); return aOs; } - #endif // STRUCTGRAPHICBOXINST_HPP \ No newline at end of file diff --git a/src/Structures/StructGraphicCommentTextInst.cpp b/src/Structures/StructGraphicCommentTextInst.cpp index 94aa1bb1..00ac023b 100644 --- a/src/Structures/StructGraphicCommentTextInst.cpp +++ b/src/Structures/StructGraphicCommentTextInst.cpp @@ -9,7 +9,6 @@ #include "GenericParser.hpp" #include "Structures/StructGraphicCommentTextInst.hpp" - void StructGraphicCommentTextInst::read(FileFormatVersion /* aVersion */) { auto& ds = mCtx.mDs; diff --git a/src/Structures/StructGraphicCommentTextInst.hpp b/src/Structures/StructGraphicCommentTextInst.hpp index 2942dbe2..a3301c8d 100644 --- a/src/Structures/StructGraphicCommentTextInst.hpp +++ b/src/Structures/StructGraphicCommentTextInst.hpp @@ -1,7 +1,6 @@ #ifndef STRUCTGRAPHICCOMMENTTEXTINST_HPP #define STRUCTGRAPHICCOMMENTTEXTINST_HPP - #include #include #include @@ -14,13 +13,13 @@ #include "General.hpp" #include "Structures/StructGraphicInst.hpp" - class StructGraphicCommentTextInst : public StructGraphicInst { public: - - StructGraphicCommentTextInst(StreamContext& aCtx) : StructGraphicInst{aCtx} - { } + StructGraphicCommentTextInst(StreamContext& aCtx) + : StructGraphicInst{aCtx} + { + } std::string to_string() const override; @@ -37,14 +36,11 @@ class StructGraphicCommentTextInst : public StructGraphicInst } }; - -[[maybe_unused]] -static std::string to_string(const StructGraphicCommentTextInst& aObj) +[[maybe_unused]] static std::string to_string(const StructGraphicCommentTextInst& aObj) { return aObj.to_string(); } - inline std::string StructGraphicCommentTextInst::to_string() const { std::string str; @@ -56,14 +52,11 @@ inline std::string StructGraphicCommentTextInst::to_string() const return str; } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StructGraphicCommentTextInst& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StructGraphicCommentTextInst& aVal) { aOs << to_string(aVal); return aOs; } - #endif // STRUCTGRAPHICCOMMENTTEXTINST_HPP \ No newline at end of file diff --git a/src/Structures/StructGraphicEllipseInst.cpp b/src/Structures/StructGraphicEllipseInst.cpp index d886150d..c9136525 100644 --- a/src/Structures/StructGraphicEllipseInst.cpp +++ b/src/Structures/StructGraphicEllipseInst.cpp @@ -9,7 +9,6 @@ #include "GenericParser.hpp" #include "Structures/StructGraphicEllipseInst.hpp" - void StructGraphicEllipseInst::read(FileFormatVersion /* aVersion */) { auto& ds = mCtx.mDs; diff --git a/src/Structures/StructGraphicEllipseInst.hpp b/src/Structures/StructGraphicEllipseInst.hpp index 96690e16..277568f6 100644 --- a/src/Structures/StructGraphicEllipseInst.hpp +++ b/src/Structures/StructGraphicEllipseInst.hpp @@ -1,7 +1,6 @@ #ifndef STRUCTGRAPHICELLIPSEINST_HPP #define STRUCTGRAPHICELLIPSEINST_HPP - #include #include #include @@ -14,13 +13,13 @@ #include "General.hpp" #include "Structures/StructGraphicInst.hpp" - class StructGraphicEllipseInst : public StructGraphicInst { public: - - StructGraphicEllipseInst(StreamContext& aCtx) : StructGraphicInst{aCtx} - { } + StructGraphicEllipseInst(StreamContext& aCtx) + : StructGraphicInst{aCtx} + { + } std::string to_string() const override; @@ -37,14 +36,11 @@ class StructGraphicEllipseInst : public StructGraphicInst } }; - -[[maybe_unused]] -static std::string to_string(const StructGraphicEllipseInst& aObj) +[[maybe_unused]] static std::string to_string(const StructGraphicEllipseInst& aObj) { return aObj.to_string(); } - inline std::string StructGraphicEllipseInst::to_string() const { std::string str; @@ -56,14 +52,11 @@ inline std::string StructGraphicEllipseInst::to_string() const return str; } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StructGraphicEllipseInst& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StructGraphicEllipseInst& aVal) { aOs << to_string(aVal); return aOs; } - #endif // STRUCTGRAPHICELLIPSEINST_HPP \ No newline at end of file diff --git a/src/Structures/StructGraphicInst.cpp b/src/Structures/StructGraphicInst.cpp index 46d5f48f..3298104d 100644 --- a/src/Structures/StructGraphicInst.cpp +++ b/src/Structures/StructGraphicInst.cpp @@ -9,7 +9,6 @@ #include "GenericParser.hpp" #include "Structures/StructGraphicInst.hpp" - void StructGraphicInst::read(FutureDataLst& mLocalFutureLst, FileFormatVersion /* aVersion */) { auto& ds = mCtx.mDs; @@ -52,7 +51,8 @@ void StructGraphicInst::read(FutureDataLst& mLocalFutureLst, FileFormatVersion / mCtx.mLogger.trace("color = {}", ::to_string(color)); ds.printUnknownData(1, getMethodName(this, __func__) + ": StructGraphicInst - 1"); - ds.printUnknownData(1, getMethodName(this, __func__) + ": StructGraphicInst - 2"); // @todo Probably structure ID of current structure + ds.printUnknownData(1, + getMethodName(this, __func__) + ": StructGraphicInst - 2"); // @todo Probably structure ID of current structure ds.printUnknownData(1, getMethodName(this, __func__) + ": StructGraphicInst - 3"); const uint16_t lenSymbolDisplayProps = ds.readUint16(); @@ -92,8 +92,7 @@ void StructGraphicInst::read(FutureDataLst& mLocalFutureLst, FileFormatVersion / break; default: - throw std::runtime_error(fmt::format("Unexpected value {} for unknownFlag", - unknownFlag)); + throw std::runtime_error(fmt::format("Unexpected value {} for unknownFlag", unknownFlag)); break; } diff --git a/src/Structures/StructGraphicInst.hpp b/src/Structures/StructGraphicInst.hpp index ff051dd6..21ebc497 100644 --- a/src/Structures/StructGraphicInst.hpp +++ b/src/Structures/StructGraphicInst.hpp @@ -1,7 +1,6 @@ #ifndef STRUCTGRAPHICINST_HPP #define STRUCTGRAPHICINST_HPP - #include #include #include @@ -17,7 +16,6 @@ #include "Structures/StructSthInPages0.hpp" #include "Structures/StructSymbolDisplayProp.hpp" - /*! * @brief Pseudo structure that does not exist itself. It's only provided to group structures that @@ -27,11 +25,21 @@ class StructGraphicInst : public Record { public: - - StructGraphicInst(StreamContext& aCtx) : Record{aCtx}, name{}, dbId{0}, - locX{0}, locY{0}, x1{0}, y1{0}, x2{0}, y2{0}, color{Color::Default}, symbolDisplayProps{}, - sthInPages0{} - { } + StructGraphicInst(StreamContext& aCtx) + : Record{aCtx}, + name{}, + dbId{0}, + locX{0}, + locY{0}, + x1{0}, + y1{0}, + x2{0}, + y2{0}, + color{Color::Default}, + symbolDisplayProps{}, + sthInPages0{} + { + } std::string to_string() const override; @@ -63,14 +71,11 @@ class StructGraphicInst : public Record std::unique_ptr sthInPages0; }; - -[[maybe_unused]] -static std::string to_string(const StructGraphicInst& aObj) +[[maybe_unused]] static std::string to_string(const StructGraphicInst& aObj) { return aObj.to_string(); } - inline std::string StructGraphicInst::to_string() const { std::string str; @@ -104,14 +109,11 @@ inline std::string StructGraphicInst::to_string() const return str; } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StructGraphicInst& aObj) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StructGraphicInst& aObj) { aOs << to_string(aObj); return aOs; } - #endif // STRUCTGRAPHICINST_HPP \ No newline at end of file diff --git a/src/Structures/StructGraphicLineInst.cpp b/src/Structures/StructGraphicLineInst.cpp index b8ae64c0..59760e74 100644 --- a/src/Structures/StructGraphicLineInst.cpp +++ b/src/Structures/StructGraphicLineInst.cpp @@ -9,7 +9,6 @@ #include "GenericParser.hpp" #include "Structures/StructGraphicLineInst.hpp" - void StructGraphicLineInst::read(FileFormatVersion /* aVersion */) { auto& ds = mCtx.mDs; diff --git a/src/Structures/StructGraphicLineInst.hpp b/src/Structures/StructGraphicLineInst.hpp index 2f41ab2c..a07da643 100644 --- a/src/Structures/StructGraphicLineInst.hpp +++ b/src/Structures/StructGraphicLineInst.hpp @@ -1,7 +1,6 @@ #ifndef STRUCTGRAPHICLINEINST_HPP #define STRUCTGRAPHICLINEINST_HPP - #include #include #include @@ -14,13 +13,13 @@ #include "General.hpp" #include "Structures/StructGraphicInst.hpp" - class StructGraphicLineInst : public StructGraphicInst { public: - - StructGraphicLineInst(StreamContext& aCtx) : StructGraphicInst{aCtx} - { } + StructGraphicLineInst(StreamContext& aCtx) + : StructGraphicInst{aCtx} + { + } std::string to_string() const override; @@ -37,14 +36,11 @@ class StructGraphicLineInst : public StructGraphicInst } }; - -[[maybe_unused]] -static std::string to_string(const StructGraphicLineInst& aObj) +[[maybe_unused]] static std::string to_string(const StructGraphicLineInst& aObj) { return aObj.to_string(); } - inline std::string StructGraphicLineInst::to_string() const { std::string str; @@ -56,14 +52,11 @@ inline std::string StructGraphicLineInst::to_string() const return str; } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StructGraphicLineInst& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StructGraphicLineInst& aVal) { aOs << to_string(aVal); return aOs; } - #endif // STRUCTGRAPHICLINEINST_HPP \ No newline at end of file diff --git a/src/Structures/StructGraphicOleEmbedInst.cpp b/src/Structures/StructGraphicOleEmbedInst.cpp index ad824759..32fc87ad 100644 --- a/src/Structures/StructGraphicOleEmbedInst.cpp +++ b/src/Structures/StructGraphicOleEmbedInst.cpp @@ -9,7 +9,6 @@ #include "GenericParser.hpp" #include "Structures/StructGraphicOleEmbedInst.hpp" - void StructGraphicOleEmbedInst::read(FileFormatVersion /* aVersion */) { auto& ds = mCtx.mDs; diff --git a/src/Structures/StructGraphicOleEmbedInst.hpp b/src/Structures/StructGraphicOleEmbedInst.hpp index aaa4aada..fc794294 100644 --- a/src/Structures/StructGraphicOleEmbedInst.hpp +++ b/src/Structures/StructGraphicOleEmbedInst.hpp @@ -1,7 +1,6 @@ #ifndef STRUCTGRAPHICOLEEMBEDINST_HPP #define STRUCTGRAPHICOLEEMBEDINST_HPP - #include #include #include @@ -14,13 +13,13 @@ #include "General.hpp" #include "Structures/StructGraphicInst.hpp" - class StructGraphicOleEmbedInst : public StructGraphicInst { public: - - StructGraphicOleEmbedInst(StreamContext& aCtx) : StructGraphicInst{aCtx} - { } + StructGraphicOleEmbedInst(StreamContext& aCtx) + : StructGraphicInst{aCtx} + { + } std::string to_string() const override; @@ -37,14 +36,11 @@ class StructGraphicOleEmbedInst : public StructGraphicInst } }; - -[[maybe_unused]] -static std::string to_string(const StructGraphicOleEmbedInst& aObj) +[[maybe_unused]] static std::string to_string(const StructGraphicOleEmbedInst& aObj) { return aObj.to_string(); } - inline std::string StructGraphicOleEmbedInst::to_string() const { std::string str; @@ -56,14 +52,11 @@ inline std::string StructGraphicOleEmbedInst::to_string() const return str; } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StructGraphicOleEmbedInst& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StructGraphicOleEmbedInst& aVal) { aOs << to_string(aVal); return aOs; } - #endif // STRUCTGRAPHICOLEEMBEDINST_HPP \ No newline at end of file diff --git a/src/Structures/StructGraphicPolygonInst.cpp b/src/Structures/StructGraphicPolygonInst.cpp index 25e3e80a..5bf1ad90 100644 --- a/src/Structures/StructGraphicPolygonInst.cpp +++ b/src/Structures/StructGraphicPolygonInst.cpp @@ -9,7 +9,6 @@ #include "GenericParser.hpp" #include "Structures/StructGraphicPolygonInst.hpp" - void StructGraphicPolygonInst::read(FileFormatVersion /* aVersion */) { auto& ds = mCtx.mDs; diff --git a/src/Structures/StructGraphicPolygonInst.hpp b/src/Structures/StructGraphicPolygonInst.hpp index 43a7a712..1e32a5af 100644 --- a/src/Structures/StructGraphicPolygonInst.hpp +++ b/src/Structures/StructGraphicPolygonInst.hpp @@ -1,7 +1,6 @@ #ifndef STRUCTGRAPHICPOLYGONINST_HPP #define STRUCTGRAPHICPOLYGONINST_HPP - #include #include #include @@ -14,13 +13,13 @@ #include "General.hpp" #include "Structures/StructGraphicInst.hpp" - class StructGraphicPolygonInst : public StructGraphicInst { public: - - StructGraphicPolygonInst(StreamContext& aCtx) : StructGraphicInst{aCtx} - { } + StructGraphicPolygonInst(StreamContext& aCtx) + : StructGraphicInst{aCtx} + { + } std::string to_string() const override; @@ -37,14 +36,11 @@ class StructGraphicPolygonInst : public StructGraphicInst } }; - -[[maybe_unused]] -static std::string to_string(const StructGraphicPolygonInst& aObj) +[[maybe_unused]] static std::string to_string(const StructGraphicPolygonInst& aObj) { return aObj.to_string(); } - inline std::string StructGraphicPolygonInst::to_string() const { std::string str; @@ -56,14 +52,11 @@ inline std::string StructGraphicPolygonInst::to_string() const return str; } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StructGraphicPolygonInst& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StructGraphicPolygonInst& aVal) { aOs << to_string(aVal); return aOs; } - #endif // STRUCTGRAPHICPOLYGONINST_HPP \ No newline at end of file diff --git a/src/Structures/StructGraphicPolylineInst.cpp b/src/Structures/StructGraphicPolylineInst.cpp index d6309285..608aa1a2 100644 --- a/src/Structures/StructGraphicPolylineInst.cpp +++ b/src/Structures/StructGraphicPolylineInst.cpp @@ -9,7 +9,6 @@ #include "GenericParser.hpp" #include "Structures/StructGraphicPolylineInst.hpp" - void StructGraphicPolylineInst::read(FileFormatVersion /* aVersion */) { auto& ds = mCtx.mDs; diff --git a/src/Structures/StructGraphicPolylineInst.hpp b/src/Structures/StructGraphicPolylineInst.hpp index 48280619..aedaf0d1 100644 --- a/src/Structures/StructGraphicPolylineInst.hpp +++ b/src/Structures/StructGraphicPolylineInst.hpp @@ -1,7 +1,6 @@ #ifndef STRUCTGRAPHICPOLYLINEINST_HPP #define STRUCTGRAPHICPOLYLINEINST_HPP - #include #include #include @@ -14,13 +13,13 @@ #include "General.hpp" #include "Structures/StructGraphicInst.hpp" - class StructGraphicPolylineInst : public StructGraphicInst { public: - - StructGraphicPolylineInst(StreamContext& aCtx) : StructGraphicInst{aCtx} - { } + StructGraphicPolylineInst(StreamContext& aCtx) + : StructGraphicInst{aCtx} + { + } std::string to_string() const override; @@ -37,14 +36,11 @@ class StructGraphicPolylineInst : public StructGraphicInst } }; - -[[maybe_unused]] -static std::string to_string(const StructGraphicPolylineInst& aObj) +[[maybe_unused]] static std::string to_string(const StructGraphicPolylineInst& aObj) { return aObj.to_string(); } - inline std::string StructGraphicPolylineInst::to_string() const { std::string str; @@ -56,14 +52,11 @@ inline std::string StructGraphicPolylineInst::to_string() const return str; } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StructGraphicPolylineInst& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StructGraphicPolylineInst& aVal) { aOs << to_string(aVal); return aOs; } - #endif // STRUCTGRAPHICPOLYLINEINST_HPP \ No newline at end of file diff --git a/src/Structures/StructLibraryPart.cpp b/src/Structures/StructLibraryPart.cpp index dfc38737..fa361c4a 100644 --- a/src/Structures/StructLibraryPart.cpp +++ b/src/Structures/StructLibraryPart.cpp @@ -13,7 +13,6 @@ #include "GenericParser.hpp" #include "Structures/StructLibraryPart.hpp" - void StructLibraryPart::read(FileFormatVersion /* aVersion */) { auto& ds = mCtx.mDs; @@ -94,7 +93,9 @@ void StructLibraryPart::read(FileFormatVersion /* aVersion */) // @todo Parts of it probably belong to the upper trailing data if(ds.getCurrentOffset() < nextCheckpointPos) + { localFutureLst.readUntilNextFutureData("See FuturData of StructLibraryPart"); + } localFutureLst.checkpoint(); diff --git a/src/Structures/StructLibraryPart.hpp b/src/Structures/StructLibraryPart.hpp index d439b8bf..79e44be5 100644 --- a/src/Structures/StructLibraryPart.hpp +++ b/src/Structures/StructLibraryPart.hpp @@ -1,7 +1,6 @@ #ifndef STRUCTLIBRARYPART_HPP #define STRUCTLIBRARYPART_HPP - #include #include #include @@ -17,14 +16,17 @@ #include "Structures/StructSymbolDisplayProp.hpp" #include "Structures/StructSymbolPin.hpp" - class StructLibraryPart : public Record { public: - - StructLibraryPart(StreamContext& aCtx) : Record{aCtx}, name{}, symbolPins{}, - symbolDisplayProps{}, generalProperties{aCtx} - { } + StructLibraryPart(StreamContext& aCtx) + : Record{aCtx}, + name{}, + symbolPins{}, + symbolDisplayProps{}, + generalProperties{aCtx} + { + } std::string to_string() const override; @@ -42,16 +44,14 @@ class StructLibraryPart : public Record std::string name; - std::vector> primitives; - std::vector> symbolPins; + std::vector> primitives; + std::vector> symbolPins; std::vector> symbolDisplayProps; StructGeneralProperties generalProperties; }; - -[[maybe_unused]] -static std::string to_string(const StructLibraryPart& aObj) +[[maybe_unused]] static std::string to_string(const StructLibraryPart& aObj) { std::string str; @@ -91,20 +91,16 @@ static std::string to_string(const StructLibraryPart& aObj) return str; } - inline std::string StructLibraryPart::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StructLibraryPart& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StructLibraryPart& aVal) { aOs << to_string(aVal); return aOs; } - #endif // STRUCTLIBRARYPART_HPP \ No newline at end of file diff --git a/src/Structures/StructNetDbIdMapping.cpp b/src/Structures/StructNetDbIdMapping.cpp index dbea16b8..4371ecac 100644 --- a/src/Structures/StructNetDbIdMapping.cpp +++ b/src/Structures/StructNetDbIdMapping.cpp @@ -9,7 +9,6 @@ #include "GenericParser.hpp" #include "Structures/StructNetDbIdMapping.hpp" - void StructNetDbIdMapping::read(FileFormatVersion /* aVersion */) { auto& ds = mCtx.mDs; diff --git a/src/Structures/StructNetDbIdMapping.hpp b/src/Structures/StructNetDbIdMapping.hpp index 7d12e6cb..5785b1c1 100644 --- a/src/Structures/StructNetDbIdMapping.hpp +++ b/src/Structures/StructNetDbIdMapping.hpp @@ -1,7 +1,6 @@ #ifndef STRUCTNETDBIDMAPPING_HPP #define STRUCTNETDBIDMAPPING_HPP - #include #include #include @@ -13,13 +12,13 @@ #include "General.hpp" #include "Record.hpp" - class StructNetDbIdMapping : public Record { public: - - StructNetDbIdMapping(StreamContext& aCtx) : Record{aCtx} - { } + StructNetDbIdMapping(StreamContext& aCtx) + : Record{aCtx} + { + } std::string to_string() const override; @@ -34,12 +33,9 @@ class StructNetDbIdMapping : public Record { return Structure::NetDbIdMapping; } - }; - -[[maybe_unused]] -static std::string to_string(const StructNetDbIdMapping& aObj) +[[maybe_unused]] static std::string to_string(const StructNetDbIdMapping& aObj) { std::string str; @@ -48,20 +44,16 @@ static std::string to_string(const StructNetDbIdMapping& aObj) return str; } - inline std::string StructNetDbIdMapping::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StructNetDbIdMapping& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StructNetDbIdMapping& aVal) { aOs << to_string(aVal); return aOs; } - #endif // STRUCTNETDBIDMAPPING_HPP \ No newline at end of file diff --git a/src/Structures/StructOffPageConnector.cpp b/src/Structures/StructOffPageConnector.cpp index 2295df2e..da4b8520 100644 --- a/src/Structures/StructOffPageConnector.cpp +++ b/src/Structures/StructOffPageConnector.cpp @@ -9,7 +9,6 @@ #include "GenericParser.hpp" #include "Structures/StructOffPageConnector.hpp" - void StructOffPageConnector::read(FileFormatVersion /* aVersion */) { auto& ds = mCtx.mDs; diff --git a/src/Structures/StructOffPageConnector.hpp b/src/Structures/StructOffPageConnector.hpp index 9b6a6942..1f7a7582 100644 --- a/src/Structures/StructOffPageConnector.hpp +++ b/src/Structures/StructOffPageConnector.hpp @@ -1,7 +1,6 @@ #ifndef STRUCTOFFPAGECONNECTOR_HPP #define STRUCTOFFPAGECONNECTOR_HPP - #include #include #include @@ -15,13 +14,13 @@ #include "General.hpp" #include "Structures/StructGraphicInst.hpp" - class StructOffPageConnector : public StructGraphicInst { public: - - StructOffPageConnector(StreamContext& aCtx) : StructGraphicInst{aCtx} - { } + StructOffPageConnector(StreamContext& aCtx) + : StructGraphicInst{aCtx} + { + } std::string to_string() const override; @@ -38,14 +37,11 @@ class StructOffPageConnector : public StructGraphicInst } }; - -[[maybe_unused]] -static std::string to_string(const StructOffPageConnector& aObj) +[[maybe_unused]] static std::string to_string(const StructOffPageConnector& aObj) { return aObj.to_string(); } - inline std::string StructOffPageConnector::to_string() const { std::string str; @@ -57,14 +53,11 @@ inline std::string StructOffPageConnector::to_string() const return str; } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StructOffPageConnector& aObj) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StructOffPageConnector& aObj) { aOs << to_string(aObj); return aOs; } - #endif // STRUCTOFFPAGECONNECTOR_HPP \ No newline at end of file diff --git a/src/Structures/StructOffPageSymbol.cpp b/src/Structures/StructOffPageSymbol.cpp index 1b78953c..f456cb6d 100644 --- a/src/Structures/StructOffPageSymbol.cpp +++ b/src/Structures/StructOffPageSymbol.cpp @@ -9,7 +9,6 @@ #include "GenericParser.hpp" #include "Structures/StructOffPageSymbol.hpp" - void StructOffPageSymbol::read(FileFormatVersion aVersion) { auto& ds = mCtx.mDs; diff --git a/src/Structures/StructOffPageSymbol.hpp b/src/Structures/StructOffPageSymbol.hpp index 67caa69d..504129cf 100644 --- a/src/Structures/StructOffPageSymbol.hpp +++ b/src/Structures/StructOffPageSymbol.hpp @@ -1,7 +1,6 @@ #ifndef STRUCTOFFPAGESYMBOL_HPP #define STRUCTOFFPAGESYMBOL_HPP - #include #include #include @@ -17,14 +16,15 @@ #include "Structures/StructSymbolDisplayProp.hpp" #include "Structures/StructSymbolPin.hpp" - class StructOffPageSymbol : public StructSymbol { public: - - StructOffPageSymbol(StreamContext& aCtx) : StructSymbol{aCtx}, - symbolPins{}, symbolDisplayProps{} - { } + StructOffPageSymbol(StreamContext& aCtx) + : StructSymbol{aCtx}, + symbolPins{}, + symbolDisplayProps{} + { + } std::string to_string() const override; @@ -40,13 +40,11 @@ class StructOffPageSymbol : public StructSymbol return Structure::OffPageSymbol; } - std::vector> symbolPins; + std::vector> symbolPins; std::vector> symbolDisplayProps; }; - -[[maybe_unused]] -static std::string to_string(const StructOffPageSymbol& aObj) +[[maybe_unused]] static std::string to_string(const StructOffPageSymbol& aObj) { std::string str; @@ -76,20 +74,16 @@ static std::string to_string(const StructOffPageSymbol& aObj) return str; } - inline std::string StructOffPageSymbol::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StructOffPageSymbol& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StructOffPageSymbol& aVal) { aOs << to_string(aVal); return aOs; } - #endif // STRUCTOFFPAGESYMBOL_HPP \ No newline at end of file diff --git a/src/Structures/StructPackage.cpp b/src/Structures/StructPackage.cpp index 6790d0e2..4302b81b 100644 --- a/src/Structures/StructPackage.cpp +++ b/src/Structures/StructPackage.cpp @@ -12,7 +12,6 @@ #include "GenericParser.hpp" #include "Structures/StructPackage.hpp" - // @todo Probably specifies the 'Package Properties' void StructPackage::read(FileFormatVersion /* aVersion */) { diff --git a/src/Structures/StructPackage.hpp b/src/Structures/StructPackage.hpp index 4d296da0..d1a864c3 100644 --- a/src/Structures/StructPackage.hpp +++ b/src/Structures/StructPackage.hpp @@ -1,7 +1,6 @@ #ifndef STRUCTPACKAGE_HPP #define STRUCTPACKAGE_HPP - #include #include #include @@ -17,10 +16,13 @@ class StructPackage : public Record { public: - - StructPackage(StreamContext& aCtx) : Record{aCtx}, name{}, - refDes{}, pcbFootprint{} - { } + StructPackage(StreamContext& aCtx) + : Record{aCtx}, + name{}, + refDes{}, + pcbFootprint{} + { + } std::string to_string() const override; @@ -45,9 +47,7 @@ class StructPackage : public Record std::vector> devices; }; - -[[maybe_unused]] -static std::string to_string(const StructPackage& aObj) +[[maybe_unused]] static std::string to_string(const StructPackage& aObj) { std::string str; @@ -68,20 +68,16 @@ static std::string to_string(const StructPackage& aObj) return str; } - inline std::string StructPackage::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StructPackage& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StructPackage& aVal) { aOs << to_string(aVal); return aOs; } - #endif // STRUCTPACKAGE_HPP \ No newline at end of file diff --git a/src/Structures/StructPartCell.cpp b/src/Structures/StructPartCell.cpp index 65ce8fd7..a0d9717f 100644 --- a/src/Structures/StructPartCell.cpp +++ b/src/Structures/StructPartCell.cpp @@ -13,7 +13,6 @@ #include "GenericParser.hpp" #include "Structures/StructPartCell.hpp" - void StructPartCell::read(FileFormatVersion /* aVersion */) { auto& ds = mCtx.mDs; @@ -41,9 +40,9 @@ void StructPartCell::read(FileFormatVersion /* aVersion */) // @todo use enum for the view (normal/convert) const uint16_t viewNumber = ds.readUint16(); // @todo I assume that this is the amount of views - // the symbol has. Typically 1 (.Normal) or maybe - // 2 with (.Normal and .Convert) - // @todo Add to obj + // the symbol has. Typically 1 (.Normal) or maybe + // 2 with (.Normal and .Convert) + // @todo Add to obj mCtx.mLogger.trace("viewNumber = {}", viewNumber); @@ -54,7 +53,7 @@ void StructPartCell::read(FileFormatVersion /* aVersion */) if(viewNumber == 2U) // Contains ".Normal" and ".Convert" { - normalName = ds.readStringLenZeroTerm(); + normalName = ds.readStringLenZeroTerm(); convertName = ds.readStringLenZeroTerm(); } @@ -63,8 +62,7 @@ void StructPartCell::read(FileFormatVersion /* aVersion */) if(viewNumber != 1U && viewNumber != 2U) { - const std::string msg = fmt::format("viewNumber = {} but expected it to be 1 or 2!", - viewNumber); + const std::string msg = fmt::format("viewNumber = {} but expected it to be 1 or 2!", viewNumber); mCtx.mLogger.error(msg); throw std::runtime_error(msg); diff --git a/src/Structures/StructPartCell.hpp b/src/Structures/StructPartCell.hpp index 1078633b..3ed284d0 100644 --- a/src/Structures/StructPartCell.hpp +++ b/src/Structures/StructPartCell.hpp @@ -1,7 +1,6 @@ #ifndef STRUCTPARTCELL_HPP #define STRUCTPARTCELL_HPP - #include #include #include @@ -11,14 +10,16 @@ #include "Record.hpp" - class StructPartCell : public Record { public: - - StructPartCell(StreamContext& aCtx) : Record{aCtx}, ref{}, - normalName{}, convertName{} - { } + StructPartCell(StreamContext& aCtx) + : Record{aCtx}, + ref{}, + normalName{}, + convertName{} + { + } std::string to_string() const override; @@ -39,9 +40,7 @@ class StructPartCell : public Record std::string convertName; }; - -[[maybe_unused]] -static std::string to_string(const StructPartCell& aObj) +[[maybe_unused]] static std::string to_string(const StructPartCell& aObj) { std::string str; @@ -53,20 +52,16 @@ static std::string to_string(const StructPartCell& aObj) return str; } - inline std::string StructPartCell::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StructPartCell& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StructPartCell& aVal) { aOs << to_string(aVal); return aOs; } - #endif // STRUCTPARTCELL_HPP \ No newline at end of file diff --git a/src/Structures/StructPinShapeSymbol.cpp b/src/Structures/StructPinShapeSymbol.cpp index ed38c1c8..fdbd064f 100644 --- a/src/Structures/StructPinShapeSymbol.cpp +++ b/src/Structures/StructPinShapeSymbol.cpp @@ -10,7 +10,6 @@ #include "GenericParser.hpp" #include "Structures/StructPinShapeSymbol.hpp" - void StructPinShapeSymbol::read(FileFormatVersion aVersion) { auto& ds = mCtx.mDs; diff --git a/src/Structures/StructPinShapeSymbol.hpp b/src/Structures/StructPinShapeSymbol.hpp index 084c1f99..e7b6bbe7 100644 --- a/src/Structures/StructPinShapeSymbol.hpp +++ b/src/Structures/StructPinShapeSymbol.hpp @@ -1,7 +1,6 @@ #ifndef STRUCTPINSHAPESYMBOL_HPP #define STRUCTPINSHAPESYMBOL_HPP - #include #include #include @@ -16,14 +15,15 @@ #include "Structures/StructSymbolDisplayProp.hpp" #include "Structures/StructSymbolPin.hpp" - class StructPinShapeSymbol : public StructSymbol { public: - - StructPinShapeSymbol(StreamContext& aCtx) : StructSymbol{aCtx}, - symbolPins{}, symbolDisplayProps{} - { } + StructPinShapeSymbol(StreamContext& aCtx) + : StructSymbol{aCtx}, + symbolPins{}, + symbolDisplayProps{} + { + } std::string to_string() const override; @@ -39,13 +39,11 @@ class StructPinShapeSymbol : public StructSymbol return Structure::PinShapeSymbol; } - std::vector> symbolPins; + std::vector> symbolPins; std::vector> symbolDisplayProps; }; - -[[maybe_unused]] -static std::string to_string(const StructPinShapeSymbol& aObj) +[[maybe_unused]] static std::string to_string(const StructPinShapeSymbol& aObj) { std::string str; @@ -75,20 +73,16 @@ static std::string to_string(const StructPinShapeSymbol& aObj) return str; } - inline std::string StructPinShapeSymbol::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StructPinShapeSymbol& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StructPinShapeSymbol& aVal) { aOs << to_string(aVal); return aOs; } - #endif // STRUCTPINSHAPESYMBOL_HPP \ No newline at end of file diff --git a/src/Structures/StructPlacedInstance.cpp b/src/Structures/StructPlacedInstance.cpp index 8ba6a968..ecb5a79e 100644 --- a/src/Structures/StructPlacedInstance.cpp +++ b/src/Structures/StructPlacedInstance.cpp @@ -14,7 +14,6 @@ #include "GenericParser.hpp" #include "Structures/StructPlacedInstance.hpp" - void StructPlacedInstance::read(FileFormatVersion /* aVersion */) { auto& ds = mCtx.mDs; diff --git a/src/Structures/StructPlacedInstance.hpp b/src/Structures/StructPlacedInstance.hpp index 3fccf138..d83dc830 100644 --- a/src/Structures/StructPlacedInstance.hpp +++ b/src/Structures/StructPlacedInstance.hpp @@ -1,7 +1,6 @@ #ifndef STRUCTPLACEDINSTANCE_HPP #define STRUCTPLACEDINSTANCE_HPP - #include #include #include @@ -17,14 +16,15 @@ #include "Structures/StructSymbolDisplayProp.hpp" #include "Structures/StructT0x10.hpp" - class StructPlacedInstance : public Record { public: - - StructPlacedInstance(StreamContext& aCtx) : Record{aCtx}, symbolDisplayProps{}, - t0x10s{} - { } + StructPlacedInstance(StreamContext& aCtx) + : Record{aCtx}, + symbolDisplayProps{}, + t0x10s{} + { + } std::string to_string() const override; @@ -41,12 +41,10 @@ class StructPlacedInstance : public Record } std::vector> symbolDisplayProps; - std::vector> t0x10s; + std::vector> t0x10s; }; - -[[maybe_unused]] -static std::string to_string(const StructPlacedInstance& aObj) +[[maybe_unused]] static std::string to_string(const StructPlacedInstance& aObj) { std::string str; @@ -73,20 +71,16 @@ static std::string to_string(const StructPlacedInstance& aObj) return str; } - inline std::string StructPlacedInstance::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StructPlacedInstance& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StructPlacedInstance& aVal) { aOs << to_string(aVal); return aOs; } - #endif // STRUCTPLACEDINSTANCE_HPP \ No newline at end of file diff --git a/src/Structures/StructPort.cpp b/src/Structures/StructPort.cpp index 9e4868e6..c99f5265 100644 --- a/src/Structures/StructPort.cpp +++ b/src/Structures/StructPort.cpp @@ -9,7 +9,6 @@ #include "GenericParser.hpp" #include "Structures/StructPort.hpp" - void StructPort::read(FileFormatVersion /* aVersion */) { auto& ds = mCtx.mDs; diff --git a/src/Structures/StructPort.hpp b/src/Structures/StructPort.hpp index 31522f14..416a7ad7 100644 --- a/src/Structures/StructPort.hpp +++ b/src/Structures/StructPort.hpp @@ -1,7 +1,6 @@ #ifndef STRUCTPORT_HPP #define STRUCTPORT_HPP - #include #include #include @@ -15,13 +14,13 @@ #include "General.hpp" #include "Structures/StructGraphicInst.hpp" - class StructPort : public StructGraphicInst { public: - - StructPort(StreamContext& aCtx) : StructGraphicInst{aCtx} - { } + StructPort(StreamContext& aCtx) + : StructGraphicInst{aCtx} + { + } std::string to_string() const override; @@ -38,14 +37,11 @@ class StructPort : public StructGraphicInst } }; - -[[maybe_unused]] -static std::string to_string(const StructPort& aObj) +[[maybe_unused]] static std::string to_string(const StructPort& aObj) { return aObj.to_string(); } - inline std::string StructPort::to_string() const { std::string str; @@ -57,14 +53,11 @@ inline std::string StructPort::to_string() const return str; } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StructPort& aObj) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StructPort& aObj) { aOs << to_string(aObj); return aOs; } - #endif // STRUCTPORT_HPP \ No newline at end of file diff --git a/src/Structures/StructPortSymbol.cpp b/src/Structures/StructPortSymbol.cpp index 61cec991..c678c3ef 100644 --- a/src/Structures/StructPortSymbol.cpp +++ b/src/Structures/StructPortSymbol.cpp @@ -8,7 +8,6 @@ #include "Structures/StructLibraryPart.hpp" #include "Structures/StructPortSymbol.hpp" - void StructPortSymbol::read(FileFormatVersion /* aVersion */) { auto& ds = mCtx.mDs; diff --git a/src/Structures/StructPortSymbol.hpp b/src/Structures/StructPortSymbol.hpp index 9cc9a537..fc2cd84f 100644 --- a/src/Structures/StructPortSymbol.hpp +++ b/src/Structures/StructPortSymbol.hpp @@ -1,7 +1,6 @@ #ifndef STRUCTPORTSYMBOL_HPP #define STRUCTPORTSYMBOL_HPP - #include #include #include @@ -13,13 +12,13 @@ #include "General.hpp" #include "Structures/StructSymbol.hpp" - class StructPortSymbol : public StructSymbol { public: - - StructPortSymbol(StreamContext& aCtx) : StructSymbol{aCtx} - { } + StructPortSymbol(StreamContext& aCtx) + : StructSymbol{aCtx} + { + } std::string to_string() const override; @@ -36,9 +35,7 @@ class StructPortSymbol : public StructSymbol } }; - -[[maybe_unused]] -static std::string to_string(const StructPortSymbol& aObj) +[[maybe_unused]] static std::string to_string(const StructPortSymbol& aObj) { std::string str; @@ -47,20 +44,16 @@ static std::string to_string(const StructPortSymbol& aObj) return str; } - inline std::string StructPortSymbol::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StructPortSymbol& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StructPortSymbol& aVal) { aOs << to_string(aVal); return aOs; } - #endif // STRUCTPORTSYMBOL_HPP \ No newline at end of file diff --git a/src/Structures/StructSomeHierarchyBase.hpp b/src/Structures/StructSomeHierarchyBase.hpp index e724cb4e..be29c59d 100644 --- a/src/Structures/StructSomeHierarchyBase.hpp +++ b/src/Structures/StructSomeHierarchyBase.hpp @@ -1,7 +1,6 @@ #ifndef STRUCTSOMEHIERARCHYBASE_HPP #define STRUCTSOMEHIERARCHYBASE_HPP - #include #include #include @@ -13,7 +12,6 @@ #include "General.hpp" #include "Record.hpp" - /*! * @brief Pseudo structure that does not exist itself. It's only provided to group structures that @@ -23,9 +21,10 @@ class StructSomeHierarchyBase : public Record { public: - - StructSomeHierarchyBase(StreamContext& aCtx) : Record{aCtx} - { } + StructSomeHierarchyBase(StreamContext& aCtx) + : Record{aCtx} + { + } // std::string to_string() const override; @@ -35,12 +34,9 @@ class StructSomeHierarchyBase : public Record // } // void read(FileFormatVersion aVersion = FileFormatVersion::Unknown) override; - }; - -[[maybe_unused]] -static std::string to_string(const StructSomeHierarchyBase& aObj) +[[maybe_unused]] static std::string to_string(const StructSomeHierarchyBase& aObj) { std::string str; @@ -49,14 +45,11 @@ static std::string to_string(const StructSomeHierarchyBase& aObj) return str; } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StructSomeHierarchyBase& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StructSomeHierarchyBase& aVal) { aOs << to_string(aVal); return aOs; } - #endif // STRUCTSOMEHIERARCHYBASE_HPP \ No newline at end of file diff --git a/src/Structures/StructSthInHierarchy1.cpp b/src/Structures/StructSthInHierarchy1.cpp index 4824cfcb..e2e24799 100644 --- a/src/Structures/StructSthInHierarchy1.cpp +++ b/src/Structures/StructSthInHierarchy1.cpp @@ -9,7 +9,6 @@ #include "GenericParser.hpp" #include "Structures/StructSthInHierarchy1.hpp" - void StructSthInHierarchy1::read(FileFormatVersion /* aVersion */) { auto& ds = mCtx.mDs; diff --git a/src/Structures/StructSthInHierarchy1.hpp b/src/Structures/StructSthInHierarchy1.hpp index c7f0ddda..64413627 100644 --- a/src/Structures/StructSthInHierarchy1.hpp +++ b/src/Structures/StructSthInHierarchy1.hpp @@ -1,7 +1,6 @@ #ifndef STRUCTSTHINHIERARCHY1_HPP #define STRUCTSTHINHIERARCHY1_HPP - #include #include #include @@ -13,13 +12,13 @@ #include "General.hpp" #include "Record.hpp" - class StructSthInHierarchy1 : public Record { public: - - StructSthInHierarchy1(StreamContext& aCtx) : Record{aCtx} - { } + StructSthInHierarchy1(StreamContext& aCtx) + : Record{aCtx} + { + } std::string to_string() const override; @@ -34,12 +33,9 @@ class StructSthInHierarchy1 : public Record { return Structure::SthInHierarchy1; } - }; - -[[maybe_unused]] -static std::string to_string(const StructSthInHierarchy1& aObj) +[[maybe_unused]] static std::string to_string(const StructSthInHierarchy1& aObj) { std::string str; @@ -48,20 +44,16 @@ static std::string to_string(const StructSthInHierarchy1& aObj) return str; } - inline std::string StructSthInHierarchy1::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StructSthInHierarchy1& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StructSthInHierarchy1& aVal) { aOs << to_string(aVal); return aOs; } - #endif // STRUCTSTHINHIERARCHY1_HPP \ No newline at end of file diff --git a/src/Structures/StructSthInHierarchy2.cpp b/src/Structures/StructSthInHierarchy2.cpp index 123b2b34..191958ff 100644 --- a/src/Structures/StructSthInHierarchy2.cpp +++ b/src/Structures/StructSthInHierarchy2.cpp @@ -9,7 +9,6 @@ #include "GenericParser.hpp" #include "Structures/StructSthInHierarchy2.hpp" - void StructSthInHierarchy2::read(FileFormatVersion /* aVersion */) { auto& ds = mCtx.mDs; diff --git a/src/Structures/StructSthInHierarchy2.hpp b/src/Structures/StructSthInHierarchy2.hpp index 8dd4a541..60bcaf97 100644 --- a/src/Structures/StructSthInHierarchy2.hpp +++ b/src/Structures/StructSthInHierarchy2.hpp @@ -1,7 +1,6 @@ #ifndef STRUCTSTHINHIERARCHY2_HPP #define STRUCTSTHINHIERARCHY2_HPP - #include #include #include @@ -13,13 +12,13 @@ #include "General.hpp" #include "StructSomeHierarchyBase.hpp" - class StructSthInHierarchy2 : public StructSomeHierarchyBase { public: - - StructSthInHierarchy2(StreamContext& aCtx) : StructSomeHierarchyBase{aCtx} - { } + StructSthInHierarchy2(StreamContext& aCtx) + : StructSomeHierarchyBase{aCtx} + { + } std::string to_string() const override; @@ -34,12 +33,9 @@ class StructSthInHierarchy2 : public StructSomeHierarchyBase { return Structure::SthInHierarchy2; } - }; - -[[maybe_unused]] -static std::string to_string(const StructSthInHierarchy2& aObj) +[[maybe_unused]] static std::string to_string(const StructSthInHierarchy2& aObj) { std::string str; @@ -48,20 +44,16 @@ static std::string to_string(const StructSthInHierarchy2& aObj) return str; } - inline std::string StructSthInHierarchy2::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StructSthInHierarchy2& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StructSthInHierarchy2& aVal) { aOs << to_string(aVal); return aOs; } - #endif // STRUCTSTHINHIERARCHY2_HPP \ No newline at end of file diff --git a/src/Structures/StructSthInHierarchy3.cpp b/src/Structures/StructSthInHierarchy3.cpp index e174455e..46fe0deb 100644 --- a/src/Structures/StructSthInHierarchy3.cpp +++ b/src/Structures/StructSthInHierarchy3.cpp @@ -9,7 +9,6 @@ #include "GenericParser.hpp" #include "Structures/StructSthInHierarchy3.hpp" - void StructSthInHierarchy3::read(FileFormatVersion /* aVersion */) { auto& ds = mCtx.mDs; diff --git a/src/Structures/StructSthInHierarchy3.hpp b/src/Structures/StructSthInHierarchy3.hpp index 8f7ed2a0..76b5c9bb 100644 --- a/src/Structures/StructSthInHierarchy3.hpp +++ b/src/Structures/StructSthInHierarchy3.hpp @@ -1,7 +1,6 @@ #ifndef STRUCTSTHINHIERARCHY3_HPP #define STRUCTSTHINHIERARCHY3_HPP - #include #include #include @@ -13,13 +12,13 @@ #include "General.hpp" #include "Record.hpp" - class StructSthInHierarchy3 : public Record { public: - - StructSthInHierarchy3(StreamContext& aCtx) : Record{aCtx} - { } + StructSthInHierarchy3(StreamContext& aCtx) + : Record{aCtx} + { + } std::string to_string() const override; @@ -36,9 +35,7 @@ class StructSthInHierarchy3 : public Record } }; - -[[maybe_unused]] -static std::string to_string(const StructSthInHierarchy3& aObj) +[[maybe_unused]] static std::string to_string(const StructSthInHierarchy3& aObj) { std::string str; @@ -47,20 +44,16 @@ static std::string to_string(const StructSthInHierarchy3& aObj) return str; } - inline std::string StructSthInHierarchy3::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StructSthInHierarchy3& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StructSthInHierarchy3& aVal) { aOs << to_string(aVal); return aOs; } - #endif // STRUCTSTHINHIERARCHY3_HPP \ No newline at end of file diff --git a/src/Structures/StructSthInPages0.cpp b/src/Structures/StructSthInPages0.cpp index 7bd0eb83..925b01f0 100644 --- a/src/Structures/StructSthInPages0.cpp +++ b/src/Structures/StructSthInPages0.cpp @@ -11,7 +11,6 @@ #include "GenericParser.hpp" #include "Structures/StructSthInPages0.hpp" - // @todo Probably a wrapper for Inst (Instances) void StructSthInPages0::read(FileFormatVersion aVersion) { @@ -36,7 +35,6 @@ void StructSthInPages0::read(FileFormatVersion aVersion) mCtx.mLogger.trace(to_string()); } - void StructSthInPages0::read_raw(FileFormatVersion /* aVersion */, FutureDataLst& aLocalFutureLst) { auto& ds = mCtx.mDs; diff --git a/src/Structures/StructSthInPages0.hpp b/src/Structures/StructSthInPages0.hpp index 59905317..31cea657 100644 --- a/src/Structures/StructSthInPages0.hpp +++ b/src/Structures/StructSthInPages0.hpp @@ -1,7 +1,6 @@ #ifndef STRUCTSTHINPAGES0_HPP #define STRUCTSTHINPAGES0_HPP - #include #include #include @@ -18,14 +17,17 @@ #include "Primitives/PrimBase.hpp" #include "Record.hpp" - class StructSthInPages0 : public Record { public: - - StructSthInPages0(StreamContext& aCtx) : Record{aCtx}, - name{}, sourceLibrary{}, color{Color::Default}, primitives{} - { } + StructSthInPages0(StreamContext& aCtx) + : Record{aCtx}, + name{}, + sourceLibrary{}, + color{Color::Default}, + primitives{} + { + } std::string to_string() const override; @@ -48,14 +50,12 @@ class StructSthInPages0 : public Record // Absolute path std::string sourceLibrary; - Color color; + Color color; std::vector> primitives; }; - -[[maybe_unused]] -static std::string to_string(const StructSthInPages0& aObj) +[[maybe_unused]] static std::string to_string(const StructSthInPages0& aObj) { std::string str; @@ -76,20 +76,16 @@ static std::string to_string(const StructSthInPages0& aObj) return str; } - inline std::string StructSthInPages0::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StructSthInPages0& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StructSthInPages0& aVal) { aOs << to_string(aVal); return aOs; } - #endif // STRUCTSTHINPAGES0_HPP \ No newline at end of file diff --git a/src/Structures/StructSymbol.hpp b/src/Structures/StructSymbol.hpp index 1be36a47..870abd77 100644 --- a/src/Structures/StructSymbol.hpp +++ b/src/Structures/StructSymbol.hpp @@ -1,7 +1,6 @@ #ifndef STRUCTSYMBOL_HPP #define STRUCTSYMBOL_HPP - #include #include #include @@ -12,7 +11,6 @@ #include "General.hpp" #include "Structures/StructSthInPages0.hpp" - /*! * @brief Pseudo structure that does not exist itself. It's only provided to group structures that @@ -22,18 +20,17 @@ class StructSymbol : public StructSthInPages0 { public: - - StructSymbol(StreamContext& aCtx) : StructSthInPages0{aCtx} - { } + StructSymbol(StreamContext& aCtx) + : StructSthInPages0{aCtx} + { + } std::string to_string() const override; // void read(FileFormatVersion aVersion = FileFormatVersion::Unknown) override; }; - -[[maybe_unused]] -static std::string to_string(const StructSymbol& aObj) +[[maybe_unused]] static std::string to_string(const StructSymbol& aObj) { std::string str; @@ -42,20 +39,16 @@ static std::string to_string(const StructSymbol& aObj) return str; } - inline std::string StructSymbol::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StructSymbol& aObj) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StructSymbol& aObj) { aOs << to_string(aObj); return aOs; } - #endif // STRUCTSYMBOL_HPP \ No newline at end of file diff --git a/src/Structures/StructSymbolBBox.cpp b/src/Structures/StructSymbolBBox.cpp index 8147f342..6b24f233 100644 --- a/src/Structures/StructSymbolBBox.cpp +++ b/src/Structures/StructSymbolBBox.cpp @@ -8,7 +8,6 @@ #include "General.hpp" #include "Structures/StructSymbolBBox.hpp" - // @todo is probably trailing data and not a struct object! void StructSymbolBBox::read(FileFormatVersion /* aVersion */) { diff --git a/src/Structures/StructSymbolBBox.hpp b/src/Structures/StructSymbolBBox.hpp index 32f60a14..f4fdd354 100644 --- a/src/Structures/StructSymbolBBox.hpp +++ b/src/Structures/StructSymbolBBox.hpp @@ -1,7 +1,6 @@ #ifndef STRUCTSYMBOLBBOX_HPP #define STRUCTSYMBOLBBOX_HPP - #include #include #include @@ -12,13 +11,17 @@ #include "General.hpp" #include "Record.hpp" - class StructSymbolBBox : public Other { public: - - StructSymbolBBox(StreamContext& aCtx) : Other{aCtx}, x1{0}, y1{0}, x2{0}, y2{0} - { } + StructSymbolBBox(StreamContext& aCtx) + : Other{aCtx}, + x1{0}, + y1{0}, + x2{0}, + y2{0} + { + } std::string to_string() const override; @@ -37,9 +40,7 @@ class StructSymbolBBox : public Other int32_t y2; }; - -[[maybe_unused]] -static std::string to_string(const StructSymbolBBox& aObj) +[[maybe_unused]] static std::string to_string(const StructSymbolBBox& aObj) { std::string str; @@ -52,20 +53,16 @@ static std::string to_string(const StructSymbolBBox& aObj) return str; } - inline std::string StructSymbolBBox::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StructSymbolBBox& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StructSymbolBBox& aVal) { aOs << to_string(aVal); return aOs; } - #endif // STRUCTSYMBOLBBOX_HPP \ No newline at end of file diff --git a/src/Structures/StructSymbolDisplayProp.cpp b/src/Structures/StructSymbolDisplayProp.cpp index 0c2baf9a..21908475 100644 --- a/src/Structures/StructSymbolDisplayProp.cpp +++ b/src/Structures/StructSymbolDisplayProp.cpp @@ -11,7 +11,6 @@ #include "GetStreamHelper.hpp" #include "Structures/StructSymbolDisplayProp.hpp" - void StructSymbolDisplayProp::read(FileFormatVersion /* aVersion */) { auto& ds = mCtx.mDs; @@ -54,12 +53,12 @@ void StructSymbolDisplayProp::read(FileFormatVersion /* aVersion */) { RotFontIdBitField(uint16_t aInit) { - textFontIdx = (aInit & 0x3fff) >> 0U; + textFontIdx = (aInit & 0x3fff) >> 0U; rotation = (aInit & 0xc000) >> 14U; } uint16_t textFontIdx : 14; // 13 downto 0 - uint16_t rotation : 2; // 15 downto 14 + uint16_t rotation : 2; // 15 downto 14 }; const RotFontIdBitField rotFontIdBitField{ds.readUint16()}; @@ -75,8 +74,8 @@ void StructSymbolDisplayProp::read(FileFormatVersion /* aVersion */) { if(textFontIdx >= lib->textFonts.size()) { - const std::string msg = fmt::format("{}: textFontIdx is out of range! Expected {} < {}!", - __func__, textFontIdx, lib->textFonts.size()); + const std::string msg = fmt::format( + "{}: textFontIdx is out of range! Expected {} < {}!", __func__, textFontIdx, lib->textFonts.size()); mCtx.mLogger.warn(msg); // throw std::out_of_range(msg); diff --git a/src/Structures/StructSymbolDisplayProp.hpp b/src/Structures/StructSymbolDisplayProp.hpp index a4df7e23..9e10a3c2 100644 --- a/src/Structures/StructSymbolDisplayProp.hpp +++ b/src/Structures/StructSymbolDisplayProp.hpp @@ -1,7 +1,6 @@ #ifndef STRUCTSYMBOLDISPLAYPROP_HPP #define STRUCTSYMBOLDISPLAYPROP_HPP - #include #include #include @@ -13,14 +12,19 @@ #include "Enums/Rotation.hpp" #include "Record.hpp" - class StructSymbolDisplayProp : public Record { public: - - StructSymbolDisplayProp(StreamContext& aCtx) : Record{aCtx}, nameIdx{0}, textFontIdx{0}, - rotation{Rotation::Deg_0}, x{0}, y{0}, propColor{Color::Default} - { } + StructSymbolDisplayProp(StreamContext& aCtx) + : Record{aCtx}, + nameIdx{0}, + textFontIdx{0}, + rotation{Rotation::Deg_0}, + x{0}, + y{0}, + propColor{Color::Default} + { + } std::string to_string() const override; @@ -49,8 +53,7 @@ class StructSymbolDisplayProp : public Record // @todo implement getter methods for name and textFont -[[maybe_unused]] -static std::string to_string(const StructSymbolDisplayProp& aObj) +[[maybe_unused]] static std::string to_string(const StructSymbolDisplayProp& aObj) { std::string str; @@ -65,20 +68,16 @@ static std::string to_string(const StructSymbolDisplayProp& aObj) return str; } - inline std::string StructSymbolDisplayProp::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StructSymbolDisplayProp& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StructSymbolDisplayProp& aVal) { aOs << to_string(aVal); return aOs; } - #endif // STRUCTSYMBOLDISPLAYPROP_HPP \ No newline at end of file diff --git a/src/Structures/StructSymbolPin.cpp b/src/Structures/StructSymbolPin.cpp index 755284ed..fe85c088 100644 --- a/src/Structures/StructSymbolPin.cpp +++ b/src/Structures/StructSymbolPin.cpp @@ -14,13 +14,11 @@ #include "PinShape.hpp" #include "Structures/StructSymbolPin.hpp" - void StructSymbolPin::read(FileFormatVersion /* aVersion */) { auto& ds = mCtx.mDs; GenericParser parser{mCtx}; - mCtx.mLogger.debug(getOpeningMsg(getMethodName(this, __func__), ds.getCurrentOffset())); FutureDataLst localFutureLst{mCtx}; @@ -63,7 +61,6 @@ void StructSymbolPin::read(FileFormatVersion /* aVersion */) mCtx.mLogger.trace(to_string()); } - int32_t StructSymbolPin::getPinLength() const { const int32_t dx = hotptX - startX; diff --git a/src/Structures/StructSymbolPin.hpp b/src/Structures/StructSymbolPin.hpp index 7f9e3be6..01dd1a9a 100644 --- a/src/Structures/StructSymbolPin.hpp +++ b/src/Structures/StructSymbolPin.hpp @@ -1,7 +1,6 @@ #ifndef STRUCTSYMBOLPIN_HPP #define STRUCTSYMBOLPIN_HPP - #include #include #include @@ -16,7 +15,6 @@ #include "Record.hpp" #include "Structures/StructSymbolDisplayProp.hpp" - /*! * @brief Pseudo structure that does not exist itself. It's only provided to group structures that @@ -26,10 +24,18 @@ class StructSymbolPin : public Record { public: - - StructSymbolPin(StreamContext& aCtx) : Record{aCtx}, name{}, startX{0}, startY{0}, - hotptX{0}, hotptY{0}, pinShape{}, portType{PortType::Input}, symbolDisplayProps{} - { } + StructSymbolPin(StreamContext& aCtx) + : Record{aCtx}, + name{}, + startX{0}, + startY{0}, + hotptX{0}, + hotptY{0}, + pinShape{}, + portType{PortType::Input}, + symbolDisplayProps{} + { + } std::string to_string() const override; @@ -55,9 +61,7 @@ class StructSymbolPin : public Record std::vector> symbolDisplayProps; }; - -[[maybe_unused]] -static std::string to_string(const StructSymbolPin& aObj) +[[maybe_unused]] static std::string to_string(const StructSymbolPin& aObj) { std::string str; @@ -85,20 +89,16 @@ static std::string to_string(const StructSymbolPin& aObj) return str; } - inline std::string StructSymbolPin::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StructSymbolPin& aObj) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StructSymbolPin& aObj) { aOs << to_string(aObj); return aOs; } - #endif // STRUCTSYMBOLPIN_HPP \ No newline at end of file diff --git a/src/Structures/StructSymbolPinBus.hpp b/src/Structures/StructSymbolPinBus.hpp index 48c255f3..66979c76 100644 --- a/src/Structures/StructSymbolPinBus.hpp +++ b/src/Structures/StructSymbolPinBus.hpp @@ -1,7 +1,6 @@ #ifndef STRUCTSYMBOLPINBUS_HPP #define STRUCTSYMBOLPINBUS_HPP - #include #include #include @@ -13,13 +12,13 @@ #include "PinShape.hpp" #include "Structures/StructSymbolPin.hpp" - class StructSymbolPinBus : public StructSymbolPin { public: - - StructSymbolPinBus(StreamContext& aCtx) : StructSymbolPin{aCtx} - { } + StructSymbolPinBus(StreamContext& aCtx) + : StructSymbolPin{aCtx} + { + } // std::string to_string() const override; @@ -36,5 +35,4 @@ class StructSymbolPinBus : public StructSymbolPin } }; - #endif // STRUCTSYMBOLPINBUS_HPP \ No newline at end of file diff --git a/src/Structures/StructSymbolPinScalar.hpp b/src/Structures/StructSymbolPinScalar.hpp index 806abf8c..123b29c6 100644 --- a/src/Structures/StructSymbolPinScalar.hpp +++ b/src/Structures/StructSymbolPinScalar.hpp @@ -1,7 +1,6 @@ #ifndef STRUCTSYMBOLPINSCALAR_HPP #define STRUCTSYMBOLPINSCALAR_HPP - #include #include #include @@ -13,13 +12,13 @@ #include "PinShape.hpp" #include "Structures/StructSymbolPin.hpp" - class StructSymbolPinScalar : public StructSymbolPin { public: - - StructSymbolPinScalar(StreamContext& aCtx) : StructSymbolPin{aCtx} - { } + StructSymbolPinScalar(StreamContext& aCtx) + : StructSymbolPin{aCtx} + { + } // std::string to_string() const override; @@ -36,5 +35,4 @@ class StructSymbolPinScalar : public StructSymbolPin } }; - #endif // STRUCTSYMBOLPINSCALAR_HPP \ No newline at end of file diff --git a/src/Structures/StructT0x10.cpp b/src/Structures/StructT0x10.cpp index 19cf7260..3adbaa7a 100644 --- a/src/Structures/StructT0x10.cpp +++ b/src/Structures/StructT0x10.cpp @@ -10,7 +10,6 @@ #include "GenericParser.hpp" #include "Structures/StructT0x10.hpp" - void StructT0x10::read(FileFormatVersion /* aVersion */) { auto& ds = mCtx.mDs; diff --git a/src/Structures/StructT0x10.hpp b/src/Structures/StructT0x10.hpp index a2650296..74d4f5a6 100644 --- a/src/Structures/StructT0x10.hpp +++ b/src/Structures/StructT0x10.hpp @@ -1,7 +1,6 @@ #ifndef STRUCTT0X10_HPP #define STRUCTT0X10_HPP - #include #include #include @@ -16,13 +15,14 @@ #include "Record.hpp" #include "Structures/StructSymbolDisplayProp.hpp" - class StructT0x10 : public Record { public: - - StructT0x10(StreamContext& aCtx) : Record{aCtx}, symbolDisplayProps{} - { } + StructT0x10(StreamContext& aCtx) + : Record{aCtx}, + symbolDisplayProps{} + { + } std::string to_string() const override; @@ -41,9 +41,7 @@ class StructT0x10 : public Record std::vector> symbolDisplayProps; }; - -[[maybe_unused]] -static std::string to_string(const StructT0x10& aObj) +[[maybe_unused]] static std::string to_string(const StructT0x10& aObj) { std::string str; @@ -61,20 +59,16 @@ static std::string to_string(const StructT0x10& aObj) return str; } - inline std::string StructT0x10::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StructT0x10& aObj) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StructT0x10& aObj) { aOs << to_string(aObj); return aOs; } - #endif // STRUCTT0X10_HPP \ No newline at end of file diff --git a/src/Structures/StructT0x34.cpp b/src/Structures/StructT0x34.cpp index 21b70c57..46a482af 100644 --- a/src/Structures/StructT0x34.cpp +++ b/src/Structures/StructT0x34.cpp @@ -8,7 +8,6 @@ #include "General.hpp" #include "Structures/StructT0x34.hpp" - void StructT0x34::read(FileFormatVersion /* aVersion */) { auto& ds = mCtx.mDs; diff --git a/src/Structures/StructT0x34.hpp b/src/Structures/StructT0x34.hpp index 3279e7a9..38b46bc4 100644 --- a/src/Structures/StructT0x34.hpp +++ b/src/Structures/StructT0x34.hpp @@ -1,7 +1,6 @@ #ifndef STRUCTT0X34_HPP #define STRUCTT0X34_HPP - #include #include #include @@ -16,14 +15,17 @@ #include "General.hpp" #include "Record.hpp" - class StructT0x34 : public Record { public: - - StructT0x34(StreamContext& aCtx) : Record{aCtx}, id{0}, color{Color::Default}, - lineStyle{LineStyle::Default}, lineWidth{LineWidth::Default} - { } + StructT0x34(StreamContext& aCtx) + : Record{aCtx}, + id{0}, + color{Color::Default}, + lineStyle{LineStyle::Default}, + lineWidth{LineWidth::Default} + { + } std::string to_string() const override; @@ -39,16 +41,14 @@ class StructT0x34 : public Record return Structure::T0x34; } - uint32_t id; + uint32_t id; - Color color; + Color color; LineStyle lineStyle; LineWidth lineWidth; }; - -[[maybe_unused]] -static std::string to_string(const StructT0x34& aObj) +[[maybe_unused]] static std::string to_string(const StructT0x34& aObj) { std::string str; @@ -61,20 +61,16 @@ static std::string to_string(const StructT0x34& aObj) return str; } - inline std::string StructT0x34::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StructT0x34& aObj) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StructT0x34& aObj) { aOs << to_string(aObj); return aOs; } - #endif // STRUCTT0X34_HPP \ No newline at end of file diff --git a/src/Structures/StructT0x35.cpp b/src/Structures/StructT0x35.cpp index cecf5ea4..0d0220e9 100644 --- a/src/Structures/StructT0x35.cpp +++ b/src/Structures/StructT0x35.cpp @@ -8,7 +8,6 @@ #include "General.hpp" #include "Structures/StructT0x35.hpp" - void StructT0x35::read(FileFormatVersion /* aVersion */) { auto& ds = mCtx.mDs; @@ -58,8 +57,7 @@ void StructT0x35::read(FileFormatVersion /* aVersion */) for(size_t i = 0; i < len0; ++i) { - ds.printUnknownData(4, fmt::format("{}: 1 - {}", - getMethodName(this, __func__), i)); + ds.printUnknownData(4, fmt::format("{}: 1 - {}", getMethodName(this, __func__), i)); } // localFutureLst.readRestOfStructure(); diff --git a/src/Structures/StructT0x35.hpp b/src/Structures/StructT0x35.hpp index 32bc469b..6670b4af 100644 --- a/src/Structures/StructT0x35.hpp +++ b/src/Structures/StructT0x35.hpp @@ -1,7 +1,6 @@ #ifndef STRUCTT0X35_HPP #define STRUCTT0X35_HPP - #include #include #include @@ -16,14 +15,17 @@ #include "General.hpp" #include "Record.hpp" - class StructT0x35 : public Record { public: - - StructT0x35(StreamContext& aCtx) : Record{aCtx}, id{0}, color{Color::Default}, - lineStyle{LineStyle::Default}, lineWidth{LineWidth::Default} - { } + StructT0x35(StreamContext& aCtx) + : Record{aCtx}, + id{0}, + color{Color::Default}, + lineStyle{LineStyle::Default}, + lineWidth{LineWidth::Default} + { + } std::string to_string() const override; @@ -39,15 +41,13 @@ class StructT0x35 : public Record return Structure::T0x35; } - uint32_t id; - Color color; + uint32_t id; + Color color; LineStyle lineStyle; LineWidth lineWidth; }; - -[[maybe_unused]] -static std::string to_string(const StructT0x35& aObj) +[[maybe_unused]] static std::string to_string(const StructT0x35& aObj) { std::string str; @@ -60,20 +60,16 @@ static std::string to_string(const StructT0x35& aObj) return str; } - inline std::string StructT0x35::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StructT0x35& aObj) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StructT0x35& aObj) { aOs << to_string(aObj); return aOs; } - #endif // STRUCTT0X35_HPP \ No newline at end of file diff --git a/src/Structures/StructT0x45.cpp b/src/Structures/StructT0x45.cpp index 9fd4f8bf..1d3f4499 100644 --- a/src/Structures/StructT0x45.cpp +++ b/src/Structures/StructT0x45.cpp @@ -9,7 +9,6 @@ #include "GenericParser.hpp" #include "Structures/StructT0x45.hpp" - void StructT0x45::read(FileFormatVersion /* aVersion */) { auto& ds = mCtx.mDs; diff --git a/src/Structures/StructT0x45.hpp b/src/Structures/StructT0x45.hpp index 9c7df720..20b37edd 100644 --- a/src/Structures/StructT0x45.hpp +++ b/src/Structures/StructT0x45.hpp @@ -1,7 +1,6 @@ #ifndef STRUCTT0X45_HPP #define STRUCTT0X45_HPP - #include #include #include @@ -13,13 +12,13 @@ #include "General.hpp" #include "StructSomeHierarchyBase.hpp" - class StructT0x45 : public StructSomeHierarchyBase { public: - - StructT0x45(StreamContext& aCtx) : StructSomeHierarchyBase{aCtx} - { } + StructT0x45(StreamContext& aCtx) + : StructSomeHierarchyBase{aCtx} + { + } std::string to_string() const override; @@ -36,9 +35,7 @@ class StructT0x45 : public StructSomeHierarchyBase } }; - -[[maybe_unused]] -static std::string to_string(const StructT0x45& aObj) +[[maybe_unused]] static std::string to_string(const StructT0x45& aObj) { std::string str; @@ -47,20 +44,16 @@ static std::string to_string(const StructT0x45& aObj) return str; } - inline std::string StructT0x45::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StructT0x45& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StructT0x45& aVal) { aOs << to_string(aVal); return aOs; } - #endif // STRUCTT0X45_HPP \ No newline at end of file diff --git a/src/Structures/StructT0x5b.cpp b/src/Structures/StructT0x5b.cpp index f20f6270..1eb9a2b9 100644 --- a/src/Structures/StructT0x5b.cpp +++ b/src/Structures/StructT0x5b.cpp @@ -9,7 +9,6 @@ #include "GenericParser.hpp" #include "Structures/StructT0x5b.hpp" - void StructT0x5b::read(FileFormatVersion /* aVersion */) { auto& ds = mCtx.mDs; diff --git a/src/Structures/StructT0x5b.hpp b/src/Structures/StructT0x5b.hpp index 5e4689a8..9f498951 100644 --- a/src/Structures/StructT0x5b.hpp +++ b/src/Structures/StructT0x5b.hpp @@ -1,7 +1,6 @@ #ifndef STRUCTT0X5B_HPP #define STRUCTT0X5B_HPP - #include #include #include @@ -13,13 +12,13 @@ #include "General.hpp" #include "Record.hpp" - class StructT0x5b : public Record { public: - - StructT0x5b(StreamContext& aCtx) : Record{aCtx} - { } + StructT0x5b(StreamContext& aCtx) + : Record{aCtx} + { + } std::string to_string() const override; @@ -36,9 +35,7 @@ class StructT0x5b : public Record } }; - -[[maybe_unused]] -static std::string to_string(const StructT0x5b& aObj) +[[maybe_unused]] static std::string to_string(const StructT0x5b& aObj) { std::string str; @@ -47,20 +44,16 @@ static std::string to_string(const StructT0x5b& aObj) return str; } - inline std::string StructT0x5b::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StructT0x5b& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StructT0x5b& aVal) { aOs << to_string(aVal); return aOs; } - #endif // STRUCTT0X5B_HPP \ No newline at end of file diff --git a/src/Structures/StructTitleBlock.cpp b/src/Structures/StructTitleBlock.cpp index 60dd2bbc..504d422c 100644 --- a/src/Structures/StructTitleBlock.cpp +++ b/src/Structures/StructTitleBlock.cpp @@ -9,7 +9,6 @@ #include "GenericParser.hpp" #include "Structures/StructTitleBlock.hpp" - void StructTitleBlock::read(FileFormatVersion /* aVersion */) { auto& ds = mCtx.mDs; diff --git a/src/Structures/StructTitleBlock.hpp b/src/Structures/StructTitleBlock.hpp index c3bf95a9..319b4c13 100644 --- a/src/Structures/StructTitleBlock.hpp +++ b/src/Structures/StructTitleBlock.hpp @@ -1,7 +1,6 @@ #ifndef STRUCTTITLEBLOCK_HPP #define STRUCTTITLEBLOCK_HPP - #include #include #include @@ -15,13 +14,13 @@ #include "General.hpp" #include "Structures/StructGraphicInst.hpp" - class StructTitleBlock : public StructGraphicInst { public: - - StructTitleBlock(StreamContext& aCtx) : StructGraphicInst{aCtx} - { } + StructTitleBlock(StreamContext& aCtx) + : StructGraphicInst{aCtx} + { + } std::string to_string() const override; @@ -38,14 +37,11 @@ class StructTitleBlock : public StructGraphicInst } }; - -[[maybe_unused]] -static std::string to_string(const StructTitleBlock& aObj) +[[maybe_unused]] static std::string to_string(const StructTitleBlock& aObj) { return aObj.to_string(); } - inline std::string StructTitleBlock::to_string() const { std::string str; @@ -57,14 +53,11 @@ inline std::string StructTitleBlock::to_string() const return str; } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StructTitleBlock& aObj) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StructTitleBlock& aObj) { aOs << to_string(aObj); return aOs; } - #endif // STRUCTTITLEBLOCK_HPP \ No newline at end of file diff --git a/src/Structures/StructTitleBlockSymbol.cpp b/src/Structures/StructTitleBlockSymbol.cpp index d9a5e46d..06db65e2 100644 --- a/src/Structures/StructTitleBlockSymbol.cpp +++ b/src/Structures/StructTitleBlockSymbol.cpp @@ -9,7 +9,6 @@ #include "GenericParser.hpp" #include "Structures/StructTitleBlockSymbol.hpp" - void StructTitleBlockSymbol::read(FileFormatVersion aVersion) { auto& ds = mCtx.mDs; @@ -19,8 +18,8 @@ void StructTitleBlockSymbol::read(FileFormatVersion aVersion) if(aVersion == FileFormatVersion::Unknown) { - const auto predictionFunc = [this](FileFormatVersion aVersion){ this->read(aVersion); }; - aVersion = parser.predictVersion(predictionFunc); + const auto predictionFunc = [this](FileFormatVersion aVersion) { this->read(aVersion); }; + aVersion = parser.predictVersion(predictionFunc); } FutureDataLst localFutureLst{mCtx}; diff --git a/src/Structures/StructTitleBlockSymbol.hpp b/src/Structures/StructTitleBlockSymbol.hpp index a47a67cc..bad8ec8b 100644 --- a/src/Structures/StructTitleBlockSymbol.hpp +++ b/src/Structures/StructTitleBlockSymbol.hpp @@ -1,7 +1,6 @@ #ifndef STRUCTTITLEBLOCKSYMBOL_HPP #define STRUCTTITLEBLOCKSYMBOL_HPP - #include #include #include @@ -16,14 +15,15 @@ #include "Structures/StructSymbolDisplayProp.hpp" #include "Structures/StructSymbolPin.hpp" - class StructTitleBlockSymbol : public StructSymbol { public: - - StructTitleBlockSymbol(StreamContext& aCtx) : StructSymbol{aCtx}, - symbolPins{}, symbolDisplayProps{} - { } + StructTitleBlockSymbol(StreamContext& aCtx) + : StructSymbol{aCtx}, + symbolPins{}, + symbolDisplayProps{} + { + } std::string to_string() const override; @@ -39,13 +39,11 @@ class StructTitleBlockSymbol : public StructSymbol return Structure::TitleBlockSymbol; } - std::vector> symbolPins; + std::vector> symbolPins; std::vector> symbolDisplayProps; }; - -[[maybe_unused]] -static std::string to_string(const StructTitleBlockSymbol& aObj) +[[maybe_unused]] static std::string to_string(const StructTitleBlockSymbol& aObj) { std::string str; @@ -75,20 +73,16 @@ static std::string to_string(const StructTitleBlockSymbol& aObj) return str; } - inline std::string StructTitleBlockSymbol::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StructTitleBlockSymbol& aVal) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StructTitleBlockSymbol& aVal) { aOs << to_string(aVal); return aOs; } - #endif // STRUCTTITLEBLOCKSYMBOL_HPP \ No newline at end of file diff --git a/src/Structures/StructWire.cpp b/src/Structures/StructWire.cpp index 949b8928..2a977891 100644 --- a/src/Structures/StructWire.cpp +++ b/src/Structures/StructWire.cpp @@ -10,7 +10,6 @@ #include "GenericParser.hpp" #include "Structures/StructWire.hpp" - void StructWire::read(FileFormatVersion /* aVersion */) { auto& ds = mCtx.mDs; diff --git a/src/Structures/StructWire.hpp b/src/Structures/StructWire.hpp index d07a4a89..3c2ce1a1 100644 --- a/src/Structures/StructWire.hpp +++ b/src/Structures/StructWire.hpp @@ -1,7 +1,6 @@ #ifndef STRUCTWIRE_HPP #define STRUCTWIRE_HPP - #include #include #include @@ -29,34 +28,39 @@ class StructWire : public Record { public: - - StructWire(StreamContext& aCtx) : Record{aCtx}, id{0}, color{Color::Default}, - startX{0}, startY{0}, endX{0}, endY{0}, - lineWidth{LineWidth::Default}, lineStyle{LineStyle::Default} - { } + StructWire(StreamContext& aCtx) + : Record{aCtx}, + id{0}, + color{Color::Default}, + startX{0}, + startY{0}, + endX{0}, + endY{0}, + lineWidth{LineWidth::Default}, + lineStyle{LineStyle::Default} + { + } std::string to_string() const override; void read(FileFormatVersion aVersion = FileFormatVersion::Unknown) override; - uint32_t id; - Color color; + uint32_t id; + Color color; - int32_t startX; - int32_t startY; - int32_t endX; - int32_t endY; + int32_t startX; + int32_t startY; + int32_t endX; + int32_t endY; - std::vector> aliases; + std::vector> aliases; std::vector> symbolDisplayProps; LineWidth lineWidth; LineStyle lineStyle; }; - -[[maybe_unused]] -static std::string to_string(const StructWire& aObj) +[[maybe_unused]] static std::string to_string(const StructWire& aObj) { std::string str; @@ -92,20 +96,16 @@ static std::string to_string(const StructWire& aObj) return str; } - inline std::string StructWire::to_string() const { return ::to_string(*this); } - -[[maybe_unused]] -static std::ostream& operator<<(std::ostream& aOs, const StructWire& aObj) +[[maybe_unused]] static std::ostream& operator<<(std::ostream& aOs, const StructWire& aObj) { aOs << to_string(aObj); return aOs; } - #endif // STRUCTWIRE_HPP \ No newline at end of file diff --git a/src/Structures/StructWireBus.hpp b/src/Structures/StructWireBus.hpp index 701c1dbe..065a3840 100644 --- a/src/Structures/StructWireBus.hpp +++ b/src/Structures/StructWireBus.hpp @@ -1,7 +1,6 @@ #ifndef STRUCTWIREBUS_HPP #define STRUCTWIREBUS_HPP - #include #include #include @@ -16,13 +15,13 @@ #include "General.hpp" #include "Structures/StructWire.hpp" - class StructWireBus : public StructWire { public: - - StructWireBus(StreamContext& aCtx) : StructWire{aCtx} - { } + StructWireBus(StreamContext& aCtx) + : StructWire{aCtx} + { + } // std::string to_string() const override; @@ -50,5 +49,4 @@ class StructWireBus : public StructWire // LineStyle lineStyle; }; - #endif // STRUCTWIREBUS_HPP \ No newline at end of file diff --git a/src/Structures/StructWireScalar.hpp b/src/Structures/StructWireScalar.hpp index 8414f1df..e0963acc 100644 --- a/src/Structures/StructWireScalar.hpp +++ b/src/Structures/StructWireScalar.hpp @@ -1,7 +1,6 @@ #ifndef STRUCTWIRESCALAR_HPP #define STRUCTWIRESCALAR_HPP - #include #include #include @@ -16,13 +15,13 @@ #include "General.hpp" #include "Structures/StructWire.hpp" - class StructWireScalar : public StructWire { public: - - StructWireScalar(StreamContext& aCtx) : StructWire{aCtx} - { } + StructWireScalar(StreamContext& aCtx) + : StructWire{aCtx} + { + } // std::string to_string() const override; @@ -51,5 +50,4 @@ class StructWireScalar : public StructWire // LineStyle wireLineStyle; }; - #endif // STRUCTWIRESCALAR_HPP \ No newline at end of file diff --git a/src/VisitorPattern.hpp b/src/VisitorPattern.hpp index 1b697873..0b62b408 100644 --- a/src/VisitorPattern.hpp +++ b/src/VisitorPattern.hpp @@ -1,7 +1,6 @@ #ifndef VISITORPATTERN_HPP #define VISITORPATTERN_HPP - class Library; class PageSettings; class Point; @@ -85,97 +84,97 @@ class Visitor { public: virtual ~Visitor() - { } + { + } - virtual void visit(const Library& aObj) = 0; - virtual void visit(const PageSettings& aObj) = 0; - virtual void visit(const Point& aObj) = 0; - virtual void visit(const PrimArc& aObj) = 0; - virtual void visit(const PrimBezier& aObj) = 0; - virtual void visit(const PrimBitmap& aObj) = 0; - virtual void visit(const PrimCommentText& aObj) = 0; - virtual void visit(const PrimEllipse& aObj) = 0; - virtual void visit(const PrimLine& aObj) = 0; - virtual void visit(const PrimPolygon& aObj) = 0; - virtual void visit(const PrimPolyline& aObj) = 0; - virtual void visit(const PrimRect& aObj) = 0; - virtual void visit(const PrimSymbolVector& aObj) = 0; - virtual void visit(const StreamAdminData& aObj) = 0; - virtual void visit(const StreamBOMDataStream& aObj) = 0; - virtual void visit(const StreamCache& aObj) = 0; - virtual void visit(const StreamDirectoryStruct& aObj) = 0; - virtual void visit(const StreamDsnStream& aObj) = 0; - virtual void visit(const StreamDTypeD& aObj) = 0; - virtual void visit(const StreamERC& aObj) = 0; - virtual void visit(const StreamHierarchy& aObj) = 0; - virtual void visit(const StreamHSObjects& aObj) = 0; - virtual void visit(const StreamLibrary& aObj) = 0; - virtual void visit(const StreamNetBundleMapData& aObj) = 0; - virtual void visit(const StreamPackage& aObj) = 0; - virtual void visit(const StreamPage& aObj) = 0; - virtual void visit(const StreamSchematic& aObj) = 0; - virtual void visit(const StreamSymbol& aObj) = 0; - virtual void visit(const StructAlias& aObj) = 0; - virtual void visit(const StructBookMarkSymbolInst& aObj) = 0; - virtual void visit(const StructBusEntry& aObj) = 0; - virtual void visit(const StructDevice& aObj) = 0; - virtual void visit(const StructERCObject& aObj) = 0; - virtual void visit(const StructERCSymbol& aObj) = 0; - virtual void visit(const StructGeneralProperties& aObj) = 0; - virtual void visit(const StructGlobal& aObj) = 0; - virtual void visit(const StructGlobalSymbol& aObj) = 0; - virtual void visit(const StructGraphicArcInst& aObj) = 0; - virtual void visit(const StructGraphicBezierInst& aObj) = 0; - virtual void visit(const StructGraphicBitMapInst& aObj) = 0; - virtual void visit(const StructGraphicBoxInst& aObj) = 0; + virtual void visit(const Library& aObj) = 0; + virtual void visit(const PageSettings& aObj) = 0; + virtual void visit(const Point& aObj) = 0; + virtual void visit(const PrimArc& aObj) = 0; + virtual void visit(const PrimBezier& aObj) = 0; + virtual void visit(const PrimBitmap& aObj) = 0; + virtual void visit(const PrimCommentText& aObj) = 0; + virtual void visit(const PrimEllipse& aObj) = 0; + virtual void visit(const PrimLine& aObj) = 0; + virtual void visit(const PrimPolygon& aObj) = 0; + virtual void visit(const PrimPolyline& aObj) = 0; + virtual void visit(const PrimRect& aObj) = 0; + virtual void visit(const PrimSymbolVector& aObj) = 0; + virtual void visit(const StreamAdminData& aObj) = 0; + virtual void visit(const StreamBOMDataStream& aObj) = 0; + virtual void visit(const StreamCache& aObj) = 0; + virtual void visit(const StreamDirectoryStruct& aObj) = 0; + virtual void visit(const StreamDsnStream& aObj) = 0; + virtual void visit(const StreamDTypeD& aObj) = 0; + virtual void visit(const StreamERC& aObj) = 0; + virtual void visit(const StreamHierarchy& aObj) = 0; + virtual void visit(const StreamHSObjects& aObj) = 0; + virtual void visit(const StreamLibrary& aObj) = 0; + virtual void visit(const StreamNetBundleMapData& aObj) = 0; + virtual void visit(const StreamPackage& aObj) = 0; + virtual void visit(const StreamPage& aObj) = 0; + virtual void visit(const StreamSchematic& aObj) = 0; + virtual void visit(const StreamSymbol& aObj) = 0; + virtual void visit(const StructAlias& aObj) = 0; + virtual void visit(const StructBookMarkSymbolInst& aObj) = 0; + virtual void visit(const StructBusEntry& aObj) = 0; + virtual void visit(const StructDevice& aObj) = 0; + virtual void visit(const StructERCObject& aObj) = 0; + virtual void visit(const StructERCSymbol& aObj) = 0; + virtual void visit(const StructGeneralProperties& aObj) = 0; + virtual void visit(const StructGlobal& aObj) = 0; + virtual void visit(const StructGlobalSymbol& aObj) = 0; + virtual void visit(const StructGraphicArcInst& aObj) = 0; + virtual void visit(const StructGraphicBezierInst& aObj) = 0; + virtual void visit(const StructGraphicBitMapInst& aObj) = 0; + virtual void visit(const StructGraphicBoxInst& aObj) = 0; virtual void visit(const StructGraphicCommentTextInst& aObj) = 0; - virtual void visit(const StructGraphicEllipseInst& aObj) = 0; - virtual void visit(const StructGraphicLineInst& aObj) = 0; - virtual void visit(const StructGraphicOleEmbedInst& aObj) = 0; - virtual void visit(const StructGraphicPolygonInst& aObj) = 0; - virtual void visit(const StructGraphicPolylineInst& aObj) = 0; - virtual void visit(const StructLibraryPart& aObj) = 0; - virtual void visit(const StructNetDbIdMapping& aObj) = 0; - virtual void visit(const StructOffPageConnector& aObj) = 0; - virtual void visit(const StructOffPageSymbol& aObj) = 0; - virtual void visit(const StructPackage& aObj) = 0; - virtual void visit(const StructPartCell& aObj) = 0; - virtual void visit(const StructPinShapeSymbol& aObj) = 0; - virtual void visit(const StructPlacedInstance& aObj) = 0; - virtual void visit(const StructPort& aObj) = 0; - virtual void visit(const StructPortSymbol& aObj) = 0; - virtual void visit(const StructSthInHierarchy1& aObj) = 0; - virtual void visit(const StructSthInHierarchy2& aObj) = 0; - virtual void visit(const StructSthInHierarchy3& aObj) = 0; - virtual void visit(const StructSthInPages0& aObj) = 0; - virtual void visit(const StructSymbol& aObj) = 0; - virtual void visit(const StructSymbolBBox& aObj) = 0; - virtual void visit(const StructSymbolDisplayProp& aObj) = 0; - virtual void visit(const StructSymbolPin& aObj) = 0; - virtual void visit(const StructSymbolPinBus& aObj) = 0; - virtual void visit(const StructSymbolPinScalar& aObj) = 0; - virtual void visit(const StructT0x10& aObj) = 0; - virtual void visit(const StructT0x34& aObj) = 0; - virtual void visit(const StructT0x35& aObj) = 0; - virtual void visit(const StructT0x45& aObj) = 0; - virtual void visit(const StructT0x5b& aObj) = 0; - virtual void visit(const StructTitleBlock& aObj) = 0; - virtual void visit(const StructTitleBlockSymbol& aObj) = 0; - virtual void visit(const StructWire& aObj) = 0; - virtual void visit(const StructWireBus& aObj) = 0; - virtual void visit(const StructWireScalar& aObj) = 0; - virtual void visit(const tagLOGFONTA& aObj) = 0; + virtual void visit(const StructGraphicEllipseInst& aObj) = 0; + virtual void visit(const StructGraphicLineInst& aObj) = 0; + virtual void visit(const StructGraphicOleEmbedInst& aObj) = 0; + virtual void visit(const StructGraphicPolygonInst& aObj) = 0; + virtual void visit(const StructGraphicPolylineInst& aObj) = 0; + virtual void visit(const StructLibraryPart& aObj) = 0; + virtual void visit(const StructNetDbIdMapping& aObj) = 0; + virtual void visit(const StructOffPageConnector& aObj) = 0; + virtual void visit(const StructOffPageSymbol& aObj) = 0; + virtual void visit(const StructPackage& aObj) = 0; + virtual void visit(const StructPartCell& aObj) = 0; + virtual void visit(const StructPinShapeSymbol& aObj) = 0; + virtual void visit(const StructPlacedInstance& aObj) = 0; + virtual void visit(const StructPort& aObj) = 0; + virtual void visit(const StructPortSymbol& aObj) = 0; + virtual void visit(const StructSthInHierarchy1& aObj) = 0; + virtual void visit(const StructSthInHierarchy2& aObj) = 0; + virtual void visit(const StructSthInHierarchy3& aObj) = 0; + virtual void visit(const StructSthInPages0& aObj) = 0; + virtual void visit(const StructSymbol& aObj) = 0; + virtual void visit(const StructSymbolBBox& aObj) = 0; + virtual void visit(const StructSymbolDisplayProp& aObj) = 0; + virtual void visit(const StructSymbolPin& aObj) = 0; + virtual void visit(const StructSymbolPinBus& aObj) = 0; + virtual void visit(const StructSymbolPinScalar& aObj) = 0; + virtual void visit(const StructT0x10& aObj) = 0; + virtual void visit(const StructT0x34& aObj) = 0; + virtual void visit(const StructT0x35& aObj) = 0; + virtual void visit(const StructT0x45& aObj) = 0; + virtual void visit(const StructT0x5b& aObj) = 0; + virtual void visit(const StructTitleBlock& aObj) = 0; + virtual void visit(const StructTitleBlockSymbol& aObj) = 0; + virtual void visit(const StructWire& aObj) = 0; + virtual void visit(const StructWireBus& aObj) = 0; + virtual void visit(const StructWireScalar& aObj) = 0; + virtual void visit(const tagLOGFONTA& aObj) = 0; }; - class Component { public: virtual ~Component() - { } + { + } virtual void accept(Visitor& aVisitor) const = 0; }; - #endif // VISITORPATTERN_HPP \ No newline at end of file diff --git a/src/Win32/LOGFONTA.hpp b/src/Win32/LOGFONTA.hpp index 3a24bb06..d5c3b6c8 100644 --- a/src/Win32/LOGFONTA.hpp +++ b/src/Win32/LOGFONTA.hpp @@ -1,7 +1,6 @@ #ifndef LOGFONTA_HPP #define LOGFONTA_HPP - #include #include #include @@ -13,17 +12,28 @@ #include "General.hpp" #include "StreamContext.hpp" - // See Win32 API for reference, where the original structure was copied from // https://learn.microsoft.com/en-us/windows/win32/api/wingdi/ns-wingdi-logfonta class tagLOGFONTA { public: - tagLOGFONTA() : lfHeight{0}, lfWidth{0}, lfEscapement{0}, lfOrientation{0}, - lfWeight{0}, lfItalic{0}, lfUnderline{0}, lfStrikeOut{0}, lfCharSet{0}, - lfOutPrecision{0}, lfClipPrecision{0}, lfQuality{0}, lfPitchAndFamily{0}, - lfFaceName{""} - { } + tagLOGFONTA() + : lfHeight{0}, + lfWidth{0}, + lfEscapement{0}, + lfOrientation{0}, + lfWeight{0}, + lfItalic{0}, + lfUnderline{0}, + lfStrikeOut{0}, + lfCharSet{0}, + lfOutPrecision{0}, + lfClipPrecision{0}, + lfQuality{0}, + lfPitchAndFamily{0}, + lfFaceName{""} + { + } void read(StreamContext& aCtx) { @@ -44,7 +54,8 @@ class tagLOGFONTA // out of it's 'valid' range if(lfOutPrecision > 10U) { - // throw std::runtime_error(fmt::format("lfOutPrecision <= 10 must hold but lfOutPrecision = {}", lfOutPrecision)); + // throw std::runtime_error(fmt::format("lfOutPrecision <= 10 must hold but lfOutPrecision = {}", + // lfOutPrecision)); } if(lfQuality > 6U) @@ -109,15 +120,12 @@ class tagLOGFONTA // char buffer[60]; // strcpy(buffer, srcStr); // write_data_to_file(buffer, sizeof(buffer)); - char lfFaceName[32]; + char lfFaceName[32]; }; - typedef tagLOGFONTA LOGFONTA, *PLOGFONTA, *NPLOGFONTA, *LPLOGFONTA; - // Check that structure size is as defined by the Windows API static_assert(sizeof(LOGFONTA) == 60U); - #endif // LOGFONTA_HPP \ No newline at end of file diff --git a/src/XmlExporter.cpp b/src/XmlExporter.cpp index 1ccf7bb4..1586cb0e 100644 --- a/src/XmlExporter.cpp +++ b/src/XmlExporter.cpp @@ -1,6 +1,5 @@ #include "XmlExporter.hpp" - void XmlExporter::visit(const Library& aObj) { mLib = &aObj; @@ -24,15 +23,14 @@ void XmlExporter::visit(const Library& aObj) // @todo Use Package name static uint32_t PackageCtr = 0; - const std::string pkgName = "PackageName" + std::to_string(PackageCtr++) + ".xml"; - mExportFilePath = mExportBasePath / pkgName; + const std::string pkgName = "PackageName" + std::to_string(PackageCtr++) + ".xml"; + mExportFilePath = mExportBasePath / pkgName; exportXml(); } } } - void XmlExporter::visit(const PrimArc& aObj) { XMLElement* parent = mCurXmlElem; @@ -59,7 +57,6 @@ void XmlExporter::visit(const PrimArc& aObj) mCurXmlElem = parent; } - void XmlExporter::visit(const PrimBezier& aObj) { XMLElement* parent = mCurXmlElem; @@ -90,7 +87,6 @@ void XmlExporter::visit(const PrimBezier& aObj) mCurXmlElem = parent; } - void XmlExporter::visit(const PrimEllipse& aObj) { XMLElement* parent = mCurXmlElem; @@ -115,7 +111,6 @@ void XmlExporter::visit(const PrimEllipse& aObj) mCurXmlElem = parent; } - void XmlExporter::visit(const PrimRect& aObj) { XMLElement* parent = mCurXmlElem; @@ -140,7 +135,6 @@ void XmlExporter::visit(const PrimRect& aObj) mCurXmlElem = parent; } - void XmlExporter::visit(const PrimPolygon& aObj) { XMLElement* parent = mCurXmlElem; @@ -173,7 +167,6 @@ void XmlExporter::visit(const PrimPolygon& aObj) mCurXmlElem = parent; } - void XmlExporter::visit(const PrimPolyline& aObj) { XMLElement* parent = mCurXmlElem; @@ -204,7 +197,6 @@ void XmlExporter::visit(const PrimPolyline& aObj) mCurXmlElem = parent; } - void XmlExporter::visit(const PrimLine& aObj) { XMLElement* parent = mCurXmlElem; @@ -227,7 +219,6 @@ void XmlExporter::visit(const PrimLine& aObj) mCurXmlElem = parent; } - void XmlExporter::visit(const PrimSymbolVector& aObj) { XMLElement* parent = mCurXmlElem; @@ -254,7 +245,6 @@ void XmlExporter::visit(const PrimSymbolVector& aObj) mCurXmlElem = parent; } - void XmlExporter::visit(const StructSymbolDisplayProp& aObj) { XMLElement* parent = mCurXmlElem; @@ -276,8 +266,7 @@ void XmlExporter::visit(const StructSymbolDisplayProp& aObj) XMLElement* ePropFont = mXml.NewElement("PropFont"); mCurXmlElem->InsertEndChild(ePropFont); - if(mLib && mLib->library && - aObj.textFontIdx < mLib->library->textFonts.size()) + if(mLib && mLib->library && aObj.textFontIdx < mLib->library->textFonts.size()) { XMLElement* parent = mCurXmlElem; @@ -303,12 +292,11 @@ void XmlExporter::visit(const StructSymbolDisplayProp& aObj) ePropDispType->InsertEndChild(eDefn3); eDefn3->SetAttribute("ValueIfValueExist", 1); // @todo - eDefn3->SetAttribute("val", 1); // @todo + eDefn3->SetAttribute("val", 1); // @todo mCurXmlElem = parent; } - void XmlExporter::visit(const StructSymbolPin& aObj) { XMLElement* eDefn = mXml.NewElement("Defn"); @@ -414,7 +402,6 @@ void XmlExporter::visit(const StructSymbolPin& aObj) } } - void XmlExporter::visit(const StructSymbolPinBus& aObj) { XMLElement* parent = mCurXmlElem; @@ -429,7 +416,6 @@ void XmlExporter::visit(const StructSymbolPinBus& aObj) mCurXmlElem = parent; } - void XmlExporter::visit(const StructSymbolPinScalar& aObj) { XMLElement* parent = mCurXmlElem; @@ -444,7 +430,6 @@ void XmlExporter::visit(const StructSymbolPinScalar& aObj) mCurXmlElem = parent; } - void XmlExporter::visit(const StructPackage& aObj) { XMLElement* parent = mCurXmlElem; @@ -521,13 +506,12 @@ void XmlExporter::visit(const StructPackage& aObj) mCurXmlElem = parent; } - void XmlExporter::visit(const StreamPackage& aObj) { XMLElement* parent = mCurXmlElem; const std::string normal = ".Normal"; - std::string normalName = aObj.properties.at(0)->normalName; + std::string normalName = aObj.properties.at(0)->normalName; normalName.resize(normalName.size() - normal.size()); XMLElement* ePackage = mXml.NewElement("Package"); @@ -539,14 +523,14 @@ void XmlExporter::visit(const StreamPackage& aObj) mCurXmlElem->InsertEndChild(eDefn); eDefn->SetAttribute("alphabeticNumbering", "0"); // @todo - eDefn->SetAttribute("isHomogeneous", "1"); // @todo + eDefn->SetAttribute("isHomogeneous", "1"); // @todo eDefn->SetAttribute("name", normalName.c_str()); eDefn->SetAttribute("refdesPrefix", "unimplemented"); // @todo - eDefn->SetAttribute("pcbLib", "unimplemented"); // @todo + eDefn->SetAttribute("pcbLib", "unimplemented"); // @todo eDefn->SetAttribute("pcbFootprint", "unimplemented"); // @todo - eDefn->SetAttribute("sourcelib", "unimplemented"); // @todo - eDefn->SetAttribute("timestamp", "0"); // @todo - eDefn->SetAttribute("timezone", "0"); // @todo + eDefn->SetAttribute("sourcelib", "unimplemented"); // @todo + eDefn->SetAttribute("timestamp", "0"); // @todo + eDefn->SetAttribute("timezone", "0"); // @todo { XMLElement* parent = mCurXmlElem; @@ -582,7 +566,6 @@ void XmlExporter::visit(const StreamPackage& aObj) mCurXmlElem = parent; } - void XmlExporter::visit(const StructLibraryPart& aObj) { XMLElement* parent = mCurXmlElem; @@ -599,9 +582,9 @@ void XmlExporter::visit(const StructLibraryPart& aObj) XMLElement* eDefn = mXml.NewElement("Defn"); eSymbolBBox->InsertEndChild(eDefn); - eDefn->SetAttribute("x1", "0"); // @todo + eDefn->SetAttribute("x1", "0"); // @todo eDefn->SetAttribute("x2", "30"); // @todo - eDefn->SetAttribute("y1", "0"); // @todo + eDefn->SetAttribute("y1", "0"); // @todo eDefn->SetAttribute("y2", "60"); // @todo } @@ -672,7 +655,6 @@ void XmlExporter::visit(const StructLibraryPart& aObj) mCurXmlElem = parent; } - void XmlExporter::visit(const tagLOGFONTA& aObj) { XMLElement* parent = mCurXmlElem; diff --git a/src/XmlExporter.hpp b/src/XmlExporter.hpp index 6cc3573c..5e10f16b 100644 --- a/src/XmlExporter.hpp +++ b/src/XmlExporter.hpp @@ -1,7 +1,6 @@ #ifndef XMLEXPORTER_HPP #define XMLEXPORTER_HPP - #include // @todo Why does the compiler not find the lib? Check target_include_directory @@ -25,19 +24,21 @@ #include "VisitorPattern.hpp" #include "Win32/LOGFONTA.hpp" - namespace fs = std::filesystem; using namespace tinyxml2; - class XmlExporter : public Visitor { public: - - XmlExporter(const fs::path& aExportPath) : mExportBasePath{aExportPath}, - mExportFilePath{}, mXml{}, mCurXmlElem{mXml.RootElement()}, mLib{nullptr} - { } + XmlExporter(const fs::path& aExportPath) + : mExportBasePath{aExportPath}, + mExportFilePath{}, + mXml{}, + mCurXmlElem{mXml.RootElement()}, + mLib{nullptr} + { + } void exportXml() { @@ -45,92 +46,281 @@ class XmlExporter : public Visitor if(result != XML_SUCCESS) { - throw std::runtime_error("Saving XML file to " + mExportFilePath.string() - + " failed with error code " + std::to_string(result) + "!"); + throw std::runtime_error("Saving XML file to " + mExportFilePath.string() + " failed with error code " + + std::to_string(result) + "!"); } } virtual void visit(const Library& aObj) override; - virtual void visit(const PageSettings& /* aObj */) override { } - virtual void visit(const Point& /* aObj */) override { } + + virtual void visit(const PageSettings& /* aObj */) override + { + } + + virtual void visit(const Point& /* aObj */) override + { + } + virtual void visit(const PrimArc& aObj) override; virtual void visit(const PrimBezier& aObj) override; - virtual void visit(const PrimBitmap& /* aObj */) override { } - virtual void visit(const PrimCommentText& /* aObj */) override { } + + virtual void visit(const PrimBitmap& /* aObj */) override + { + } + + virtual void visit(const PrimCommentText& /* aObj */) override + { + } + virtual void visit(const PrimEllipse& aObj) override; virtual void visit(const PrimLine& aObj) override; virtual void visit(const PrimPolygon& aObj) override; virtual void visit(const PrimPolyline& aObj) override; virtual void visit(const PrimRect& aObj) override; virtual void visit(const PrimSymbolVector& aObj) override; - virtual void visit(const StreamAdminData& /* aObj */) override { } - virtual void visit(const StreamBOMDataStream& /* aObj */) override { } - virtual void visit(const StreamCache& /* aObj */) override { } - virtual void visit(const StreamDirectoryStruct& /* aObj */) override { } - virtual void visit(const StreamDsnStream& /* aObj */) override { } - virtual void visit(const StreamDTypeD& /* aObj */) override { } - virtual void visit(const StreamERC& /* aObj */) override { } - virtual void visit(const StreamHierarchy& /* aObj */) override { } - virtual void visit(const StreamHSObjects& /* aObj */) override { } - virtual void visit(const StreamLibrary& /* aObj */) override { } - virtual void visit(const StreamNetBundleMapData& /* aObj */) override { } + + virtual void visit(const StreamAdminData& /* aObj */) override + { + } + + virtual void visit(const StreamBOMDataStream& /* aObj */) override + { + } + + virtual void visit(const StreamCache& /* aObj */) override + { + } + + virtual void visit(const StreamDirectoryStruct& /* aObj */) override + { + } + + virtual void visit(const StreamDsnStream& /* aObj */) override + { + } + + virtual void visit(const StreamDTypeD& /* aObj */) override + { + } + + virtual void visit(const StreamERC& /* aObj */) override + { + } + + virtual void visit(const StreamHierarchy& /* aObj */) override + { + } + + virtual void visit(const StreamHSObjects& /* aObj */) override + { + } + + virtual void visit(const StreamLibrary& /* aObj */) override + { + } + + virtual void visit(const StreamNetBundleMapData& /* aObj */) override + { + } + virtual void visit(const StreamPackage& aObj) override; - virtual void visit(const StreamPage& /* aObj */) override { } - virtual void visit(const StreamSchematic& /* aObj */) override { } - virtual void visit(const StreamSymbol& /* aObj */) override { } - virtual void visit(const StructAlias& /* aObj */) override { } - virtual void visit(const StructBookMarkSymbolInst& /* aObj */) override { } - virtual void visit(const StructBusEntry& /* aObj */) override { } - virtual void visit(const StructDevice& /* aObj */) override { } - virtual void visit(const StructERCObject& /* aObj */) override { } - virtual void visit(const StructERCSymbol& /* aObj */) override { } - virtual void visit(const StructGeneralProperties& /* aObj */) override { } - virtual void visit(const StructGlobal& /* aObj */) override { } - virtual void visit(const StructGlobalSymbol& /* aObj */) override { } - virtual void visit(const StructGraphicArcInst& /* aObj */) override { } - virtual void visit(const StructGraphicBezierInst& /* aObj */) override { } - virtual void visit(const StructGraphicBitMapInst& /* aObj */) override { } - virtual void visit(const StructGraphicBoxInst& /* aObj */) override { } - virtual void visit(const StructGraphicCommentTextInst& /* aObj */) override { } - virtual void visit(const StructGraphicEllipseInst& /* aObj */) override { } - virtual void visit(const StructGraphicLineInst& /* aObj */) override { } - virtual void visit(const StructGraphicOleEmbedInst& /* aObj */) override { } - virtual void visit(const StructGraphicPolygonInst& /* aObj */) override { } - virtual void visit(const StructGraphicPolylineInst& /* aObj */) override { } + + virtual void visit(const StreamPage& /* aObj */) override + { + } + + virtual void visit(const StreamSchematic& /* aObj */) override + { + } + + virtual void visit(const StreamSymbol& /* aObj */) override + { + } + + virtual void visit(const StructAlias& /* aObj */) override + { + } + + virtual void visit(const StructBookMarkSymbolInst& /* aObj */) override + { + } + + virtual void visit(const StructBusEntry& /* aObj */) override + { + } + + virtual void visit(const StructDevice& /* aObj */) override + { + } + + virtual void visit(const StructERCObject& /* aObj */) override + { + } + + virtual void visit(const StructERCSymbol& /* aObj */) override + { + } + + virtual void visit(const StructGeneralProperties& /* aObj */) override + { + } + + virtual void visit(const StructGlobal& /* aObj */) override + { + } + + virtual void visit(const StructGlobalSymbol& /* aObj */) override + { + } + + virtual void visit(const StructGraphicArcInst& /* aObj */) override + { + } + + virtual void visit(const StructGraphicBezierInst& /* aObj */) override + { + } + + virtual void visit(const StructGraphicBitMapInst& /* aObj */) override + { + } + + virtual void visit(const StructGraphicBoxInst& /* aObj */) override + { + } + + virtual void visit(const StructGraphicCommentTextInst& /* aObj */) override + { + } + + virtual void visit(const StructGraphicEllipseInst& /* aObj */) override + { + } + + virtual void visit(const StructGraphicLineInst& /* aObj */) override + { + } + + virtual void visit(const StructGraphicOleEmbedInst& /* aObj */) override + { + } + + virtual void visit(const StructGraphicPolygonInst& /* aObj */) override + { + } + + virtual void visit(const StructGraphicPolylineInst& /* aObj */) override + { + } + virtual void visit(const StructLibraryPart& aObj) override; - virtual void visit(const StructNetDbIdMapping& /* aObj */) override { } - virtual void visit(const StructOffPageConnector& /* aObj */) override { } - virtual void visit(const StructOffPageSymbol& /* aObj */) override { } + + virtual void visit(const StructNetDbIdMapping& /* aObj */) override + { + } + + virtual void visit(const StructOffPageConnector& /* aObj */) override + { + } + + virtual void visit(const StructOffPageSymbol& /* aObj */) override + { + } + virtual void visit(const StructPackage& aObj) override; - virtual void visit(const StructPartCell& /* aObj */) override { } - virtual void visit(const StructPinShapeSymbol& /* aObj */) override { } - virtual void visit(const StructPlacedInstance& /* aObj */) override { } - virtual void visit(const StructPort& /* aObj */) override { } - virtual void visit(const StructPortSymbol& /* aObj */) override { } - virtual void visit(const StructSthInHierarchy1& /* aObj */) override { } - virtual void visit(const StructSthInHierarchy2& /* aObj */) override { } - virtual void visit(const StructSthInHierarchy3& /* aObj */) override { } - virtual void visit(const StructSthInPages0& /* aObj */) override { } - virtual void visit(const StructSymbol& /* aObj */) override { } - virtual void visit(const StructSymbolBBox& /* aObj */) override { } + + virtual void visit(const StructPartCell& /* aObj */) override + { + } + + virtual void visit(const StructPinShapeSymbol& /* aObj */) override + { + } + + virtual void visit(const StructPlacedInstance& /* aObj */) override + { + } + + virtual void visit(const StructPort& /* aObj */) override + { + } + + virtual void visit(const StructPortSymbol& /* aObj */) override + { + } + + virtual void visit(const StructSthInHierarchy1& /* aObj */) override + { + } + + virtual void visit(const StructSthInHierarchy2& /* aObj */) override + { + } + + virtual void visit(const StructSthInHierarchy3& /* aObj */) override + { + } + + virtual void visit(const StructSthInPages0& /* aObj */) override + { + } + + virtual void visit(const StructSymbol& /* aObj */) override + { + } + + virtual void visit(const StructSymbolBBox& /* aObj */) override + { + } + virtual void visit(const StructSymbolDisplayProp& aObj) override; virtual void visit(const StructSymbolPin& aObj) override; virtual void visit(const StructSymbolPinBus& aObj) override; virtual void visit(const StructSymbolPinScalar& aObj) override; - virtual void visit(const StructT0x10& /* aObj */) override { } - virtual void visit(const StructT0x34& /* aObj */) override { } - virtual void visit(const StructT0x35& /* aObj */) override { } - virtual void visit(const StructT0x45& /* aObj */) override { } - virtual void visit(const StructT0x5b& /* aObj */) override { } - virtual void visit(const StructTitleBlock& /* aObj */) override { } - virtual void visit(const StructTitleBlockSymbol& /* aObj */) override { } - virtual void visit(const StructWire& /* aObj */) override { } - virtual void visit(const StructWireBus& /* aObj */) override { } - virtual void visit(const StructWireScalar& /* aObj */) override { } + + virtual void visit(const StructT0x10& /* aObj */) override + { + } + + virtual void visit(const StructT0x34& /* aObj */) override + { + } + + virtual void visit(const StructT0x35& /* aObj */) override + { + } + + virtual void visit(const StructT0x45& /* aObj */) override + { + } + + virtual void visit(const StructT0x5b& /* aObj */) override + { + } + + virtual void visit(const StructTitleBlock& /* aObj */) override + { + } + + virtual void visit(const StructTitleBlockSymbol& /* aObj */) override + { + } + + virtual void visit(const StructWire& /* aObj */) override + { + } + + virtual void visit(const StructWireBus& /* aObj */) override + { + } + + virtual void visit(const StructWireScalar& /* aObj */) override + { + } + virtual void visit(const tagLOGFONTA& aObj) override; private: - const fs::path mExportBasePath; fs::path mExportFilePath; @@ -140,5 +330,4 @@ class XmlExporter : public Visitor const Library* mLib; }; - #endif // XMLEXPORTER_HPP \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index b5318c1c..dd8069bc 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -9,26 +9,21 @@ #include "Container.hpp" // #include "XmlExporter.hpp" - namespace fs = std::filesystem; namespace po = boost::program_options; - -void parseArgs(int argc, char* argv[], fs::path& input, bool& printTree, bool& extract, - fs::path& output, int& verbosity, bool& stopParsing, bool& keep, unsigned int& jobs) +void parseArgs(int argc, char* argv[], fs::path& input, bool& printTree, bool& extract, fs::path& output, + int& verbosity, bool& stopParsing, bool& keep, unsigned int& jobs) { po::options_description desc("Allowed options"); - desc.add_options() - ("help,h", "produce help message") - ("print_tree,t", po::bool_switch()->default_value(false), "print container tree") - ("extract,e", po::bool_switch()->default_value(false), "extract binary files from CFBF container") - ("input,i", po::value(), "input file to parse") - ("output,o", po::value(), "output path (required iff extract is set)") - ("verbosity,v", po::value()->default_value(4), "verbosity level (0 = off, 6 = highest)") - ("stop,s", po::bool_switch()->default_value(false), "stop parsing on low severity errors") - ("keep,k", po::bool_switch()->default_value(false), "keep temporary files after parser completed") - ("jobs,j", po::value()->default_value(1U), "number of threads (jobs) to run stream parsing in parallel") - ; + desc.add_options()("help,h", "produce help message")("print_tree,t", po::bool_switch()->default_value(false), + "print container tree")("extract,e", po::bool_switch()->default_value(false), + "extract binary files from CFBF container")("input,i", po::value(), "input file to parse")( + "output,o", po::value(), "output path (required iff extract is set)")( + "verbosity,v", po::value()->default_value(4), "verbosity level (0 = off, 6 = highest)")( + "stop,s", po::bool_switch()->default_value(false), "stop parsing on low severity errors")( + "keep,k", po::bool_switch()->default_value(false), "keep temporary files after parser completed")("jobs,j", + po::value()->default_value(1U), "number of threads (jobs) to run stream parsing in parallel"); po::variables_map vm; po::store(po::parse_command_line(argc, argv, desc), vm); @@ -108,44 +103,57 @@ void parseArgs(int argc, char* argv[], fs::path& input, bool& printTree, bool& e } } - int main(int argc, char* argv[]) { - fs::path inputFile; - bool printTree; - bool extract; - fs::path outputPath; - int verbosity; - bool stopParsing; // on low severity errors - bool keepTmpFiles; + fs::path inputFile; + bool printTree; + bool extract; + fs::path outputPath; + int verbosity; + bool stopParsing; // on low severity errors + bool keepTmpFiles; unsigned int jobs; - parseArgs(argc, argv, inputFile, printTree, extract, - outputPath, verbosity, stopParsing, keepTmpFiles, jobs); + parseArgs(argc, argv, inputFile, printTree, extract, outputPath, verbosity, stopParsing, keepTmpFiles, jobs); - // Creating console logger + // Creating console logger auto console_sink = std::make_shared(); // Creating file logger auto file_sink = std::make_shared("OpenOrCadParser.log"); // Creating multi-logger - spdlog::logger logger{"console and file", {console_sink, file_sink}}; + spdlog::logger logger{ + "console and file", {console_sink, file_sink} + }; spdlog::set_default_logger(std::make_shared(logger)); switch(verbosity) { - case 0: spdlog::set_level(spdlog::level::off); break; - case 1: spdlog::set_level(spdlog::level::critical); break; - case 2: spdlog::set_level(spdlog::level::err); break; - case 3: spdlog::set_level(spdlog::level::warn); break; - case 4: spdlog::set_level(spdlog::level::info); break; - case 5: spdlog::set_level(spdlog::level::debug); break; - case 6: spdlog::set_level(spdlog::level::trace); break; + case 0: + spdlog::set_level(spdlog::level::off); + break; + case 1: + spdlog::set_level(spdlog::level::critical); + break; + case 2: + spdlog::set_level(spdlog::level::err); + break; + case 3: + spdlog::set_level(spdlog::level::warn); + break; + case 4: + spdlog::set_level(spdlog::level::info); + break; + case 5: + spdlog::set_level(spdlog::level::debug); + break; + case 6: + spdlog::set_level(spdlog::level::trace); + break; default: - throw std::runtime_error( - fmt::format("Invalid verbosity argument {}", verbosity)); + throw std::runtime_error(fmt::format("Invalid verbosity argument {}", verbosity)); break; }