mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-15 07:06:11 -04:00
Signed-off-by: Alexey Polyudov <apolyudov@google.com> Change-Id: I8936b527079074d5c3af5531b9245063767cc4a7
46 lines
1.1 KiB
C++
46 lines
1.1 KiB
C++
#ifndef CORE_V2_INTERNAL_MEDIUMS_UUID_H_
|
|
#define CORE_V2_INTERNAL_MEDIUMS_UUID_H_
|
|
|
|
#include <cstdint>
|
|
#include <string>
|
|
|
|
#include "absl/strings/string_view.h"
|
|
|
|
namespace location {
|
|
namespace nearby {
|
|
namespace connections {
|
|
|
|
// A type 3 name-based
|
|
// (https://en.wikipedia.org/wiki/Universally_unique_identifier#Versions_3_and_5_(namespace_name-based))
|
|
// UUID.
|
|
//
|
|
// https://developer.android.com/reference/java/util/UUID.html
|
|
class Uuid final {
|
|
public:
|
|
Uuid() : Uuid("uuid") {}
|
|
explicit Uuid(absl::string_view data);
|
|
Uuid(std::uint64_t most_sig_bits, std::uint64_t least_sig_bits);
|
|
Uuid(const Uuid&) = default;
|
|
Uuid& operator=(const Uuid&) = default;
|
|
Uuid(Uuid&&) = default;
|
|
Uuid& operator=(Uuid&&) = default;
|
|
~Uuid() = default;
|
|
|
|
// Returns the canonical textual representation
|
|
// (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) of the
|
|
// UUID.
|
|
explicit operator std::string() const;
|
|
std::string data() const {
|
|
return data_;
|
|
}
|
|
|
|
private:
|
|
std::string data_;
|
|
};
|
|
|
|
} // namespace connections
|
|
} // namespace nearby
|
|
} // namespace location
|
|
|
|
#endif // CORE_V2_INTERNAL_MEDIUMS_UUID_H_
|