cmInstalledFile.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #pragma once
  4. #include "cmConfigure.h" // IWYU pragma: keep
  5. #include <map>
  6. #include <memory>
  7. #include <string>
  8. #include <vector>
  9. #include "cmGeneratorExpression.h"
  10. class cmMakefile;
  11. /** \class cmInstalledFile
  12. * \brief Represents a file intended for installation.
  13. *
  14. * cmInstalledFile represents a file intended for installation.
  15. */
  16. class cmInstalledFile
  17. {
  18. public:
  19. using CompiledGeneratorExpressionPtrType =
  20. std::unique_ptr<cmCompiledGeneratorExpression>;
  21. using ExpressionVectorType = std::vector<CompiledGeneratorExpressionPtrType>;
  22. struct Property
  23. {
  24. Property();
  25. ~Property();
  26. Property(const Property&) = delete;
  27. Property& operator=(const Property&) = delete;
  28. ExpressionVectorType ValueExpressions;
  29. };
  30. using PropertyMapType = std::map<std::string, Property>;
  31. cmInstalledFile();
  32. ~cmInstalledFile();
  33. cmInstalledFile(const cmInstalledFile&) = delete;
  34. cmInstalledFile& operator=(const cmInstalledFile&) = delete;
  35. void RemoveProperty(const std::string& prop);
  36. void SetProperty(cmMakefile const* mf, const std::string& prop,
  37. const std::string& value);
  38. void AppendProperty(cmMakefile const* mf, const std::string& prop,
  39. const std::string& value, bool asString = false);
  40. bool HasProperty(const std::string& prop) const;
  41. bool GetProperty(const std::string& prop, std::string& value) const;
  42. bool GetPropertyAsBool(const std::string& prop) const;
  43. std::vector<std::string> GetPropertyAsList(const std::string& prop) const;
  44. void SetName(cmMakefile* mf, const std::string& name);
  45. std::string const& GetName() const;
  46. cmCompiledGeneratorExpression const& GetNameExpression() const;
  47. PropertyMapType const& GetProperties() const { return this->Properties; }
  48. private:
  49. std::string Name;
  50. CompiledGeneratorExpressionPtrType NameExpression;
  51. PropertyMapType Properties;
  52. };