Fawkes API  Fawkes Development Version
PluginGenerator Class Reference

#include <plugin_generator.h>

Public Member Functions

 PluginGenerator (const std::string &directory, const std::string &author, const std::string &year, const std::string &creation_date, const std::string &plugin_name, const std::string &description)
 Constructor. More...
 
 ~PluginGenerator ()
 Destructor. More...
 
void write_thread_h (FILE *f)
 Write h file. More...
 
void write_thread_cpp (FILE *f)
 Write cpp file. More...
 
void write_plugin_cpp (FILE *f)
 Write plugin cpp file. More...
 
void write_makefile (FILE *f)
 Write Makefile. More...
 
void write_makefile_header (FILE *f)
 Write makefile header. More...
 
void write_header (FILE *f, std::string filename)
 Write header to file. More...
 
void write_deflector (FILE *f)
 Write header deflector. More...
 
std::string format_class_name (std::string plugin_name, std::string append)
 Format a lowercase plugin name to CamelCase class. More...
 
std::string replace_dash_w_undescore (std::string source)
 Replace dash with underscore. More...
 
void generate ()
 Generator cpp and h files. More...
 

Detailed Description

Generate basic plugins from minimal input.

Definition at line 31 of file plugin_generator.h.

Constructor & Destructor Documentation

◆ PluginGenerator()

PluginGenerator::PluginGenerator ( const std::string &  directory,
const std::string &  author,
const std::string &  year,
const std::string &  creation_date,
const std::string &  plugin_name,
const std::string &  description 
)

Constructor.

Parameters
directoryDirectory where to create the files
authorAuthor of the plugin
yearYear of copyright
creation_dateCreation date of the plugin
plugin_nameName of the plugin
descriptionPlugin description

Definition at line 49 of file plugin_generator.cpp.

References format_class_name(), replace_dash_w_undescore(), and fawkes::StringConversions::to_upper().

◆ ~PluginGenerator()

PluginGenerator::~PluginGenerator ( )

Destructor.

Definition at line 81 of file plugin_generator.cpp.

Member Function Documentation

◆ format_class_name()

std::string PluginGenerator::format_class_name ( std::string  plugin_name,
std::string  appendix 
)

Format a lowercase plugin name to CamelCase class.

Example: plugin_name to PluginNameThread

Parameters
plugin_namename of plugin
appendixclass name appendix, e.g., Thread or Plugin
Returns
class name matching the plugin name

Definition at line 327 of file plugin_generator.cpp.

Referenced by PluginGenerator().

◆ generate()

void PluginGenerator::generate ( )

Generator cpp and h files.

Definition at line 358 of file plugin_generator.cpp.

References write_makefile(), write_plugin_cpp(), write_thread_cpp(), and write_thread_h().

◆ replace_dash_w_undescore()

std::string PluginGenerator::replace_dash_w_undescore ( std::string  source)

Replace dash with underscore.

Example: plugin-generator to plugin_generator

Parameters
sourceinput string
Returns
modified string

Definition at line 311 of file plugin_generator.cpp.

Referenced by PluginGenerator().

◆ write_deflector()

void PluginGenerator::write_deflector ( FILE *  f)

Write header deflector.

Parameters
ffile to write to

Definition at line 150 of file plugin_generator.cpp.

Referenced by write_thread_h().

◆ write_header()

void PluginGenerator::write_header ( FILE *  f,
std::string  filename 
)

Write header to file.

Parameters
ffile to write to
filenamename of file

Definition at line 90 of file plugin_generator.cpp.

Referenced by write_plugin_cpp(), write_thread_cpp(), and write_thread_h().

◆ write_makefile()

void PluginGenerator::write_makefile ( FILE *  f)

Write Makefile.

Parameters
ffile to write to

Definition at line 282 of file plugin_generator.cpp.

References write_makefile_header().

Referenced by generate().

◆ write_makefile_header()

void PluginGenerator::write_makefile_header ( FILE *  f)

Write makefile header.

Parameters
ffile to write to

Definition at line 123 of file plugin_generator.cpp.

Referenced by write_makefile().

◆ write_plugin_cpp()

void PluginGenerator::write_plugin_cpp ( FILE *  f)

Write plugin cpp file.

Parameters
ffile to write to

Definition at line 238 of file plugin_generator.cpp.

References write_header().

Referenced by generate().

◆ write_thread_cpp()

void PluginGenerator::write_thread_cpp ( FILE *  f)

Write cpp file.

Parameters
ffile to write to

Definition at line 160 of file plugin_generator.cpp.

References write_header().

Referenced by generate().

◆ write_thread_h()

void PluginGenerator::write_thread_h ( FILE *  f)

Write h file.

Parameters
ffile to write to

Definition at line 197 of file plugin_generator.cpp.

References write_deflector(), and write_header().

Referenced by generate().


The documentation for this class was generated from the following files: