Parallel Make  1.0
My implementation of make utility, which can run in multiple threads according to user request.
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends
main.hpp File Reference
#include <iostream>
#include <algorithm>
#include <vector>
#include "file.hpp"

Enumerations

enum  ret_values { CODE_SUCCESS = 0, CODE_QUESTION_FAILURE = 1, CODE_FAILURE = 2 }
 Program return values. C style enum, so these are just int constants. More...
 
enum  process_states {
  process_states::MUST_REBUILD, process_states::UP_TO_DATE, process_states::QUESTION_FAILURE, process_states::BUILD_FAILED,
  process_states::NOT_YET_PROCESSED, process_states::PROCESSING
}
 C++ like enum class. Return values of target processing. More...
 

Functions

void print_version ()
 Prints version and author. More...
 
void print_help (const std::string &exe_name)
 Prints basic help. More...
 
int to_number (const std::string &str)
 
std::string & replace (std::string &what, const std::string &find, const std::vector< file > &replaces)
 
std::string & replace (std::string &what, const std::string &find, const std::string &replace)
 
std::vector< std::string > split (const std::string &str, char delim)
 

Enumeration Type Documentation

enum process_states
strong

C++ like enum class. Return values of target processing.

Enumerator
MUST_REBUILD 

Value, returned whenever processed target was rebuilt.

UP_TO_DATE 

Value, returned if processed target was up to date.

QUESTION_FAILURE 

Value, returned if target has to be rebuild, but -q flag is specified.

BUILD_FAILED 

Value, returned if one of executing commands failed.

NOT_YET_PROCESSED 
PROCESSING 
enum ret_values

Program return values. C style enum, so these are just int constants.

Enumerator
CODE_SUCCESS 

Value, which is returned when make successfuly processes all given targets without failure.

CODE_QUESTION_FAILURE 

Value, which is returned if -q flag is specified, and there exists at least one target, which has to be rebuilt.

CODE_FAILURE 

Value, which is returned whenever an error occurs.

Function Documentation

void print_help ( const std::string &  exe_name)
inline

Prints basic help.

void print_version ( )
inline

Prints version and author.

std::string& replace ( std::string &  what,
const std::string &  find,
const std::vector< file > &  replaces 
)

Replaces occurences of find by space separated replaces in what string.

See also
replace(std::string&, const std::string&, const std::string&)
Parameters
whatString to search in.
findSubstring to look for.
replacesstd::vector to be serialized and replaced for find.
Returns
reference to what.
std::string& replace ( std::string &  what,
const std::string &  find,
const std::string &  replace 
)

Replaces occurences of find by replace in string what.

Parameters
whatString to search in.
findSubstring to look for.
replaceSubstring to be replaced for find.
Returns
reference to what.
std::vector<std::string> split ( const std::string &  str,
char  delim 
)

Splits input string by delimiter.

Parameters
strstring to be split.
delimdelimiter by which str should be split.
Returns
new std::vector of strings.
int to_number ( const std::string &  str)
inline

Converts string to a number with check if all chars of the string are 0-9. This function is only used when converting -j flag, which has to be positive, so 0 is technicaly also error.

Parameters
strstring representing a number.
Returns
number represented by str, zero othrewise.