bob.hpp
Loading...
Searching...
No Matches
bob::RebuildConfig Struct Reference

Configuration for rebuilding the current executable. More...

#include <bob.hpp>

Public Member Functions

 RebuildConfig ()=default
 Create an empty rebuild configuration.
 
 RebuildConfig (vector< string > &&parts)
 Create a rebuild configuration with the given parts.
 
Cmd cmd (string source="bob.cpp", string program="bob") const
 

Public Attributes

const std::string_view PROGRAM = "_PROGRAM_"
 Special string to represent the program name in the command parts.
 
const std::string_view SOURCE = "_SOURCE_"
 Special string to represent the source file name in the command parts.
 
vector< string > parts
 A vector of strings representing the command parts before substitution.
 

Detailed Description

Configuration for rebuilding the current executable.

This class allows specifying how to rebuild the current executable parts is a vector of strings that represent the command line parts. The special strings _PROGRAM_ and _SOURCE_ can be used to represent the program name and source file name respectively. By default, these are set to "bob" and "bob.cpp".

Note
This class is used indirectly by the GO_REBUILD_YOURSELF macro. To customize the rebuild command in used by the macro, you can define BOB_REBUILD_CMD before including the bob.hpp header file.
Example
// Specify the desired rebuild command.
RebuildConfig config({ "g++", "-o", "_PROGRAM_", "_SOURCE_", "-Wall" });
// Create a run-able command. Program and source files can be specified here if needed.
Cmd cmd = config.cmd();
// Runs: g++ -o my_program my_source.cpp -Wall
cmd.run();
Represents a command to be executed in the operating system shell.
Definition bob.hpp:287
int run()
Configuration for rebuilding the current executable.
Definition bob.hpp:88
Cmd cmd(string source="bob.cpp", string program="bob") const

Member Function Documentation

◆ cmd()

Cmd bob::RebuildConfig::cmd ( string  source = "bob.cpp",
string  program = "bob" 
) const

Create a Cmd object from this configuration. The _PROGRAM_ and _SOURCE_ placeholders will be replaced with the provided program and source arguments.


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