summaryrefslogtreecommitdiff
path: root/src/buildtool/build_engine/base_maps/module_name.hpp
diff options
context:
space:
mode:
authorKlaus Aehlig <klaus.aehlig@huawei.com>2022-02-22 17:03:21 +0100
committerKlaus Aehlig <klaus.aehlig@huawei.com>2022-02-22 17:03:21 +0100
commit619def44c1cca9f3cdf63544d5f24f2c7a7d9b77 (patch)
tree01868de723cb82c86842f33743fa7b14e24c1fa3 /src/buildtool/build_engine/base_maps/module_name.hpp
downloadjustbuild-619def44c1cca9f3cdf63544d5f24f2c7a7d9b77.tar.gz
Initial self-hosting commit
This is the initial version of our tool that is able to build itself. In can be bootstrapped by ./bin/bootstrap.py Co-authored-by: Oliver Reiche <oliver.reiche@huawei.com> Co-authored-by: Victor Moreno <victor.moreno1@huawei.com>
Diffstat (limited to 'src/buildtool/build_engine/base_maps/module_name.hpp')
-rw-r--r--src/buildtool/build_engine/base_maps/module_name.hpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/buildtool/build_engine/base_maps/module_name.hpp b/src/buildtool/build_engine/base_maps/module_name.hpp
new file mode 100644
index 00000000..26465bf6
--- /dev/null
+++ b/src/buildtool/build_engine/base_maps/module_name.hpp
@@ -0,0 +1,36 @@
+#ifndef INCLUDED_SRC_BUILDTOOL_BUILD_ENGINE_BASE_MAPS_MODULE_NAME_HPP
+#define INCLUDED_SRC_BUILDTOOL_BUILD_ENGINE_BASE_MAPS_MODULE_NAME_HPP
+
+#include "src/utils/cpp/hash_combine.hpp"
+
+namespace BuildMaps::Base {
+
+struct ModuleName {
+ std::string repository{};
+ std::string module{};
+
+ ModuleName(std::string repository, std::string module)
+ : repository{std::move(repository)}, module{std::move(module)} {}
+
+ [[nodiscard]] auto operator==(ModuleName const& other) const noexcept
+ -> bool {
+ return module == other.module && repository == other.repository;
+ }
+};
+} // namespace BuildMaps::Base
+
+namespace std {
+template <>
+struct hash<BuildMaps::Base::ModuleName> {
+ [[nodiscard]] auto operator()(
+ const BuildMaps::Base::ModuleName& t) const noexcept -> std::size_t {
+ size_t seed{};
+ hash_combine<std::string>(&seed, t.repository);
+ hash_combine<std::string>(&seed, t.module);
+ return seed;
+ }
+};
+
+} // namespace std
+
+#endif