From 436671edc31751eac522d3fb663bd098bdea120d Mon Sep 17 00:00:00 2001 From: John Beard Date: Thu, 3 Oct 2024 22:31:24 +0100 Subject: [PATCH] Embedded files parser in own header This drags in dsnlexer.h to everything that uses EMBEDDED_FILES, but the parser is actually only used in two files. It's not the only thing to drag it in, though. Currently, touching dsnlexer.h rebuilds nearly 800 files, when it actually is needed by about 50 at most. --- common/embedded_files.cpp | 4 ++- .../kicad_sexpr/sch_io_kicad_sexpr_parser.cpp | 1 + include/embedded_files.h | 19 +---------- include/embedded_files_parser.h | 34 +++++++++++++++++++ .../kicad_sexpr/pcb_io_kicad_sexpr_parser.cpp | 2 +- 5 files changed, 40 insertions(+), 20 deletions(-) create mode 100644 include/embedded_files_parser.h diff --git a/common/embedded_files.cpp b/common/embedded_files.cpp index c88326c04b..ce4d33e209 100644 --- a/common/embedded_files.cpp +++ b/common/embedded_files.cpp @@ -17,6 +17,9 @@ * with this program. If not, see . */ +#include "embedded_files.h" +#include "embedded_files_parser.h" + #include #include #include @@ -31,7 +34,6 @@ #include -#include #include #include #include diff --git a/eeschema/sch_io/kicad_sexpr/sch_io_kicad_sexpr_parser.cpp b/eeschema/sch_io/kicad_sexpr/sch_io_kicad_sexpr_parser.cpp index 0600064814..87c813d5ac 100644 --- a/eeschema/sch_io/kicad_sexpr/sch_io_kicad_sexpr_parser.cpp +++ b/eeschema/sch_io/kicad_sexpr/sch_io_kicad_sexpr_parser.cpp @@ -37,6 +37,7 @@ #include #include +#include #include #include #include // KiROUND diff --git a/include/embedded_files.h b/include/embedded_files.h index 5d68fb09ff..2906a49660 100644 --- a/include/embedded_files.h +++ b/include/embedded_files.h @@ -17,15 +17,13 @@ * with this program. If not, see . */ -#ifndef EMBEDDED_FILES_H -#define EMBEDDED_FILES_H +#pragma once #include #include #include -#include #include #include #include @@ -242,18 +240,3 @@ protected: // Otherwise, font files embedded in the element will be // removed on save }; - - - -class EMBEDDED_FILES_PARSER : public EMBEDDED_FILES_LEXER -{ -public: - EMBEDDED_FILES_PARSER( LINE_READER* aReader ) : - EMBEDDED_FILES_LEXER( aReader ) - { - } - - void ParseEmbedded( EMBEDDED_FILES* aFiles ); - -}; -#endif // EMBEDDED_FILES_H \ No newline at end of file diff --git a/include/embedded_files_parser.h b/include/embedded_files_parser.h new file mode 100644 index 0000000000..3b358d6915 --- /dev/null +++ b/include/embedded_files_parser.h @@ -0,0 +1,34 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2024 KiCad Developers, see AUTHORS.txt for contributors. + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#pragma once + +#include +#include + +class EMBEDDED_FILES_PARSER : public EMBEDDED_FILES_LEXER +{ +public: + EMBEDDED_FILES_PARSER( LINE_READER* aReader ) : + EMBEDDED_FILES_LEXER( aReader ) + { + } + + void ParseEmbedded( EMBEDDED_FILES* aFiles ); +}; \ No newline at end of file diff --git a/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr_parser.cpp b/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr_parser.cpp index a78c8b9023..3f7393121b 100644 --- a/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr_parser.cpp +++ b/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr_parser.cpp @@ -37,7 +37,7 @@ #include #include -#include +#include #include #include #include