From 33bc74a4a22c57cb0987c421c7d9ea62d6e2957b Mon Sep 17 00:00:00 2001 From: John Beard Date: Mon, 28 Jan 2019 10:36:54 +0000 Subject: [PATCH] QA: Tidy qa_utils headers Move into own include directory for clarity. Also allows qa_utils to use its own private headers in qa/qa_utils without exposing them through the target_include_directories directive. --- qa/common_tools/main.cpp | 2 +- qa/common_tools/tools/coroutines/coroutine_tools.h | 2 +- qa/common_tools/tools/io_benchmark/io_benchmark.cpp | 4 ++-- qa/common_tools/tools/io_benchmark/io_benchmark.h | 10 +++++----- qa/pcbnew_tools/pcbnew_tools.cpp | 2 +- qa/pcbnew_tools/tools/drc_tool/drc_tool.cpp | 4 ++-- qa/pcbnew_tools/tools/drc_tool/drc_tool.h | 2 +- qa/pcbnew_tools/tools/pcb_parser/pcb_parser_tool.cpp | 4 ++-- qa/pcbnew_tools/tools/pcb_parser/pcb_parser_tool.h | 2 +- .../tools/polygon_generator/polygon_generator.h | 2 +- .../polygon_triangulation/polygon_triangulation.h | 2 +- qa/pcbnew_utils/board_file_utils.cpp | 2 +- qa/qa_utils/CMakeLists.txt | 1 - qa/qa_utils/{ => include/qa_utils}/scoped_timer.h | 9 +++------ .../{ => include/qa_utils}/stdstream_line_reader.h | 10 ++++------ qa/qa_utils/{ => include/qa_utils}/utility_program.h | 0 qa/qa_utils/stdstream_line_reader.cpp | 2 +- qa/qa_utils/utility_program.cpp | 2 +- 18 files changed, 28 insertions(+), 34 deletions(-) rename qa/qa_utils/{ => include/qa_utils}/scoped_timer.h (91%) rename qa/qa_utils/{ => include/qa_utils}/stdstream_line_reader.h (94%) rename qa/qa_utils/{ => include/qa_utils}/utility_program.h (100%) diff --git a/qa/common_tools/main.cpp b/qa/common_tools/main.cpp index f42f83d409..f537fd826a 100644 --- a/qa/common_tools/main.cpp +++ b/qa/common_tools/main.cpp @@ -21,7 +21,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#include +#include #include "tools/coroutines/coroutine_tools.h" #include "tools/io_benchmark/io_benchmark.h" diff --git a/qa/common_tools/tools/coroutines/coroutine_tools.h b/qa/common_tools/tools/coroutines/coroutine_tools.h index 89f54501e0..221a57b114 100644 --- a/qa/common_tools/tools/coroutines/coroutine_tools.h +++ b/qa/common_tools/tools/coroutines/coroutine_tools.h @@ -2,7 +2,7 @@ #ifndef COROUTINES_UTILTY_H #define COROUTINES_UTILTY_H -#include +#include /// A tool to test a simple coroutine extern KI_TEST::UTILITY_PROGRAM coroutine_tool; diff --git a/qa/common_tools/tools/io_benchmark/io_benchmark.cpp b/qa/common_tools/tools/io_benchmark/io_benchmark.cpp index a1df3f2803..23c557857e 100644 --- a/qa/common_tools/tools/io_benchmark/io_benchmark.cpp +++ b/qa/common_tools/tools/io_benchmark/io_benchmark.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2017 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2017-2019 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 @@ -36,7 +36,7 @@ #include #include -#include "stdstream_line_reader.h" +#include using CLOCK = std::chrono::steady_clock; diff --git a/qa/common_tools/tools/io_benchmark/io_benchmark.h b/qa/common_tools/tools/io_benchmark/io_benchmark.h index b115ce744a..6f16d9668a 100644 --- a/qa/common_tools/tools/io_benchmark/io_benchmark.h +++ b/qa/common_tools/tools/io_benchmark/io_benchmark.h @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2018 KiCad Developers, see CHANGELOG.TXT for contributors. + * Copyright (C) 2018-2019 KiCad Developers, see CHANGELOG.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 @@ -21,11 +21,11 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#ifndef IO_BENCHMARK_H -#define IO_BENCHMARK_H +#ifndef QA_COMMON_TOOLS_IO_BENCHMARK__H +#define QA_COMMON_TOOLS_IO_BENCHMARK__H -#include +#include extern KI_TEST::UTILITY_PROGRAM io_benchmark_tool; -#endif // IO_BENCHMARK_H \ No newline at end of file +#endif // QA_COMMON_TOOLS_IO_BENCHMARK__H \ No newline at end of file diff --git a/qa/pcbnew_tools/pcbnew_tools.cpp b/qa/pcbnew_tools/pcbnew_tools.cpp index 4b810b8b98..1d57cd41da 100644 --- a/qa/pcbnew_tools/pcbnew_tools.cpp +++ b/qa/pcbnew_tools/pcbnew_tools.cpp @@ -21,7 +21,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#include +#include #include "tools/drc_tool/drc_tool.h" #include "tools/pcb_parser/pcb_parser_tool.h" diff --git a/qa/pcbnew_tools/tools/drc_tool/drc_tool.cpp b/qa/pcbnew_tools/tools/drc_tool/drc_tool.cpp index 28b3acd93b..83ded9fa65 100644 --- a/qa/pcbnew_tools/tools/drc_tool/drc_tool.cpp +++ b/qa/pcbnew_tools/tools/drc_tool/drc_tool.cpp @@ -36,8 +36,8 @@ #include #include -#include -#include +#include +#include using DRC_DURATION = std::chrono::microseconds; diff --git a/qa/pcbnew_tools/tools/drc_tool/drc_tool.h b/qa/pcbnew_tools/tools/drc_tool/drc_tool.h index accb2e97ba..da5ab20c4d 100644 --- a/qa/pcbnew_tools/tools/drc_tool/drc_tool.h +++ b/qa/pcbnew_tools/tools/drc_tool/drc_tool.h @@ -24,7 +24,7 @@ #ifndef PCBNEW_TOOLS_DRC_TOOL_H #define PCBNEW_TOOLS_DRC_TOOL_H -#include +#include /// A tool to run DRC tools on KiCad PCBs from the command line extern KI_TEST::UTILITY_PROGRAM drc_tool; diff --git a/qa/pcbnew_tools/tools/pcb_parser/pcb_parser_tool.cpp b/qa/pcbnew_tools/tools/pcb_parser/pcb_parser_tool.cpp index e29447bc80..2bf77679ff 100644 --- a/qa/pcbnew_tools/tools/pcb_parser/pcb_parser_tool.cpp +++ b/qa/pcbnew_tools/tools/pcb_parser/pcb_parser_tool.cpp @@ -37,8 +37,8 @@ #include -#include -#include +#include +#include using PARSE_DURATION = std::chrono::microseconds; diff --git a/qa/pcbnew_tools/tools/pcb_parser/pcb_parser_tool.h b/qa/pcbnew_tools/tools/pcb_parser/pcb_parser_tool.h index cfbe4fb574..cd574f7286 100644 --- a/qa/pcbnew_tools/tools/pcb_parser/pcb_parser_tool.h +++ b/qa/pcbnew_tools/tools/pcb_parser/pcb_parser_tool.h @@ -24,7 +24,7 @@ #ifndef PCBNEW_TOOLS_PCB_PARSER_UTILITY_H #define PCBNEW_TOOLS_PCB_PARSER_UTILITY_H -#include +#include /// A tool to parse kicad PCBs from the command line extern KI_TEST::UTILITY_PROGRAM pcb_parser_tool; diff --git a/qa/pcbnew_tools/tools/polygon_generator/polygon_generator.h b/qa/pcbnew_tools/tools/polygon_generator/polygon_generator.h index bab141224d..f2b3d575c6 100644 --- a/qa/pcbnew_tools/tools/polygon_generator/polygon_generator.h +++ b/qa/pcbnew_tools/tools/polygon_generator/polygon_generator.h @@ -24,7 +24,7 @@ #ifndef PCBNEW_TOOLS_POLYGON_GENERATOR_UTILITY_H #define PCBNEW_TOOLS_POLYGON_GENERATOR_UTILITY_H -#include +#include /// A tool to parse kicad PCBs from the command line extern KI_TEST::UTILITY_PROGRAM polygon_generator_tool; diff --git a/qa/pcbnew_tools/tools/polygon_triangulation/polygon_triangulation.h b/qa/pcbnew_tools/tools/polygon_triangulation/polygon_triangulation.h index b3410db60a..8b1b560f43 100644 --- a/qa/pcbnew_tools/tools/polygon_triangulation/polygon_triangulation.h +++ b/qa/pcbnew_tools/tools/polygon_triangulation/polygon_triangulation.h @@ -24,7 +24,7 @@ #ifndef PCBNEW_TOOLS_POLYGON_TRIANGULATION_UTILITY_H #define PCBNEW_TOOLS_POLYGON_TRIANGULATION_UTILITY_H -#include +#include /// A tool to parse kicad PCBs from the command line extern KI_TEST::UTILITY_PROGRAM polygon_triangulation_tool; diff --git a/qa/pcbnew_utils/board_file_utils.cpp b/qa/pcbnew_utils/board_file_utils.cpp index d4969ae91b..395bfa7084 100644 --- a/qa/pcbnew_utils/board_file_utils.cpp +++ b/qa/pcbnew_utils/board_file_utils.cpp @@ -30,7 +30,7 @@ #include -#include +#include namespace KI_TEST { diff --git a/qa/qa_utils/CMakeLists.txt b/qa/qa_utils/CMakeLists.txt index 1e8bcffe29..20fed4511b 100644 --- a/qa/qa_utils/CMakeLists.txt +++ b/qa/qa_utils/CMakeLists.txt @@ -42,5 +42,4 @@ target_link_libraries( qa_utils target_include_directories( qa_utils PUBLIC include - ${CMAKE_CURRENT_SOURCE_DIR} ) \ No newline at end of file diff --git a/qa/qa_utils/scoped_timer.h b/qa/qa_utils/include/qa_utils/scoped_timer.h similarity index 91% rename from qa/qa_utils/scoped_timer.h rename to qa/qa_utils/include/qa_utils/scoped_timer.h index 028bfef460..78a855d5c6 100644 --- a/qa/qa_utils/scoped_timer.h +++ b/qa/qa_utils/include/qa_utils/scoped_timer.h @@ -32,15 +32,13 @@ * ON construction, a timer is started, and on destruction, the timer is * ended, and the time difference is written into the given duration */ -template -class SCOPED_TIMER +template class SCOPED_TIMER { using CLOCK = std::chrono::steady_clock; using TIME_PT = std::chrono::time_point; public: - SCOPED_TIMER( DURATION& aDuration ): - m_duration( aDuration ) + SCOPED_TIMER( DURATION& aDuration ) : m_duration( aDuration ) { m_start = CLOCK::now(); } @@ -54,9 +52,8 @@ public: } private: - DURATION& m_duration; - TIME_PT m_start; + TIME_PT m_start; }; #endif // SCOPED_TIMER_h \ No newline at end of file diff --git a/qa/qa_utils/stdstream_line_reader.h b/qa/qa_utils/include/qa_utils/stdstream_line_reader.h similarity index 94% rename from qa/qa_utils/stdstream_line_reader.h rename to qa/qa_utils/include/qa_utils/stdstream_line_reader.h index 81c238dc69..491e3a010c 100644 --- a/qa/qa_utils/stdstream_line_reader.h +++ b/qa/qa_utils/include/qa_utils/stdstream_line_reader.h @@ -28,8 +28,8 @@ #include -#include #include +#include /** * LINE_READER that wraps a given std::istream instance. @@ -37,21 +37,20 @@ class STDISTREAM_LINE_READER : public LINE_READER { public: - STDISTREAM_LINE_READER(); ~STDISTREAM_LINE_READER(); - char* ReadLine() override; + char* ReadLine() override; /** * Set the stream for this line reader. * @param aStream a stream to read */ - void SetStream( std::istream& aStream ); + void SetStream( std::istream& aStream ); private: - std::string m_buffer; + std::string m_buffer; std::istream* m_stream; }; @@ -62,7 +61,6 @@ private: class IFSTREAM_LINE_READER : public STDISTREAM_LINE_READER { public: - IFSTREAM_LINE_READER( const wxFileName& aFileName ); void Rewind(); diff --git a/qa/qa_utils/utility_program.h b/qa/qa_utils/include/qa_utils/utility_program.h similarity index 100% rename from qa/qa_utils/utility_program.h rename to qa/qa_utils/include/qa_utils/utility_program.h diff --git a/qa/qa_utils/stdstream_line_reader.cpp b/qa/qa_utils/stdstream_line_reader.cpp index d473f34422..ededd0ca36 100644 --- a/qa/qa_utils/stdstream_line_reader.cpp +++ b/qa/qa_utils/stdstream_line_reader.cpp @@ -21,7 +21,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "stdstream_line_reader.h" +#include #include diff --git a/qa/qa_utils/utility_program.cpp b/qa/qa_utils/utility_program.cpp index 39457c44a1..47908d253d 100644 --- a/qa/qa_utils/utility_program.cpp +++ b/qa/qa_utils/utility_program.cpp @@ -20,7 +20,7 @@ * or you may write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "utility_program.h" +#include #include