command_builder.h 761 B

12345678910111213141516171819202122232425262728293031
  1. #pragma once
  2. #include <iostream>
  3. #include <sstream>
  4. #include <string>
  5. #include "types.h"
  6. namespace build {
  7. class command_builder {
  8. private:
  9. indent_t indent_;
  10. std::stringstream buffer_;
  11. public:
  12. command_builder(std::string const & cmd, int indent = 0);
  13. template <typename T> command_builder && operator<<(T const & value) &&;
  14. template <typename T> command_builder & operator<<(T const & value) &;
  15. template <typename T>
  16. command_builder & operator<<(std::vector<T> const & value) &;
  17. int execute() const;
  18. private:
  19. template <typename T> void write(T const & value) { buffer_ << value; }
  20. void write(version const & vers);
  21. void write(source_file const & file);
  22. void write(output_file const & file);
  23. };
  24. }