xtd 0.2.0
guid.hpp
Go to the documentation of this file.
1
4#pragma once
5#include "core_export.hpp"
6#include "icomparable.hpp"
7#include "iequatable.hpp"
8#include "iformatable.hpp"
9#include "object.hpp"
10#include "string.hpp"
11#include <vector>
12
14namespace xtd {
24 class core_export_ guid final : public object, public icomparable<guid>, public xtd::iequatable<guid>, public xtd::iformatable {
25 public:
27
32 static const guid empty;
34
36
39 guid() = default;
43 explicit guid(const std::vector<xtd::byte>& data);
47 explicit guid(const std::initializer_list<xtd::byte>& data);
60 explicit guid(int32 a, int16 b, int16 c, const std::vector<xtd::byte>& d);
73 explicit guid(uint32 a, uint16 b, uint16 c, const std::vector<xtd::byte>& d);
123 explicit guid(const string& guid);
125
127 guid(const guid&) = default;
128 guid& operator =(const guid&) = default;
130
132
144 int32 compare_to(const guid& value) const noexcept override;
145
149 bool equals(const object& obj) const noexcept override;
153 bool equals(const guid& g) const noexcept override;
154
157 xtd::size get_hash_code() const noexcept override;
158
161 const std::vector<xtd::byte>& to_byte_array() const noexcept;
162
168 xtd::string to_string() const noexcept override;
186 string to_string(const string& format) const;
205 string to_string(const string& format, const std::locale& loc) const override;
207
209
215 static guid new_guid() noexcept;
217
218 private:
219 std::vector<xtd::byte> data_ = std::vector<xtd::byte>(16);
220 };
221}
Represents a globally unique identifier (GUID). A GUID is a 128-bit integer (16 bytes) that can be us...
Definition guid.hpp:24
guid(const string &guid)
Initializes a new instance of the xtd::guid structure by using the value represented by the specified...
guid()=default
Initializes a new instance of the xtd::guid structure.
static const guid empty
Gets A read-only instance of the xtd::guid structure whose value is all zeros.
Definition guid.hpp:32
guid(const std::vector< xtd::byte > &data)
Initializes a new instance of the xtd::guid structure by using the specified array of bytes.
guid(int32 a, int16 b, int16 c, xtd::byte d, xtd::byte e, xtd::byte f, xtd::byte g, xtd::byte h, xtd::byte i, xtd::byte j, xtd::byte k) noexcept
Initializes a new instance of the xtd::guid structure by using the specified integers and bytes.
bool equals(const object &obj) const noexcept override
Determines whether the specified object is equal to the current object.
bool equals(const guid &g) const noexcept override
Determines whether the specified object is equal to the current object.
guid(uint32 a, uint16 b, uint16 c, const std::vector< xtd::byte > &d)
Initializes a new instance of the xtd::guid structure by using the specified unsigned integers and by...
xtd::size get_hash_code() const noexcept override
Serves as a hash function for a particular type.
guid(uint32 a, uint16 b, uint16 c, xtd::byte d, xtd::byte e, xtd::byte f, xtd::byte g, xtd::byte h, xtd::byte i, xtd::byte j, xtd::byte k) noexcept
Initializes a new instance of the xtd::guid structure by using the specified unsigned integers and by...
int32 compare_to(const guid &value) const noexcept override
Compares the current instance with another object of the same type.
guid(int32 a, int16 b, int16 c, const std::vector< xtd::byte > &d)
Initializes a new instance of the xtd::guid structure by using the specified integers and byte array.
guid(const std::initializer_list< xtd::byte > &data)
Initializes a new instance of the xtd::guid structure by using the specified array of bytes.
Defines a generalized comparison method that a value type or class implements to create a type-specif...
Definition icomparable.hpp:21
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.hpp:22
Provides functionality to format the value of an object into a string representation.
Definition iformatable.hpp:35
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:44
Contains core_export_ keyword.
#define core_export_
Define shared library export.
Definition core_export.hpp:13
int16_t int16
Represents a 16-bit signed integer.
Definition int16.hpp:23
int32_t int32
Represents a 32-bit signed integer.
Definition int32.hpp:23
uint32_t uint32
Represents a 32-bit unsigned integer.
Definition uint32.hpp:23
size_t size
Represents a size of any object in bytes.
Definition size.hpp:23
uint8_t byte
Represents a 8-bit unsigned integer.
Definition byte.hpp:23
uint16_t uint16
Represents a 16-bit unsigned integer.
Definition uint16.hpp:23
Contains xtd::icomparable interface.
Contains xtd::iequatable interface.
Contains xtd::iformatable interface.
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10
Contains xtd::object class.
Contains xtd::string alias.