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.
This commit is contained in:
John Beard 2019-01-28 10:36:54 +00:00 committed by Wayne Stambaugh
parent 47ec2fd5ba
commit 33bc74a4a2
18 changed files with 28 additions and 34 deletions

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include <utility_program.h> #include <qa_utils/utility_program.h>
#include "tools/coroutines/coroutine_tools.h" #include "tools/coroutines/coroutine_tools.h"
#include "tools/io_benchmark/io_benchmark.h" #include "tools/io_benchmark/io_benchmark.h"

View File

@ -2,7 +2,7 @@
#ifndef COROUTINES_UTILTY_H #ifndef COROUTINES_UTILTY_H
#define COROUTINES_UTILTY_H #define COROUTINES_UTILTY_H
#include <utility_program.h> #include <qa_utils/utility_program.h>
/// A tool to test a simple coroutine /// A tool to test a simple coroutine
extern KI_TEST::UTILITY_PROGRAM coroutine_tool; extern KI_TEST::UTILITY_PROGRAM coroutine_tool;

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -36,7 +36,7 @@
#include <wx/wfstream.h> #include <wx/wfstream.h>
#include <wx/filename.h> #include <wx/filename.h>
#include "stdstream_line_reader.h" #include <qa_utils/stdstream_line_reader.h>
using CLOCK = std::chrono::steady_clock; using CLOCK = std::chrono::steady_clock;

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * 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 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#ifndef IO_BENCHMARK_H #ifndef QA_COMMON_TOOLS_IO_BENCHMARK__H
#define IO_BENCHMARK_H #define QA_COMMON_TOOLS_IO_BENCHMARK__H
#include <utility_program.h> #include <qa_utils/utility_program.h>
extern KI_TEST::UTILITY_PROGRAM io_benchmark_tool; extern KI_TEST::UTILITY_PROGRAM io_benchmark_tool;
#endif // IO_BENCHMARK_H #endif // QA_COMMON_TOOLS_IO_BENCHMARK__H

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include <utility_program.h> #include <qa_utils/utility_program.h>
#include "tools/drc_tool/drc_tool.h" #include "tools/drc_tool/drc_tool.h"
#include "tools/pcb_parser/pcb_parser_tool.h" #include "tools/pcb_parser/pcb_parser_tool.h"

View File

@ -36,8 +36,8 @@
#include <drc/courtyard_overlap.h> #include <drc/courtyard_overlap.h>
#include <drc/drc_marker_factory.h> #include <drc/drc_marker_factory.h>
#include <scoped_timer.h> #include <qa_utils/scoped_timer.h>
#include <stdstream_line_reader.h> #include <qa_utils/stdstream_line_reader.h>
using DRC_DURATION = std::chrono::microseconds; using DRC_DURATION = std::chrono::microseconds;

View File

@ -24,7 +24,7 @@
#ifndef PCBNEW_TOOLS_DRC_TOOL_H #ifndef PCBNEW_TOOLS_DRC_TOOL_H
#define PCBNEW_TOOLS_DRC_TOOL_H #define PCBNEW_TOOLS_DRC_TOOL_H
#include <utility_program.h> #include <qa_utils/utility_program.h>
/// A tool to run DRC tools on KiCad PCBs from the command line /// A tool to run DRC tools on KiCad PCBs from the command line
extern KI_TEST::UTILITY_PROGRAM drc_tool; extern KI_TEST::UTILITY_PROGRAM drc_tool;

View File

@ -37,8 +37,8 @@
#include <wx/cmdline.h> #include <wx/cmdline.h>
#include <scoped_timer.h> #include <qa_utils/scoped_timer.h>
#include <stdstream_line_reader.h> #include <qa_utils/stdstream_line_reader.h>
using PARSE_DURATION = std::chrono::microseconds; using PARSE_DURATION = std::chrono::microseconds;

View File

@ -24,7 +24,7 @@
#ifndef PCBNEW_TOOLS_PCB_PARSER_UTILITY_H #ifndef PCBNEW_TOOLS_PCB_PARSER_UTILITY_H
#define PCBNEW_TOOLS_PCB_PARSER_UTILITY_H #define PCBNEW_TOOLS_PCB_PARSER_UTILITY_H
#include <utility_program.h> #include <qa_utils/utility_program.h>
/// A tool to parse kicad PCBs from the command line /// A tool to parse kicad PCBs from the command line
extern KI_TEST::UTILITY_PROGRAM pcb_parser_tool; extern KI_TEST::UTILITY_PROGRAM pcb_parser_tool;

View File

@ -24,7 +24,7 @@
#ifndef PCBNEW_TOOLS_POLYGON_GENERATOR_UTILITY_H #ifndef PCBNEW_TOOLS_POLYGON_GENERATOR_UTILITY_H
#define PCBNEW_TOOLS_POLYGON_GENERATOR_UTILITY_H #define PCBNEW_TOOLS_POLYGON_GENERATOR_UTILITY_H
#include <utility_program.h> #include <qa_utils/utility_program.h>
/// A tool to parse kicad PCBs from the command line /// A tool to parse kicad PCBs from the command line
extern KI_TEST::UTILITY_PROGRAM polygon_generator_tool; extern KI_TEST::UTILITY_PROGRAM polygon_generator_tool;

View File

@ -24,7 +24,7 @@
#ifndef PCBNEW_TOOLS_POLYGON_TRIANGULATION_UTILITY_H #ifndef PCBNEW_TOOLS_POLYGON_TRIANGULATION_UTILITY_H
#define PCBNEW_TOOLS_POLYGON_TRIANGULATION_UTILITY_H #define PCBNEW_TOOLS_POLYGON_TRIANGULATION_UTILITY_H
#include <utility_program.h> #include <qa_utils/utility_program.h>
/// A tool to parse kicad PCBs from the command line /// A tool to parse kicad PCBs from the command line
extern KI_TEST::UTILITY_PROGRAM polygon_triangulation_tool; extern KI_TEST::UTILITY_PROGRAM polygon_triangulation_tool;

View File

@ -30,7 +30,7 @@
#include <class_board.h> #include <class_board.h>
#include <stdstream_line_reader.h> #include <qa_utils/stdstream_line_reader.h>
namespace KI_TEST namespace KI_TEST
{ {

View File

@ -42,5 +42,4 @@ target_link_libraries( qa_utils
target_include_directories( qa_utils PUBLIC target_include_directories( qa_utils PUBLIC
include include
${CMAKE_CURRENT_SOURCE_DIR}
) )

View File

@ -32,15 +32,13 @@
* ON construction, a timer is started, and on destruction, the timer is * ON construction, a timer is started, and on destruction, the timer is
* ended, and the time difference is written into the given duration * ended, and the time difference is written into the given duration
*/ */
template<typename DURATION> template <typename DURATION> class SCOPED_TIMER
class SCOPED_TIMER
{ {
using CLOCK = std::chrono::steady_clock; using CLOCK = std::chrono::steady_clock;
using TIME_PT = std::chrono::time_point<CLOCK>; using TIME_PT = std::chrono::time_point<CLOCK>;
public: public:
SCOPED_TIMER( DURATION& aDuration ): SCOPED_TIMER( DURATION& aDuration ) : m_duration( aDuration )
m_duration( aDuration )
{ {
m_start = CLOCK::now(); m_start = CLOCK::now();
} }
@ -54,9 +52,8 @@ public:
} }
private: private:
DURATION& m_duration; DURATION& m_duration;
TIME_PT m_start; TIME_PT m_start;
}; };
#endif // SCOPED_TIMER_h #endif // SCOPED_TIMER_h

View File

@ -28,8 +28,8 @@
#include <richio.h> #include <richio.h>
#include <istream>
#include <fstream> #include <fstream>
#include <istream>
/** /**
* LINE_READER that wraps a given std::istream instance. * LINE_READER that wraps a given std::istream instance.
@ -37,21 +37,20 @@
class STDISTREAM_LINE_READER : public LINE_READER class STDISTREAM_LINE_READER : public LINE_READER
{ {
public: public:
STDISTREAM_LINE_READER(); STDISTREAM_LINE_READER();
~STDISTREAM_LINE_READER(); ~STDISTREAM_LINE_READER();
char* ReadLine() override; char* ReadLine() override;
/** /**
* Set the stream for this line reader. * Set the stream for this line reader.
* @param aStream a stream to read * @param aStream a stream to read
*/ */
void SetStream( std::istream& aStream ); void SetStream( std::istream& aStream );
private: private:
std::string m_buffer; std::string m_buffer;
std::istream* m_stream; std::istream* m_stream;
}; };
@ -62,7 +61,6 @@ private:
class IFSTREAM_LINE_READER : public STDISTREAM_LINE_READER class IFSTREAM_LINE_READER : public STDISTREAM_LINE_READER
{ {
public: public:
IFSTREAM_LINE_READER( const wxFileName& aFileName ); IFSTREAM_LINE_READER( const wxFileName& aFileName );
void Rewind(); void Rewind();

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "stdstream_line_reader.h" #include <qa_utils/stdstream_line_reader.h>
#include <ios> #include <ios>

View File

@ -20,7 +20,7 @@
* or you may write to the Free Software Foundation, Inc., * or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "utility_program.h" #include <qa_utils/utility_program.h>
#include <wx/msgout.h> #include <wx/msgout.h>