cmPathLabel.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  4. Distributed under the OSI-approved BSD License (the "License");
  5. see accompanying file Copyright.txt for details.
  6. This software is distributed WITHOUT ANY WARRANTY; without even the
  7. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the License for more information.
  9. ============================================================================*/
  10. #ifndef cmPathLabel_h
  11. #define cmPathLabel_h
  12. #include <cmConfigure.h>
  13. #include "cmStandardIncludes.h"
  14. /** \class cmPathLabel
  15. * \brief Helper class for text based labels
  16. *
  17. * cmPathLabel is extended in different classes to act as an inheritable
  18. * enum. Comparisons are done on a precomputed Jenkins hash of the string
  19. * label for indexing and searchig.
  20. */
  21. class cmPathLabel
  22. {
  23. public:
  24. cmPathLabel(const std::string& label);
  25. // The comparison operators are only for quick sorting and searching and
  26. // in no way imply any lexicographical order of the label
  27. bool operator<(const cmPathLabel& l) const;
  28. bool operator==(const cmPathLabel& l) const;
  29. const std::string& GetLabel() const { return this->Label; }
  30. const unsigned int& GetHash() const { return this->Hash; }
  31. protected:
  32. cmPathLabel();
  33. std::string Label;
  34. unsigned int Hash;
  35. };
  36. #endif