cmPathLabel.h 1023 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #ifndef cmPathLabel_h
  4. #define cmPathLabel_h
  5. #include "cmConfigure.h" // IWYU pragma: keep
  6. #include <string>
  7. /** \class cmPathLabel
  8. * \brief Helper class for text based labels
  9. *
  10. * cmPathLabel is extended in different classes to act as an inheritable
  11. * enum. Comparisons are done on a precomputed Jenkins hash of the string
  12. * label for indexing and searchig.
  13. */
  14. class cmPathLabel
  15. {
  16. public:
  17. cmPathLabel(const std::string& label);
  18. // The comparison operators are only for quick sorting and searching and
  19. // in no way imply any lexicographical order of the label
  20. bool operator<(const cmPathLabel& l) const;
  21. bool operator==(const cmPathLabel& l) const;
  22. const std::string& GetLabel() const { return this->Label; }
  23. const unsigned int& GetHash() const { return this->Hash; }
  24. protected:
  25. cmPathLabel();
  26. std::string Label;
  27. unsigned int Hash;
  28. };
  29. #endif