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