types.h 964 B

123456789101112131415161718192021222324252627282930313233343536
  1. #pragma once
  2. #include "ghc/filesystem.hpp"
  3. namespace build {
  4. namespace fs = ghc::filesystem;
  5. /**
  6. * A simple opaque typedef which allows us to perform type-sensitive
  7. * output while creating the command string to be invoked.
  8. * For example, command_builder << output_file would automagically
  9. * know to output the tokens: ["-o", output_file.get()].
  10. */
  11. template <typename T, typename> class named_type {
  12. private:
  13. T value_;
  14. public:
  15. named_type(T const & value) : value_(value) {}
  16. named_type(T && value) : value_(std::move(value)) {}
  17. T const & get() const { return value_; }
  18. operator T const &() const { return value_; }
  19. };
  20. struct indent_t {
  21. int value;
  22. };
  23. using source_file = named_type<fs::path, struct source_file_tag>;
  24. using object_file = named_type<fs::path, struct object_file_tag>;
  25. using output_file = named_type<fs::path, struct output_file_tag>;
  26. enum version { none, cxx11, cxx14, cxx17 };
  27. }