xtd 0.2.0
Loading...
Searching...
No Matches
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 struct 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
143 int32 compare_to(const guid& value) const noexcept override;
144
145 using object::equals;
146 bool equals(const guid& g) const noexcept override;
147
150 const std::vector<xtd::byte>& to_byte_array() const noexcept;
151
157 xtd::string to_string() const noexcept override;
175 string to_string(const string& format) const;
194 string to_string(const string& format, const std::locale& loc) const override;
196
198
204 static guid new_guid() noexcept;
206
207 private:
208 std::vector<xtd::byte> data_ = std::vector<xtd::byte>(16);
209 };
210}
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:42
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
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.
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.
const std::vector< xtd::byte > & to_byte_array() const noexcept
Returns a 16-element byte array that contains the value of this instance.
bool equals(const guid &g) const noexcept override
Indicates whether the current object is equal to another object of the same type.
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...
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.