KiCad PCB EDA Suite
KI_TEST::UTILITY_PROGRAM Struct Reference

Description of a "utility program", which is a program that takes some command line and does "something". More...

#include <utility_program.h>

Public Types

using FUNC = std::function< int(int argc, char **argv)>
 A function that provides the program for a given command line. More...
 

Public Member Functions

 UTILITY_PROGRAM (const std::string &aName, const std::string &aDesc, FUNC aMainFunc)
 
 UTILITY_PROGRAM ()
 

Public Attributes

std::string m_name
 The name of the program (this is used to select one) More...
 
std::string m_desc
 Description of the program. More...
 
FUNC m_func
 The function to call to run the program. More...
 

Detailed Description

Description of a "utility program", which is a program that takes some command line and does "something".

Likely uses of this are:

  • Test programs and demos
  • Benchmarks
  • Fuzz targets

This structure allows a single executable to select a program from many registered programs to avoid having to maintain "N" similar CMake scripts and perform "N" linkages.

Definition at line 68 of file utility_program.h.

Member Typedef Documentation

◆ FUNC

using KI_TEST::UTILITY_PROGRAM::FUNC = std::function<int( int argc, char** argv )>

A function that provides the program for a given command line.

Definition at line 71 of file utility_program.h.

Constructor & Destructor Documentation

◆ UTILITY_PROGRAM() [1/2]

KI_TEST::UTILITY_PROGRAM::UTILITY_PROGRAM ( const std::string &  aName,
const std::string &  aDesc,
FUNC  aMainFunc 
)
inline

Definition at line 73 of file utility_program.h.

74 : m_name( aName ), m_desc( aDesc ), m_func( aMainFunc )
75 {
76 }
std::string m_name
The name of the program (this is used to select one)
FUNC m_func
The function to call to run the program.
std::string m_desc
Description of the program.

◆ UTILITY_PROGRAM() [2/2]

KI_TEST::UTILITY_PROGRAM::UTILITY_PROGRAM ( )
inline

Definition at line 78 of file utility_program.h.

78 : m_func( nullptr )
79 {
80 }

Member Data Documentation

◆ m_desc

std::string KI_TEST::UTILITY_PROGRAM::m_desc

Description of the program.

Definition at line 86 of file utility_program.h.

Referenced by KI_TEST::COMBINED_UTILITY::showSubUtilityList().

◆ m_func

FUNC KI_TEST::UTILITY_PROGRAM::m_func

The function to call to run the program.

Definition at line 89 of file utility_program.h.

Referenced by KI_TEST::COMBINED_UTILITY::findSubUtility().

◆ m_name

std::string KI_TEST::UTILITY_PROGRAM::m_name

The name of the program (this is used to select one)

Definition at line 83 of file utility_program.h.

Referenced by UTILITY_REGISTRY::Register(), and KI_TEST::COMBINED_UTILITY::showSubUtilityList().


The documentation for this struct was generated from the following file: